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 abs (a' - b') <> 1 && abs (a' - b') <> n' - 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
