import java.util.*;
public class Solution {

     Deque<Integer> stack1;
    Deque<Integer> stack2;
    public Solution(){
        stack1=new LinkedList<>();//入栈
        stack2=new LinkedList<>();//出栈
    }

    public void push(int node) {
         stack1.push(node);
    }

    public int pop() {
        if (!stack2.isEmpty()){
           return stack2.pop();
       }
     while (!stack1.isEmpty()){
           stack2.push(stack1.pop());
       }
       return stack2.pop();
    }
}