1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
n = int(input())
lf = 0
out = ""
for i in range(1,n+1):
    odp, ns = input().split()
    if lf < 10:
        if odp == "TAK":
            out += " " + str(i)
            lf+= 1
    elif  odp == "TAK" and int(ns) < 2:
        out += " " + str(i)
        lf+= 1
    if lf == 20:
        break
    
print(out[1:])