#include <bits/stdc++.h>
using namespace std;
int main() {
  int num, yen, ko;
  while (1) {
    cin >> num;
    if (!num) break;
    for (; num > 0; num--) {
      cin >> num >> yen >> ko;
      if (yen * ko >= 1000000) cout << num << endl;
    }
  }
  return 0;
}
