class MinStack:

# @param x, an integer

# @return an integer

q = []

```
def __init__(self):
self.q = []
def push(self, x):
cur_min = self.getMin()
if cur_min == None or cur_min < x:
cur_min = x
self.q.append((x, cur_min))
# @return nothing
def pop(self):
self.q.pop()
# @return an integer
def top(self):
if len(self.q) == 0:
return None
else:
return self.q[len(self.q)-1][0]
# @return an integer
def getMin(self):
if len(self.q) == 0:
return None
else:
return self.q[len(self.q)-1][1]
```

input: [-1], getMin, top

output: [-1,-3]

expected: [-1,-1]

The piece of code runs correctly in Eclipse. Could someone give me some advise?