#include<bits/stdc++.h>
using namespace std;
int n;
map<int,int> a;
priority_queue<int,vector<int>,greater<int> > q;
int main(){
cin>>n;
while(n--){
int s;
cin>>s;
if(s==1){
int x,y;
cin>>x>>y;
a[x]+=y;
q.push(x);
}else{
int x;
cin>>x;
if(a[x]) cout<<"YES"<<endl;
else cout<<"NO"<<endl;
}
}
while(!q.empty()){
int x=q.top();
q.pop();
if(a[x]!=-123456) cout<<x<<" "<<a[x]<<endl;
a[x]=-123456;
}
return 0;
}