public class Solution {
    /*
    两个栈s1,s2
    s1用于入队
    s2用于出队
        先判断队列是否为空,不空则
            出队的时候若s2不空,则直接s2出栈一个元素
            出队的时候若s2空,s1不空,则把s1中元素出栈后压入s2,s2 出栈一个元素
    s1,s2同时为空则队列空
    
    */
    Stack<Integer> stack1 = new Stack<Integer>();
    Stack<Integer> stack2 = new Stack<Integer>();
    
    public void push(int node) {
        stack1.push(node);
    }
    
    public int pop(){
        if(!stack2.empty()){
            return stack2.pop();
        }else if(!stack1.empty() && stack2.empty()){
            while(!stack1.empty()){
                stack2.push(stack1.pop());
            }
        }
        return stack2.pop();
    }
}