#include <cstdio>
#include <random>
#include <ctime>

using namespace std;

void swap(int& l, int& r)
{
  int tmp = l;
  l = r;
  r = tmp;
}

int insert_at(int pos, int bit, int n)
{
  int mask = ((1<<(pos+1))-1);
  int n_ = (n<<1)^((n<<1)&mask);
  n_ |= bit<<pos;
  n_ |= n&(mask>>1);
  return n_;
}

int remove_at(int pos, int n)
{
  // if (n == 0) return pos >> 1;
  int mask = ((1<<(pos+1))-1);
  int n_ = (n^(n&mask))>>1;
  n_ |= n&(mask>>1);
  return n_;
}

int result[1<<17];
void construct(int pos, int left, int right, int size)
{
  // printf("construct(%d, %d, %d, %d)\n", pos, left, right, size);
  if (size == 1) {
    result[pos] = left;
    result[pos+1] = right;
    return;
  }
  int common = 0;
  int l = left;
  int r = right;
  int left_distinct_ones = 0;
  for (int i = 0; i < size; i++) {
    int c = (l&1)^(r&1)^1;
    common |= c << i;
    if (c != 1) {
      left_distinct_ones += l&1;
    }
    l >>= 1;
    r >>= 1;
  }
  bool swapped = false;
  // printf("left = %d, right = %d\n", left, right);
  if ((left_distinct_ones & 1) == 0) {
    swap(left, right);
    swapped = true;
    // printf("swapped; left = %d, right = %d\n", left, right);
  }
  int d = common;
  // printf("common = %d\n", d);
  int left_distinct = left&(((1<<size)-1)^common);
  // printf("left_distinct = %d\n", left_distinct);
  int left_distinct_lsb = 0;
  while ((left_distinct&1)==0) {
    left_distinct >>= 1;
    left_distinct_lsb++;
  }
  // int left_ = ((left>>1)&(~((1<<(left_distinct_lsb+1))-1)))|(left&((1<<(left_distinct_lsb+1))-1));
  int left_ = remove_at(left_distinct_lsb, left);
  int right_ = remove_at(left_distinct_lsb, right);
  int middle;
  int common_ = remove_at(left_distinct_lsb, common);
  int b = common_;
  // printf("common_ = %d\n", b);
  if (common == 0) {
    middle = left_^right_;
    // diff(middle, left_) = 0 (mod 2)
    // diff(middle, right_) = 0 (mod 2)
    middle &= middle-1;
    // printf("no common\n");
  }
  else {
    middle = left_^right_;
    middle |= left_&common_;
    middle ^= common_^(common_&(common_-1));
  }
  // printf("%d\n", common_^(common_&(common_-1)));
  // printf("left_ = %d, right_ = %d, middle = %d\n", left_, right_, middle);
  if (swapped) {
    construct(pos, right_, middle, size-1);
    construct(pos+(1<<(size-1)), middle, left_, size-1);
    for (int i = pos; i < pos+(1<<(size-1)); i++) {
      result[i] = insert_at(left_distinct_lsb, 0, result[i]);
      result[i+(1<<(size-1))] = insert_at(left_distinct_lsb, 1, result[i+(1<<(size-1))]);
    }
  }
  else {
    construct(pos, left_, middle, size-1);
    construct(pos+(1<<(size-1)), middle, right_, size-1);
    for (int i = pos; i < pos+(1<<(size-1)); i++) {
      result[i] = insert_at(left_distinct_lsb, 1, result[i]);
      result[i+(1<<(size-1))] = insert_at(left_distinct_lsb, 0, result[i+(1<<(size-1))]);
    }
  }
}

int main()
{
  int n, a, b;
  scanf("%d %d %d", &n, &a, &b);
  int distinct = a^b;
  int diff = 0;
  while (distinct) {
    diff += distinct & 1;
    distinct >>= 1;
  }
  if ((diff & 1) == 0) {
    printf("NO\n");
    return 0;
  }
  construct(0, a, b, n);
  printf("YES\n");
  int i;
  for (i = 0; i < (1<<n)-1; i++) {
    printf("%d ", result[i]);
  }
  printf("%d", result[i]);
  return 0;
}


Measured memory_bytes: 1408