1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
n = int(input())
studentList = []
for i in range(n):
    d = input().split(" ")
    yesOrNo = d[0]
    howManyTimes = d[1]
    studentList.append((yesOrNo, int(howManyTimes)))
a = 0
for i in range(n):
    if (a < 10 and studentList[i][0] == 'TAK') or (a < 20 and studentList[i][0] == 'TAK' and studentList[i][1] < 2):
        print(i+1, end=" ")
        a += 1