what is wrong in this and which testcase fails
#include
#include
using namespace std;
int main() {
int n;
cin>>n;
queue<pair<int,int>>q;
char ch;
int cnt=0;
while(n--)
{
cin>>ch;
switch(ch){
case 'E':
{int a,b;
cin>>a>>b;
q.push({a,b});
}
break;
case 'D':
{cnt++;
}
break;
}
}
//cout<<cnt;
// while(!q.empty()){
// pair<int,int>p=q.front();
// cout<<p.first<<" "<<p.second<<endl;
// q.pop();
// }
pair<int,int> ele=q.front();
while(!q.empty() && cnt>0){
cout<<ele.first<<" "<<ele.second<<endl;
cnt--;
q.pop();
pair<int,int> y=q.front();
while(ele.first!=y.first){
// y=q.front();
ele=q.front();
q.pop();
q.push(y);
}
ele=q.front();
}
return 0;
}