while true
  l = gets.to_i
  if l == 0
    break
  end

  i = 0
  sum = 0
  sm = 0
  c = 0

  while i < 12
    mm = gets.chomp
    mm = mm.split(" ")
    sum += mm[0].to_i - mm[1].to_i
    if c == 0
      if sum >= l
        sm = i + 1
        c = 1
      end
    end
    i += 1
  end
  if c != 0
    puts sm
  else
    puts "NA"
  end
end