

- #include
- #define ull unsigned long long
- using namespace std;
-
- int main()
- {
- int t;
- cin >> t;
- while(t--)
- {
- stack
st; - int n;
- cin >> n;
- while(n--)
- {
- string s;
- cin >> s;
- ull a;
- if(s == "push") cin >> a;
- if(s == "push") st.push(a);
- else if(s == "pop")
- {
- if(!st.empty()) st.pop();
- else cout << "Empty" << endl;
- }
- else if(s == "query")
- {
- if(!st.empty()) cout << st.top() << endl;
- else cout << "Anguei!" << endl;
- }
- else cout << st.size() << endl;
- }
- }
- return 0;
- }