import java.util.Scanner
object Main {
  def main(args:Array[String]) = {
    val sc = new java.util.Scanner(System.in)
    val S = sc.nextInt //最初の整数が読み込まれる

    val sumOfChecks = check_two_strings(S(2).toString, S(3).toString) + check_two_strings(S(4).toString, S(5).toString)
    println( if(sumOfChecks == 2) "Yes" else "No")

  }
  

    def check_two_strings(x: String, y: String): Int = {
        if( x == y) 1 else 0
    }



}
