Prateek Sir and Coding question giving wrong answer, why?

hey @MadHawk, there are some small mistakes in your code. I have made changes on your code, you can check them here. https://ide.codingblocks.com/s/99441

#include
#include
using namespace std;

int main () {
stack<pair<int, int>> s;
int n;
cin>>n;
int qno,val;
while(n>0){
cin>>qno;
if(qno==2){
cin>>val;
s.push(make_pair(qno,val));
}
else if(qno==1){
if(s.empty()){
cout<<“No Code”;
}
else{
auto x= s.top();
cout<<x.second<<endl;
s.pop();
}
}
n–;
}
return 0;
}

My code runs well for test case but wrong answer when i submit it for hidden test cases. Please help me with what changes I need to make in my code.