class MyQueue {
Stack[HTML_REMOVED] stack1,stack2;
/* Initialize your data structure here. /
public MyQueue() {
stack1=new Stack[HTML_REMOVED]();
stack2=new Stack[HTML_REMOVED]();
}
/** Push element x to the back of queue. */
public void push(int x) {
stack1.push(x);
}
/** Removes the element from in front of queue and returns that element. */
public int pop() {
int a;
if(stack2.empty()){
while(!stack1.empty()){
a = stack1.peek();
stack1.pop();
stack2.push(a);
}
}
a = stack2.peek();
stack2.pop();
return a;
}
/** Get the front element. */
public int peek() {
int b;
if(stack2.empty()){
while(!stack1.empty()){
b = stack1.peek();
stack2.push(b);
stack1.pop();
}
}
b = stack2.peek();
return b;
}
/** Returns whether the queue is empty. */
public boolean empty() {
return stack1.empty()&&stack2.empty();
}
}