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
#pragma GCC optimize ("Ofast")
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define FOR(i, a, b) for (auto i=(a); i<(b); i++)
#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(), (x).end()
#ifdef DEBUG
#include "debug.h"
#else
#define dbg(...) 0
#endif

void solve()
{
	int n, cnt = 0;
	std::cin >> n;

	FOR(i, 1, n+1)
	{
		std::string elig;
		int finals;
		std::cin >> elig >> finals;

		if (cnt < 20 and elig == "TAK" and (cnt < 10 or finals < 2))
			std::cout << i << " ", ++cnt;
	}
	std::cout << std::endl;

}

int main()
{
	std::ios_base::sync_with_stdio(false);

	int t = 1;
//	std::cin >> t;	
	FOR(tid, 1, t+1)
		solve();
	return 0;
}