def win?(a, b)
  return false if a.size == 0
  n = a.size
  win = draw = lose = 0
  until a.empty?
    head = a.shift
    ok = false
    (0...b.size).to_a.reverse.each do |i|
      next if head >= b[i]
      ok = true
      b.delete_at(i)
      lose += 1
      break
    end
    next if ok
    (0...b.size).each do |i|
      next unless head == b[i]
      b.delete_at(i)
      draw += 1
      break
    end
  end
  win = n - lose - draw
  win > lose
end

until (n = gets.to_i).zero?
  a, b = 2.times.map{gets.split.map(&:to_i).sort{|a, b| b <=> a}}
  answer = (1..n).find{|i| win?(a[0, i], b[0, i])}
  puts answer ? answer : "NA"
end