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
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

// #pragma GCC optimize("Ofast")
// #pragma GCC optimize("unroll-loops")
// #pragma GCC target("avx2,bmi,bmi2,popcnt,lzcnt")

using namespace std;
using namespace __gnu_pbds;

using ll = long long;
using ld = long double;
using ull = unsigned long long;
using pll = pair <ll, ll>;
using pii = pair <int, int>;
using tui = tuple <int, int, int>;

template <typename T>
using prq = priority_queue <T>;

template <typename T>
using pgq = priority_queue <T, vector <T>, greater <T>>;

template <typename T> bool umin(T &a, T b) { return a > b ? a = b, 1 : 0; }
template <typename T> bool umax(T &a, T b) { return a < b ? a = b, 1 : 0; }

inline int solve() {
    int n; cin >> n;
    vector<int> ans;
    for (int i = 0; i < n; ++i) {
        string s; cin >> s;
        int k; cin >> k;
        if (s == "TAK") {
            if (ans.size() < 10) {
                ans.push_back(i + 1);
            } else if (ans.size() < 20 && k < 2) {
                ans.push_back(i + 1);
            }
        }
    }
    for (auto &i : ans) {
        cout << i << " ";
    }
    return 0;
}

inline void precalc() {}

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    int tst = 1;
    // cin >> tst;
    precalc();
    while (tst--) solve();
    return 0;
}