#include <iostream>
#include <vector>

using namespace std;

int n;
long long id[4000];
long long value[4000];
long long count[4000];

int main(){
    cin >> n;
    for(int i=0;i<n;i++){
        cin >> id[i] >> value[i] >> count[i] >> endl;
    }
    vector<long long> v;
    for(int i=0;i<n;i++){
        if(value[i]*count[i] >= 1000000 ){
            v.append(id[i]);
        }
    }
    for (vector<long long>::iterator it=v.begin();it!=v.end();++it){
        count << *it << endl;
    }
}