import java.util.Stack;

public class Solution {
    public Stack<Integer> s1 = new Stack<>();
    public Stack<Integer> s2 = new Stack<>();
    
    public void push(int node) {
        int min = node;
        if(!s2.isEmpty()) {
            min = Math.min(s2.peek(), min);
        }
        s1.push(node);
        s2.push(min);
    }
    
    public void pop() {
        s1.pop();
        s2.pop();
    }
    
    public int top() {
        return s1.peek();
    }
    
    public int min() {
        return s2.peek();
    }
}