#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  int id, t, s;
  while (1) {
    int max = -100;
    int maxer = 0;
    int a[5000];
    int b[5000];
    a[5000] = 0;
    b[5000] = 0;
    cin >> n;
    if (n == 0) break;
    for (int i = 0; i < n; i++) {
      cin >> a[i] >> t >> s;
      b[i] = t * s;
    }
    for (int i = 0; i < n; i++) {
      if (max <= b[i]) {
        max = b[i];
      }
    }
    for (int i = 0; i < n; i++) {
      if (max == b[i] && max >= 1000000) {
        cout << a[i] << endl;
      }
    }
    if (max < 1000000) {
      cout << "NA" << endl;
    }
  }
  return 0;
}
