# -*- coding:utf-8 -*-
"""
  解题思路:
  1. 入队时候 往stack1 存入
  2. 出队时候,如果stack2 不为空 ,stack2 先出队 
     如果stack2 为空 stack1 不为空将stack1 存入stack2 ,再弹出stack2 栈顶

"""


class Solution:
    def __init__(self):
        self.stack1 = []
        self.stack2 = []
    def push(self, node):
        # write code here
        self.stack1.append(node)
    def pop(self):
        # return xx
        if not self.stack1  and not self.stack2:
            return  -1
        if   self.stack2: 
            return self.stack2.pop()
        while self.stack1:
            self.stack2.append(self.stack1.pop())
        return self.stack2.pop()