let readString() = stdin.ReadLine()
let readStringArray() = stdin.ReadLine().Split(' ');
let readInt() = readString() |> int
let readIntArray() = readStringArray() |> Array.map (fun x -> int x)

let x, y = readIntArray() |> fun x -> (x.[0], x.[1])


let rec same x y list= 
    match list with 
    | h :: t -> if (List.contains x h) && (List.contains y h) then true else same x y t
    | _ -> false

if same x y [[1; 3; 5; 7; 8; 10; 12]; [4; 6; 9; 11]; [2;]] then 
    "Yes"
else 
    "No"
|> printfn "%s"