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