#include<iostream>
using namespace std;
const int N=100010;
int top;
int s[N];
void push(unsigned long long x)
{
s[++top]=x;
}
void query(){
if(top == 0) cout<<"Anguei!"<<endl;
else{
int t=s[top];
cout<< t <<endl;
}
}
void pop(){
if( top == 0) cout<<"Empty"<<endl;
else top--;
}
void size(){
cout<< top <<endl;
}
int main(){
int t;
cin>>t;
while(t--)
{
int n;
cin>>n;
while(n--)
{
string a;
cin>>a;
if(a == "push") {
unsigned long long x;
cin>>x;
push(x);
}
else if(a == "pop") pop();
else if(a == "query") query();
else if(a == "size") size();
}
top=0;
}
}