from functools import lru_cache import sys input = sys.stdin.readline sys.setrecursionlimit(10 ** 7) N = int(input()) red_red = [[] for _ in range(N + 1)] red_blue = [[] for _ in range(N + 1)] blue_blue = [[] for _ in range(N + 1)] blue_red = [[] for _ in range(N + 1)] for i in range(1, N+1): c, x, y = input().rstrip().split() y = int(y) if c == "R": if x == "R": red_red[y].append(i) else: red_blue[y].append(i) else: if x == "R": blue_red[y].append(i) else: blue_blue[y].append(i) ans = [] @lru_cache(maxsize=True) def rec(R, B): if R + B == N: return True if red_red[R]: ans.append(red_red[R].pop()) if rec(R + 1, B): return True red_red[R].append(ans.pop()) if red_blue[B]: ans.append(red_blue[B].pop()) if rec(R + 1, B): return True red_blue[B].append(ans.pop()) if blue_red[R]: ans.append(blue_red[R].pop()) if rec(R, B + 1): return True blue_red[R].append(ans.pop()) if blue_blue[B]: ans.append(blue_blue[B].pop()) if rec(R, B + 1): return True blue_blue[B].append(ans.pop()) return False if not rec(0, 0): print("No") else: print("Yes") print(*ans)