#include <iostream>
#include <cstdio>
#include <algorithm>
#include <map>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
#define FOR(i,a,b) for(int i=(a);i<(int)(b);i++)
#define rep(i,n) FOR(i,0,n)
#define ALL(x) (x).begin(),(x).end()
#define pb push_back
#define vint vector<int>


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

        bool f = false;
        rep(i,n) {
            ll a,b,c; cin>>a>>b>>c;
            if(b*c >= (ll)1e6){
                cout<<a<<endl;
                f = true;
            }
        }
        if(!f) cout<<"NA"<<endl;
    }

    return 0;
}