用的是栈思想```cpp
#include
using namespace std;
unsigned long long t,n,x;
char c[100];
unsigned long long p[1000005],top=0;
//top是栈顶,数组p是栈
int main()
{
cin>>t;
for(int i=1;i<=t;i++)
{
cin>>n;
top=0;
for(int j=1;j<=n;j++)
{
cin>>c;
if(c=="pop")
{
if(top!=0)
{
p[top]=0;
top--;
}
else cout<<"Empty"<<endl;
}
else if(c=="query")
{
if(top!=0)
{
cout<<p[top];
}
else cout<<"Anguei!"<<endl;
}
else if(c=="size")
{
cout<<top<<endl;
}
else if(c=="push")
{
cin>>x;
top++;
p[top]=x;
}
}
}
return 0;
}