#include<iostream>
#include<algorithm>
using namespace std;
const int N=1e6+10;
int s[N],tt;
int t,n;
void init(){
tt=-1;
}
void push(int x){
s[++tt]=x;
}
void pop(){
if(tt>=0) tt--;
else puts("Empty");
}
void query(){
if(tt>=0) printf("%d\n",s[tt]);
else puts("Anguei!");
}
void size(){
printf("%d\n",tt+1);
}
int main(){
scanf("%d",&t);
while(t--){
init();
int cnt;
scanf("%d",&cnt);
while(cnt--){
string op;
cin>>op;
if(op=="push"){
int x;
scanf("%d",&x);
push(x);
}else if(op=="query"){
query();
}else if(op=="size"){
size();
}else{
pop();
}
}
}
return 0;
}
案列是对的,但是就是ac不了