n,a,b = gets.split.map(&:to_i)
dif = Array.new(17,0)
for i in 0..16
  if a[i] < b[i]
    dif[i] = 1
  elsif a[i] > b[i]
    dif[i] = -1
  end
end
if ((dif.count(1)+dif.count(-1)) % 2) == 0 || dif.count(1)+dif.count(-1) > 2**n-1
  puts "NO"
  exit
end
puts "YES"
print "#{a} "
check = 1
inst = a
for i in 1..2**n-2
  if check == 0
    if inst % 2 == 0
      inst += 1
    else
      inst -= 1
    end
    print "#{inst} "
  else
    for j in 0..16
      if dif[j] == 1
        dif[j] = 0
        inst += 2**j
        print "#{inst} "
        if dif.count(1) == 0
          check = 0
        end
        break
      elsif dif[j] == -1
        dif[j] = 0
        inst -= 2**j
        print "#{inst} "
        if dif.count(1) == 0
          check = 0
        end
        break
      end
    end
  end
end
puts "#{b}"
