class MyStack {
Queue<Integer> query;
public MyStack() {
query = new LinkedList<>();
}
public void push(int x) {
query.offer(x);
int size = query.size();
for(int i = 0 ; i < query.size()-1 ;i++){
query.add(query.poll());
}
}
public int pop() {
return query.poll();
}
public int top() {
return query.peek();
}
public boolean empty() {
return query.isEmpty();
}
// public void dumpBack(int x){
// int size = query.size();
// for(int i = 0 ; i < query.size()-1 ;i++){
// query.add(query.poll(x));
// }
// }
}
/**
* Your MyStack object will be instantiated and called as such:
* MyStack obj = new MyStack();
* obj.push(x);
* int param_2 = obj.pop();
* int param_3 = obj.top();
* boolean param_4 = obj.empty();
*/