def check(a, b)
  win = lose = draw = 0
  until b.empty?
    head = b.shift
    if x = a.bsearch{|x| x < head}
      a.delete_at(a.index(x))
      lose += 1
    elsif x = a.bsearch{|x| x == head}
      a.delete_at(a.index(x))
      draw += 1
    else
      win += 1
    end
  end
  win > lose
end

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