class Stack:

# initialize your data structure here.

def **init**(self):

self.queue1 = []

self.queue2 = []

self.size = 0

```
# @param x, an integer
# @return nothing
def push(self, x):
if len(self.queue1)==0:
self.queue1.append(x)
for i in range(len(self.queue2)):
self.queue1.append(self.queue2[i])
self.queue2 = []
else:
self.queue2.append(x)
for i in range(len(self.queue1)):
self.queue2.append(self.queue1[i])
self.queue1 = []
self.size += 1
# @return nothing
def pop(self):
if len(self.queue1)!=0:
for i in range(len(self.queue1)-1):
self.queue1[i] = self.queue1[i+1]
self.queue1.pop()
else:
for i in range(len(self.queue2)-1):
self.queue2[i] = self.queue2[i+1]
self.queue2.pop()
self.size -= 1
# @return an integer
def top(self):
if len(self.queue1)!=0:
return self.queue1[0]
else:
return self.queue2[0]
# @return an boolean
def empty(self):
return self.size == 0
```