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
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
#include <vector>
#include <map>
#include <string>
#include <cstdio>
#include <iostream>
#include <ostream>
#include <algorithm>
#include <cmath>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef unsigned char ubyte;

constexpr ld EPS = 1e-9;
constexpr ld PI = 3.141592653589793238462643383279502884L;
constexpr int INF = (int)1e9 + 5;
constexpr ll LINF = (ll)1e18 + 5;

bool eq(ld a, ld b) {
  return fabs(a - b) < EPS;
}

template<class T>
T sqr(const T & x) { return x * x; }

template<class T>
ll abs(const T & x) { return x < 0 ? -x : x; }

template<class T>
ll myround(const T & x) { return x < 0 ? x - 0.5 : x + 0.5; }

template<class T>
bool chmin(T & x, const T & y) {
  if (y < x) {
    x = y;
    return true;
  }
  return false;
}

template<class T>
ostream & operator <<(ostream & os, const vector<T> & v) {
  os << "{";
  for (typename vector<T>::const_iterator it = v.begin(); it != v.end(); ++it) {
    os << *it;
    if ((it + 1) != v.end()) os << ", ";
  }
  os << "}";
  return os;
}

template<class P, class Q>
ostream & operator <<(ostream & os, const pair<P, Q> & p) {
  return os << "(" << p.first << ", " << p.second << ")";
}

template<class T>
bool chmax(T & x, const T & y) {
  if (x < y) {
    x = y;
    return true;
  }
  return false;
}

template<class IntegerType = int>
IntegerType nextInt() {
  IntegerType x = 0;
  bool p = false;
  char c;
  do {
    c = getchar();
  } while (c <= 32);
  if (c == '-') {
    p = true;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    x = x * 10 + c - '0';
    c = getchar();
  }
  return (p ? -x : x);
}

string nextToken() {
  static const size_t MAX_LEN = 500500;
  static char str[MAX_LEN];
  scanf("%s", str);
  return str;
}

//template<class... Ts> struct overloaded : Ts... { using Ts::operator()...; };
//template<class... Ts> overloaded(Ts...) -> overloaded<Ts...>;

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

void no_solution()
{
  puts("-1");
  exit(0);
}

void testcase()
{
  int n = nextInt<int>();
  vector<int> positions;
  for ( int i = 0; i < n; i++ )
  {
    string can = nextToken();
    int times = nextInt<int>();
    if ( can == "NIE" )
      continue;
    if ( positions.size() < 10 )
    {
      positions.push_back(i + 1);
      continue;
    }
    bool can2 = times < 2 && positions.size() < 20;
    if ( !can2 )
      continue;
    positions.push_back(i + 1);
  }
  bool was = false;
  for ( int x : positions )
  {
    if ( was )
      printf(" ");
    was = true;
    printf("%d", x);
  }
  puts("");
}

int main() {
#ifdef LOCAL
  freopen("input.txt", "r", stdin);
#endif

  int t = 1;
  while (t--)
    testcase();
}