#include <bits/stdc++.h>
using namespace std;
stack<int> s;
int main()
{
int x,T;
cin >> T;
while (T--)
{
string op;
cin >> op;
if(op == "push")
{
cin >> x;
s.push(x);
}
if(op == "pop")
{
if(s.empty())
{
cout << "Empty"<<endl;
}
else
{
s.pop();
}
}
if(op == "query")
{
if(s.empty())
{
cout << "Empty"<<endl;
}
else
{
cout <<s.top()<<endl;
}
}
if(op == "size")
{
cout << s.size()<<endl;
}
}
return 0;
}
// 64 位输出请用 printf("%lld")

京公网安备 11010502036488号