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)