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