import sys input = sys.stdin.readline N = int(input()) dic = {"RR":[],"RB":[],"BR":[],"BB":[]} for _ in range(N): c,x,y = input().split() y = int(y) dic[c+x].append((y,_+1)) for color in dic: dic[color].sort(reverse=True) ans = [] R,B = 0,0 while len(ans)<N: if dic["BR"] and dic["BR"][-1][0]==R: if dic["RB"] and dic["RB"][-1][0]==B: exit(print("No")) elif dic["BB"] and dic["BB"][-1][0]==B: ans.append(dic["BB"].pop()[1]) B += 1 else: ans.append(dic["BR"].pop()[1]) B += 1 elif dic["RB"] and dic["RB"][-1][0]==B: if dic["RR"] and dic["RR"][-1][0]==R: ans.append(dic["RR"].pop()[1]) R += 1 else: ans.append(dic["RB"].pop()[1]) R += 1 elif dic["RR"] and dic["RR"][-1][0]==R: ans.append(dic["RR"].pop()[1]) R += 1 elif dic["BB"] and dic["BB"][-1][0]==B: ans.append(dic["BB"].pop()[1]) B += 1 else: exit(print("No")) print("Yes") print(*ans)