1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
#include <iostream>

int main()
{
    std::string s;
    int n, x, pos = 1, count = 0;
    std::cin >> n;
    while (count < 20)
    {
        std::cin >> s >> x;
        if (s == "TAK" and (count < 10 or x < 2))
        {
            std::cout << pos << ' ';
            count++;
        }
        pos++;
    }
    std::cout << '\n';
    return 0;
}