class Solution {
private:
    stack<int> st1;
    stack<int> st2;
public:
    void push(int value) {
        st1.push(value);
        if(st2.empty()){
            st2.push(value);
        }
        else{
            int min_value = st2.top() >= value ? value : st2.top();
            st2.push(min_value);
        }
    }
    void pop() {
        st1.pop();
        st2.pop();
    }
    int top() {
        return st1.top();
    }
    int min() {
        return st2.top();
    }
};