class Stack {
LinkedList<Integer> storage = new LinkedList<>();
// Push a new item into the stack
public void push(int x) {
storage.add(x);
}
// Pop the top of the stack
public void pop() {
storage.removeLast();
}
// Return the top of the stack
public int top() {
return storage.peekLast();
}
// Check the stack is empty or not.
public boolean isEmpty() {
return storage.isEmpty();
}
}