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

int main() {
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(NULL);
    int n;
    std::cin >> n;
    std::string word;
    int x;
    int finalists = 0;
    for (int i = 0; i < n; i++) {
        std::cin >> word >> x;
        if (finalists < 20 and word == "TAK" and (finalists < 10 or x < 2)) {
            std::cout << i + 1 << " ";
            finalists++;
        }
    }
}