#include<bits/stdc++.h>
using namespace std;
stack<int>s;
int main(){
int n=0,x=0,a=0;
string c;
cin>>n;
for(int i=1;i<=n;i++){
cin>>a;
for(int j=1;j<=a;i++){
cin>>c;
if(c=="push"){
cin>>x;
s.push(x);
}
if(c=="pop"){
if(s.size()!=0){
s.pop();
}else{
cout<<"Empty";
}
}
if(c=="query"){
if(s.size()!=0){
cout<<s.top()<<endl;
}else{
cout<<"Anguei!";
}
}
if(c=="size"){
cout<<s.size();
}
}
}
return 0;
}