class MyQueue:
def __init__(self):
self.A,self.B = [],[]
def push(self, x: int) -> None:
self.A.append(x)
def pop(self) -> int:
for i in range(len(self.A)):
self.B.append(self.A.pop())
return self.B.pop()
def peek(self) -> int:
ans = self.pop()
self.A.append(ans)
return ans
def empty(self) -> bool:
return not self.A and not self.B
# Your MyQueue object will be instantiated and called as such:
# obj = MyQueue()
# obj.push(x)
# param_2 = obj.pop()
# param_3 = obj.peek()
# param_4 = obj.empty()