class MyStack {
/** Initialize your data structure here. */
public MyStack() {
Queue <> q = new Linkedlist <>;
}
/** Push element x onto stack. */
public void push(int x) {
q.poll(x);
}
/** Removes the element on top of the stack and returns that element. */
public int pop() {
for (int i = 0; i < q.length-2 ;i++){
int a = q.poll();
q.offer(a);
}
q.poll();
}
/** Get the top element. */
public int top() {
public int pop() {
for (int i = 0; i < q.length-2 ;i++){
int a = q.poll();
q.offer(a);
}
q.peek();
}
/** Returns whether the stack is empty. */
public boolean empty() {
if (q.isEmpty()){
return True;
else
return false;
}
}