include [HTML_REMOVED]
using namespace std;
const int N = 100010;
int q[N],hh,tt,x;
int main()
{
int m;
string operation;
cin>>m;
while(m –)
{
cin>>operation;
if(operation == “push”)
{
cin>>x;
q[tt] = x;
}
else if(operation == “pop”)
{
hh;
}
else if(operation == “empty”)
{
if(hh<tt)
{
cout<<”NO”<<endl;
}
else
{
cout<<”YES”<<endl;
}
}
else
{
cout<<q[hh]<<endl;
}
}
return 0;
}