fun main(args: Array<String>) {
    val line = readLine()!!.trim()
    val chars34: String = line.drop(2).take(2)
    val chars56: String = line.drop(4).take(2)
    val niteru34 = chars34.take(1) == chars34.drop(1).take(1)
    val niteru56 = chars56.take(1) == chars56.drop(1).take(1)

    if (niteru34 && niteru56) {
        println("Yes")
    } else {
        println("No")
    }
}
