n,a,b = gets.split.map(&:to_i)

def rec(n,a,b)
    return [a,b] if n == 1
    x = 0
    n.times do |i|
        if (a[i]^b[i]) == 1
            x = i
            break
        end
    end
    p = 0
    x.times do |i|
        p |= 1<<i
    end
    q = 0
    for i in x+1..n-1
        q |= 1<<i
    end
    c = ((a&p)|((a&q)>>1))
    d = ((b&p)|((b&q)>>1))
    u = rec(n-1,c,c^1)
    v = rec(n-1,c^1,d)
    q >>= 1
    y = a[x]
    (1<<(n-1)).times do |i|
        u[i] = (u[i]&p)|((u[i]&q)<<1)|(y<<x)
        v[i] = (v[i]&p)|((v[i]&q)<<1)|((y^1)<<x)
    end
    return u+v
end
x = 0
n.times do |i|
    x ^= a[i]^b[i]
end
if x == 0
    puts "NO"
else
    puts "YES"
    puts rec(n,a,b).join(" ")
end