#include <bits/stdc++.h>
using namespace std;
typedef struct {
  int sum;
  int pr;
} data;
int main(int argc, char **argv) {
  int i, p, q, n, size = 0, flag, pri = 1, max;
  data *sarray = (data *)calloc(4000, sizeof(int));
  int *id = (int *)calloc(1000, sizeof(int));
  while (1) {
    cin >> n;
    if (n == 0) {
      cout << "NA" << endl;
      break;
    }
    while (n > 0) {
      n--;
      cin >> i >> p >> q;
      flag = 0;
      for (int j = 0; j < size; j++) {
        if (id[j] == i) {
          if (p * q > sarray[i].sum || pri != sarray[i].pr) {
            sarray[i].sum = p * q;
            sarray[i].pr = pri;
          }
          flag = 1;
          break;
        }
      }
      if (flag == 0) {
        id[size] = i;
        sarray[i].sum = p * q;
        sarray[i].pr = pri;
        size++;
      }
    }
    max = id[0];
    for (int j = 1; j < size; j++) {
      if (sarray[max].sum < sarray[id[j]].sum) {
        max = id[j];
      }
    }
    cout << max << endl;
    pri++;
  }
  free(sarray);
  return 0;
}
