#include <iostream>
#include <list>

class Stack {
private:
    std::list<int> stackList;

public:
    void push(int value) { stackList.push_back(value); }
    
    void pop() {
        if (!stackList.empty()) {
            stackList.pop_back();
        }
    }
    
    int top() {
        return stackList.back();
    }
    
    bool isEmpty() { return stackList.empty(); }
};

int main() {
    Stack s;
    s.push(10);
    s.push(20);
    s.push(30);

    std::cout << "Top element: " << s.top() << std::endl;
    
    s.pop();
    std::cout << "Top element after pop: " << s.top() << std::endl;

    return 0;
}