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
#pragma GCC ("avx")
#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <map>
#include <set>
#include <string>
#include <queue>
#include <utility>
#include <cstdint>
#include <type_traits>
using namespace std;
void imax(int &a, int b){ a=max(a, b); }
void imin(int &a, int b){ a=min(a, b); }
void isort(int &a, int &b){ if (a>b) swap(a, b); } //DBG KIT /*
template <typename T> struct tag:reference_wrapper <T>{ using reference_wrapper <T>::reference_wrapper; };
template <typename T1, typename T2> static inline tag <ostream> operator<<(tag <ostream> os, pair<T1, T2> const& p){ return os.get()<<"{"<<p.first<<", "<<p.second<<"}", os;}
template <typename Other> static inline tag <ostream> operator<<(tag <ostream> os, Other const& o){ os.get()<<o; return os; }
template <typename T> static inline tag <ostream> operator <<(tag <ostream> os, vector <T> const& v){ os.get()<<"["; for (int i=0; i<v.size(); i++) if (i!=v.size()-1) os.get()<<v[i]<<", "; else os.get()<<v[i]; return os.get()<<"]", os; }
template <typename T> static inline tag <ostream> operator <<(tag <ostream> os, set <T> const& s){ vector <T> v; for (auto i: s) v.push_back(i); os.get()<<"["; for (int i=0; i<v.size(); i++) if (i!=v.size()-1) os.get()<<v[i]<<", "; else os.get()<<v[i]; return os.get()<<"]", os; }
#define int long long
int n;
vector<pair<int, int>> vec;
auto main() -> int32_t{
    cin>>n;
    for(int i=1; i<=n; ++i){
        string slowo; int a;
        cin>>slowo>>a;
        if(slowo=="TAK"){
            vec.push_back({i, a});
        }
    }
    for(int i=0; i<10; ++i){
        cout<<vec[i].first<<" ";
    }
    int ile=0;
    for(int i=10; i<n; ++i){
        if(ile==10){
            break;
        }
        if(vec[i].second<2 and ile<10){
            ile++;
            cout<<vec[i].first<<" ";
        }
    }
}