def copy(o)
  Marshal.load(Marshal.dump(o))
end

def dfs(edge, u)
  sink = edge.size - 1
  return true if u == sink
  @visited
  return false if @visited[u]
  @visited[u] = true
  edge.size.times do |v|
    next if @visited[v]
    next unless edge[u][v]
    edge[u][v], edge[v][u] = edge[v][u], edge[u][v]
    return true if dfs(edge, v)
    edge[u][v], edge[v][u] = edge[v][u], edge[u][v]
  end
  return false
end

def matching(edge, n)
  result = 0
  source = edge.size - 2
  init_visited = Array.new(edge.size)
  (n...((edge.size - 2) / 2)).each do |i| init_visited[i] = true end
  (((edge.size - 2) / 2 + n)...(edge.size - 2)).each do |i| init_visited[i] = true end
  @visited = copy(init_visited)
  while dfs(edge, source)
    @visited = copy(init_visited)
    result += 1 
  end
  result
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}

  edge = Array.new(2 * n + 2){Array.new(2 * n + 2)}
  n.times do |u|
    edge[u][2 * n + 1] = true
    n.times do |v|
      edge[n + v][u] = true if a[u] <= b[v]
    end
  end
  (n...(2 * n)).each do |v| edge[2 * n][v] = true end

  answer = (1..n).find{|i| matching(copy(edge), i) < (i + 1) / 2}
  puts answer ? answer : "NA"
end