1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include <iostream>
#include <iomanip>
#include <string>
using namespace std;

int main() {
    ios_base::sync_with_stdio(0);
    
    int participants = 0;
    int index = 0;
    string s;
    int x;
    cin>>x; // ignore count
    while (participants < 10) {
        ++index;
        cin >> s >> x;
        if (s == "TAK") {
            ++participants;
            cout << index << " ";
        }
    }
    while (participants < 20) {
        ++index;
        cin >> s >> x;
        if (s == "TAK" && x < 2) {
            ++participants;
            cout << index << " ";
        }
    }

    return 0;
}