class Stack<T> {
  val elements:MutableList<T> = mutableListOf()
  fun isEmpty()=elements.size==0
  fun pop():Unit {
    if(!isEmpty()) elements.removeAt(elements.size-1)
  }
  fun push(x:T):Unit {
    elements.add(x)
  }
  fun top()=elements.last()
}
var s=Stack<Int>()
s.push(10)
s.push(20)
println(s.top())
s.pop()
println(s.top())
