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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<pii> vpii;
typedef vector<string> vs;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef long double ld;
typedef unordered_map<int, int> umii;
typedef vector<pair<ll,ll>> vpll;
typedef tuple<int,int,int> tp;
const ll MOD = 1e9+696969;



void solve()
{
    int n;
    cin >> n;
    
    int qualified=20;
    int places=10;
    for(int i=0; i<n; ++i)
    {
        string state;
        int last;
        cin >> state >> last;

        if(state == "TAK" and qualified > 0)
        {
            if(places>0)
            {   
                places--;
                qualified--;
                cout << i+1 << " ";
            }
            else if(last < 2)
            {
                qualified--;
                cout << i+1 << " ";
            }
            
        }

    
    }

    if(qualified==20)
    cout << -1;
}


int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    solve();
    return 0;
}