B3614

· · 个人记录

#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long int ull;
const int N=1e5+50;
ull n,t;
int main(){
    cin>>t;
    while(t--){
        cin>>n;
        stack<ull>st;
        while(n--){
            string s;
            cin>>s;
            ull x;
            if(s[0]=='p'&&s[1]=='u'){
                cin>>x;
                st.push(x);
            }else if(s[0]=='p'&&s[1]=='o'){
                if(st.empty()) cout<<"Empty"<<'\n';
                else st.pop();
            }else if(s[0]=='q'){
                if(st.empty()) cout<<"Anguei!"<<'\n';
                else cout<<st.top()<<'\n';
            }else cout<<st.size()<<'\n';
        }
    }
    return 0;
}