1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
n = int(input())
t = 0 
r = []
for i in range(n):
    a, b = input().split()
    c = int(b)
    if a == 'TAK':
        if t < 10 or c < 2:
            r.append(i+1)
            t += 1
        if t == 20:
            break
print(*r)