#include<bits/stdc++.h>
using namespace std;
using LL=long long;
using ULL=unsigned long long;
#define rep(i,n) for(int i=0; i<(n); i++)

const string colors = "RB";
int colorid(char c){ return colors.find(c); }

struct Ball{ int c,x,y,i; };
struct BallCmp{
	int c;
	bool operator()(const Ball& l,const Ball& r)const{
		if(l.y!=r.y) return l.y<r.y;
		return (l.c^c) > (r.c^c);
	}
};

struct graph{
	int N;
	vector<vector<int>> E;
	graph(int n){ N=n; E.resize(N); }
	void add_edge(int u,int v){ E[u].push_back(v); }
	vector<int> topological(){
		vector<int> I(N);
		rep(u,N) for(int v:E[u]) I[v]++;
		queue<int> Q;
		rep(i,N) if(I[i]==0) Q.push(i);
		vector<int> res;
		while(Q.size()){
			int q=Q.front(); Q.pop();
			res.push_back(q);
			for(int e:E[q]){
				I[e]--; if(I[e]==0) Q.push(e);
			}
		}
		if(res.size()!=N) return vector<int>();
		return move(res);
	}
};

int main(){
	int N; cin>>N;
	vector<Ball> D[2];
	rep(i,N){ char c,x; int y; cin>>c>>x>>y; D[colorid(x)].push_back({colorid(c),colorid(x),y,i}); }
	rep(i,2) sort(D[i].begin(),D[i].end(),BallCmp{i});
	graph G(N);
	rep(i,2) rep(j,(int)D[i].size()-1) G.add_edge(D[i][j].i,D[i][j+1].i);
	vector<int> P[2][2];
	rep(i,2) for(Ball& b:D[i]) P[i][b.c].push_back(b.i);
	rep(x,2){
		int p=0;
		auto& tg = P[x^1][x];
		for(Ball& b:D[x]){
			if(p>b.y || b.y-p>tg.size()){ cout<<"No"<<endl; return 0; }
			if(b.y-p-1>=0) G.add_edge(tg[b.y-p-1],b.i);
			if(b.y-p<tg.size()) G.add_edge(b.i,tg[b.y-p]);
			if(b.c==x) p++;
		}
	}
	auto Q = G.topological();
	if(Q.empty()){ cout<<"No"<<endl; return 0; }
	
	cout<<"Yes"<<endl;
	rep(i,Q.size()){ if(i) cout<<" "; cout<<(Q[i]+1); } cout<<endl;
	return 0;
}