#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

use std::collections::BTreeMap;

fn rec(n: usize, b: usize, v: &mut Vec<usize>) {
    if b == 0 {
        let mut ok = true;
        for i in 0..n - 1 {
            let t = v[i] ^ v[i + 1];
            if t.count_ones() != 1 {
                ok = false;
                break;
            }
        }

        if ok {
            if (v[0] ^ v[v.len() - 1]).count_ones() != 1 {
                // dbg!(&v);
                println!(
                    "{}: {} {}",
                    (v[0] ^ v[v.len() - 1]).count_ones(),
                    v[0],
                    v.last().unwrap()
                );
            }
        }

        return;
    }

    for i in 0..n {
        if b & (1 << i) == 0 {
            continue;
        }

        if v.len() > 0 {
            if (v.last().unwrap() ^ i).count_ones() != 1 {
                continue;
            }
        }

        v.push(i);
        rec(n, b & !(1 << i), v);
        v.pop();
    }
}

fn main() {
    if false {
        let n = 32;
        let mut v = vec![];
        rec(n, (1 << n) - 1, &mut v);
        return;
    }

    input! {
        n: usize,
        a: usize,
        b: usize,
    }

    let diffbits = (a ^ b).count_ones();

    if diffbits % 2 == 0 {
        println!("NO");
        return;
    }

    // make gray code 0...0 to 1..10..0
    let mut v = vec![];
    v.push(0);
    v.push(1);
    let mut prev = 1_usize;
    for i in 1..n {
        let from = prev;
        let mut to = from;
        let inc = to.count_ones() < i as u32 && to.count_ones() < diffbits as u32;

        for j in 0..i {
            if inc {
                if to & (1 << j) == 0 {
                    to |= 1 << j;
                    break;
                }
            } else {
                if to & (1 << j) != 0 {
                    to &= !(1 << j);
                    break;
                }
            }
        }

        // dbg!((i, from, to, inc));

        let g = gen_gray(i, from, to);

        for x in g {
            v.push(x | (1 << i));
        }

        prev = to | (1 << i);
    }

    check(&v);

    // dbg!(&v);

    let bb = b ^ a;
    let mut perm = vec![];
    for i in 0..n {
        perm.push((bb & (1 << i), i));
    }

    perm.sort();
    // perm.reverse();
    // dbg!(&perm);

    let mut w = vec![];

    println!("YES");
    for k in 0..v.len() {
        if k > 0 {
            print!(" ");
        }
        let mut t = 0;
        let c = v[k];

        for i in 0..n {
            t |= ((c >> i) & 1) << perm[i].1;
        }
        t ^= a;

        w.push(t);

        print!("{}", t);
    }
    println!();

    check(&w);
}

fn check(v: &Vec<usize>) {
    for i in 1..v.len() {
        assert!((v[i - 1] ^ v[i]).count_ones() == 1);
    }
    // println!("OK");
}

fn gen_gray(n: usize, a: usize, b: usize) -> Vec<usize> {
    // dbg!((n, a, b));

    let mut gray = vec![0; 1 << n];
    let mut v = vec![];

    for i in 0..gray.len() {
        gray[i] = i ^ (i >> 1);
    }

    let mut mm = BTreeMap::<(usize, usize), usize>::new();

    for i in 0..gray.len() {
        mm.insert((gray[i], gray[(i + 1) % gray.len()]), i);
    }

    let mut pos = None;

    for i in 0..n {
        for j in i..n {
            let aa = bswap(a, i, j);
            let bb = bswap(b, i, j);

            if let Some(p) = mm.get(&(aa, bb)) {
                pos = Some((false, p, i, j));
            } else if let Some(p) = mm.get(&(bb, aa)) {
                pos = Some((true, p, i, j));
            }
        }
    }

    let (dir, pos, i, j) = pos.unwrap();

    for k in 0..gray.len() {
        v.push(if !dir {
            bswap(gray[(gray.len() + pos - k) % gray.len()], i, j)
        } else {
            bswap(gray[(pos + 1 + k) % gray.len()], i, j)
        });
    }

    v
}

fn bswap(a: usize, i: usize, j: usize) -> usize {
    (a & !(1 << i) & !(1 << j)) | ((a >> i) & 1) << j | ((a >> j) & 1) << i
}


Measured memory_bytes: 13968