let popcnt x =
  let x = (x land 0x5555555555555555) + ((x lsr 1) land 0x5555555555555555) in
  let x = (x land 0x3333333333333333) + ((x lsr 2) land 0x3333333333333333) in
  let x = (x land 0x0f0f0f0f0f0f0f0f) + ((x lsr 4) land 0x0f0f0f0f0f0f0f0f) in
  let x = (x land 0x00ff00ff00ff00ff) + ((x lsr 8) land 0x00ff00ff00ff00ff) in
  let x = (x land 0x0000ffff0000ffff) + ((x lsr 16) land 0x0000ffff0000ffff) in
  (x land 0x00000000ffffffff) + ((x lsr 32) land 0x00000000ffffffff)

let rec gray_of_binary g = g lxor (g lsr 1)

let rec binary_of_gray b = function
  | 0 -> b
  | g -> binary_of_gray (b lxor g) (g lsr 1)
let binary_of_gray = binary_of_gray 0

let () = Scanf.scanf "%d %d %d" @@ fun n a b ->
  let a' = binary_of_gray a in
  let b' = binary_of_gray b in
  let n' = 1 lsl n in
  if popcnt (a lxor b) <> 1
  then print_endline "NO"
  else begin
    print_endline "YES";
    (* for i = 0 to n' - 1 do
      Printf.printf "%d " @@
      if (a' < b') = (abs (a' - b') = 1)
      then gray_of_binary ((a' + n' - i) mod n')
      else gray_of_binary ((a' + i) mod n')
    done;
    print_newline () *)
  end

