```
from collections import deque
```

class Stack:

# initialize your data structure here.

def **init**(self):

self.q1 = None

self.q2 = None

```
# @param x, an integer
# @return nothing
def push(self, x):
if self.q1 == None:
self.q1 = deque()
self.q1.append(x)
# @return nothing
def pop(self):
self.q2 = deque()
while self.q1:
tmp = self.q1.popleft()
if self.q1:
self.q2.append(tmp)
if self.q2:
self.q1 = self.q2
else:
self.q1 = None
# @return an integer
def top(self):
self.q2 = deque()
while self.q1:
tmp = self.q1.popleft()
self.q2.append(tmp)
self.q1 = self.q2
return tmp
# @return an boolean
def empty(self):
return self.q1 == None
```