B3614
#include <bits/stdc++.h>
using namespace std;
stack<unsigned long long> s;
unsigned long long t,k,x;
string st;
int main()
{
cin>>t;
while(t--)
{
cin>>k;
for(int j = 1;j <= k;j++)
{
cin>>st;
if(st == "push")
{
cin>>x;
s.push(x);
}
else if(st == "query")
{
if(s.empty())
{
cout<<"Anguei!\n";
}
else
{
cout<<s.top()<<"\n";
}
}
else if(st == "size")
{
cout<<s.size()<<"\n";
}
else
{
if(s.empty())
{
cout<<"Empty\n";
}
else
{
s.pop();
}
}
}
}
return 0;
}