while n = STDIN.gets
  n = n.chomp.to_i
  if n == 0 then break end
  flag=true
  n.times do 
    line = STDIN.gets
    ipq = line.chomp.split(" ").map { |item| item.to_i } 
    if ipq[1]*ipq[2] >= 1000000 then
      puts ipq[0]
      flag=false
    end
  end
  if flag then
    puts "NA"
  end
end