program ABC062A
    implicit none
    integer(8)::x,y
    integer(8),dimension(12)::group=(/1,3,1,2,1,2,1,1,2,1,2,1/)
    read(5,*)x,y

    if(group(x)==group(y))then
        print'(A)',"Yes"
    else
        print'(A)',"No"
    end if
end program ABC062A