import sys # sys.setrecursionlimit(200005) int1 = lambda x: int(x)-1 p2D = lambda x: print(*x, sep="\n") def II(): return int(sys.stdin.readline()) def LI(): return list(map(int, sys.stdin.readline().split())) def LI1(): return list(map(int1, sys.stdin.readline().split())) def LLI(rows_number): return [LI() for _ in range(rows_number)] def LLI1(rows_number): return [LI1() for _ in range(rows_number)] def SI(): return sys.stdin.readline().rstrip() # dij = [(0, 1), (-1, 0), (0, -1), (1, 0)] dij = [(0, 1), (-1, 0), (0, -1), (1, 0), (1, 1), (1, -1), (-1, 1), (-1, -1)] inf = 10**20 # md = 998244353 md = 10**9+7 t="RB" n = II() rr, bb = [], [] for i in range(n): c, x, y = SI().split() y = int(y) if x == "R": rr.append((i, c=="B", y)) else: bb.append((i, c=="B", y)) rr.sort(key=lambda x: (x[2], -x[1])) bb.sort(key=lambda x: (x[2], x[1])) # print(rr, bb) r = b = 0 ri = bi = 0 ans = [] for _ in range(n): if ri < len(rr) and r == rr[ri][2] and bi < len(bb) and b == bb[bi][2]: if rr[ri][1] == False: ans.append(rr[ri][0]+1) ri += 1 r += 1 else: ans.append(bb[bi][0]+1) if bb[bi][1] == False: r += 1 else: b += 1 bi += 1 elif ri < len(rr) and r == rr[ri][2]: ans.append(rr[ri][0]+1) if rr[ri][1]==False:r+=1 else:b+=1 ri += 1 elif bi < len(bb) and b == bb[bi][2]: ans.append(bb[bi][0]+1) if bb[bi][1]==False:r+=1 else:b+=1 bi += 1 else: print("No") exit() print("Yes") print(*ans)