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
67
68
69
70
71
72
73
#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define pb push_back
#define F first
#define S second
#define pii pair<int,int>
#define vi vector<int>
#define vpii vector<pii>

#define loop(i,n) sloop(0,i,n)
#define sloop(s, i, n) for(ll i=(s);i<(n);i++)
#define rloop(i,n) rsloop(0,i,n)
#define rsloop(s,i,n) for(ll i=(n);i-->(s);)

#define all(v) (v).begin(),(v).end()

#ifdef DEBUG
#define DBG cout << __LINE__ << endl;
#else 
#define DBG
#endif 

//int xses[8] = {-1,1,0,0,-1,1,1,-1};
//int yses[8] = {0,0,-1,1,-1,1,-1,1};

#define int ll

void solve()
{
	int n;
	cin >> n;

	vector<pair<bool,int>> v(n);
	string s;
	loop(i,n){cin >> s;if(s=="TAK")v[i].F =1;else v[i].F=0;cin >> v[i].S;}

	int cnt=0;
	int i=0;
	for(;i<n;i++)
	{
		if(cnt==10)break;
		if(v[i].F==0)continue;
		cout << i+1 << ' ';
		cnt++;
	}
	
	for(;i<n;i++)
	{
		if(cnt==20)break;
		if(v[i].F==0||v[i].S>=2)continue;
		cout << i+1 << ' ';
		cnt++;
	}


}

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

	int t=1;

	//cin >> t;

	while(t--)
		solve();

	return 0;
}