#include<bits/stdc++.h>
using namespace std;
const int N=1e5+10;
int n,a[N],p;
int main(){
cin>>n;
string ins;
int x;
while(n--){
cin>>ins;
if(ins=="push"){
cin>>x;
a[p]=x;
p++;
}else if(ins=="pop"){
if(p!=0){
p--;
}else{
cout<<"Empty"<<endl;
}
}else if(ins=="query"){
if(p!=0){
cout<<a[p-1]<<endl;
}else{
cout<<"Empty"<<endl;
}
}else if(ins=="size"){
cout<<p<<endl;
}
}
return 0;
}

京公网安备 11010502036488号