1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
n = int(input())
winners = []
for i in range(n):
    row = input().split(' ')
    s = row[0] == 'TAK'
    x = int(row[1])
    if len(winners) == 20:
        break
    if s:
        if len(winners) < 10 or x < 2:
            winners.append(i + 1)
print(' '.join(str(i) for i in winners))