fun main(args: Array<String>) {
    val (x, y) = readLine()!!.split(" ").map(String::toInt)
    if (x.groupId() == y.groupId()) {
        println("Yes")
    } else {
        println("No")
    }
}

fun Int.groupId() = when (this) {
    1, 3, 5, 7, 8, 10, 12 -> 1
    4, 6, 9, 11 -> 2
    2 -> 3
    else -> null
}
