import java.util.Stack;
public class Solution9 {
Stack<Integer> stack1 = new Stack<>();
Stack<Integer> stack2 = new Stack<>();
public static void main(String[] args) {
Solution9 s = new Solution9();
s.push(1);
s.push(2);
int res = s.pop();
System.out.println(res);
}
public void push(int node){
stack1.push(node);
}
public int pop(){
if (stack1.empty() && stack2.empty()){
throw new RuntimeException("栈为空,无法pop");
}
if (stack2.empty()){
while (!stack1.empty()){
stack2.push(stack1.pop());
}
}
return stack2.pop();
}
}