class Solution:
def __init__(self):
self.stack=[]
self.minstack=[]
def push(self, node):
# write code here
self.stack.append(node)
if not self.minstack or (self.minstack and self.minstack[-1]>node):
self.minstack.append(node)
else:
self.minstack.append(self.minstack[-1])
def pop(self):
# write code here
self.minstack.pop()
return self.stack.pop()
def top(self):
# write code here
return self.stack[-1]
def min(self):
# write code here
return self.minstack[-1]