#include<bits/stdc++.h>

using namespace std;

int main()
{
  while(1){
    int n;
    cin>>n;
    if(n == 0){
      break;
    }

    vector<int,int> data;
    for(int i = 0;i < n;++i){
      int num,sa,ko;
      cin>>num;
      cin>>sa;
      cin>>ko;

      data.push_back(make_pair(num,sa * ko));
    }

    for(pair<int,int> e : data){
      if(e.second >= 1000000){
        cout<<e.first<<endl;
      }
    }
  }

  return 0;
}
