This problem is used in private contest:栈和队列