n = int(input()) rs = [] bs = [] for i in range(1, n + 1): c, x, y = input().split() y = int(y) if x == 'R': rs.append((i, c, y)) else: bs.append((i, c, y)) rs.sort(key=lambda p: 2 * p[2] + (p[1] == 'R')) bs.sort(key=lambda p: 2 * p[2] + (p[1] == 'B')) ans = [] rcnt = bcnt = 0 j = 0 for i, c, y in rs: while j < len(bs) and bcnt == bs[j][2] and not rcnt + (bs[j][1] == 'R') > y: ans.append(bs[j][0]) if bs[j][1] == 'R': rcnt += 1 else: bcnt += 1 j += 1 if rcnt != y: print('No') exit() ans.append(i) if c == 'R': rcnt += 1 else: bcnt += 1 while j < len(bs) and bcnt == bs[j][2]: ans.append(bs[j][0]) if bs[j][1] == 'R': rcnt += 1 else: bcnt += 1 j += 1 if not j == len(bs): print('No') exit() print('Yes') print(*ans)