solver::Int->Int->String
solver x y = let (x_c,y_c) = (classify x,classify y) in
            if x_c == y_c then "Yes" else "No"

data Sets = Aset | Bset | Cset deriving (Eq,Show)

classify::Int->Sets
classify x
    | elem x [1,3,5,7,8,10,12] = Aset
    | elem x [4,6,9,11] = Bset
    | elem x [2] = Cset

main::IO()
main =do
  xyc<-getLine
  let x:y:[]=map read (words xyc)
  putStr (solver x y)
  putStr "\n"
