This problem is in Contest(s) below:
Contest 1001:队列入门
Contest 1096:栈及队列