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
#include <stdio.h>

int n;
char rez[4];
int x;

int main() {
    scanf("%d", &n);
    int first_ten = 0;
    int second_ten = 0;
    for(int i=0; i<n; i++) {
        scanf("%s %d", rez, &x);
        if(rez[0]=='T') {
            if (first_ten < 10) {
                if (first_ten==0) {
                    printf("%d", i+1);
                } else {
                    printf(" %d", i+1);
                }
                first_ten++;
            } else if (second_ten < 10 && x <2) {
                printf(" %d", i+1);
                second_ten++;
            }
        }
    }
    return 0;
}