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

int pop() {
    int now;
    while(!stack1.empty())
    {
        now=stack1.top();
        stack1.pop();
        stack2.push(now);
    }
    stack2.pop();
    while(!stack2.empty())
    {
        int n=stack2.top();
        stack2.pop();
        stack1.push(n);
    }
    return now;
}

private: stack stack1; stack stack2; };