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

let [| X; Y |] = readIntArray()

let group x =
  let g1: Set<int> = Set.ofList [4; 6; 9; 11]
  if Set.contains (Set.ofList [x]) g1 then 0
  elif g1 = 2 then 1
  else 2
  
printfn "%s" <| if (group X) = (group Y) then "Yes" else "No"
  