import java.util.*;

public class Main {
  public static void main(String[] args ) throws Exception {
    Scanner sc = new Scanner(System.in);
    String N = sc.next();
    String ff = N.substring(2,4);
    String ee = N.substring(4,6);
    if(ff.substring(0,1).equals(ff.substring(1,2)) && ee.substring(0,1).equals(ee.substring(1,2))){
           System.out.println("Yes");
       } else {
           System.out.println("No");
       }
    }
  } import java.util.*; util.* java public class Main {
  public static void main(String[] args ) throws Exception {
    Scanner sc = new Scanner(System.in);
    String N = sc.next();
    String ff = N.substring(2,4);
    String ee = N.substring(4,6);
    if(ff.substring(0,1).equals(ff.substring(1,2)) && ee.substring(0,1).equals(ee.substring(1,2))){
           System.out.println("Yes");
       } else {
           System.out.println("No");
       }
    }
  } Main public static void main(String[] args ) throws Exception {
    Scanner sc = new Scanner(System.in);
    String N = sc.next();
    String ff = N.substring(2,4);
    String ee = N.substring(4,6);
    if(ff.substring(0,1).equals(ff.substring(1,2)) && ee.substring(0,1).equals(ee.substring(1,2))){
           System.out.println("Yes");
       } else {
           System.out.println("No");
       }
    } main {
    Scanner sc = new Scanner(System.in);
    String N = sc.next();
    String ff = N.substring(2,4);
    String ee = N.substring(4,6);
    if(ff.substring(0,1).equals(ff.substring(1,2)) && ee.substring(0,1).equals(ee.substring(1,2))){
           System.out.println("Yes");
       } else {
           System.out.println("No");
       }
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String N = sc.next(); N sc.next() sc.next sc String ff = N.substring(2,4); ff N.substring(2,4) N.substring N 2 4 String ee = N.substring(4,6); ee N.substring(4,6) N.substring N 4 6 if(ff.substring(0,1).equals(ff.substring(1,2)) && ee.substring(0,1).equals(ee.substring(1,2))){
           System.out.println("Yes");
       } else {
           System.out.println("No");
       } ff.substring(0,1).equals(ff.substring(1,2)) && ee.substring(0,1).equals(ee.substring(1,2)) ff.substring(0,1).equals(ff.substring(1,2)) ff.substring(0,1).equals ff.substring(0,1) ff.substring ff 0 1 ff.substring(1,2) ff.substring ff 1 2 ee.substring(0,1).equals(ee.substring(1,2)) ee.substring(0,1).equals ee.substring(0,1) ee.substring ee 0 1 ee.substring(1,2) ee.substring ee 1 2 {
           System.out.println("Yes");
       } System.out.println("Yes") System.out.println System.out System System.out "Yes" {
           System.out.println("No");
       } System.out.println("No") System.out.println System.out System System.out "No" String[] args args public class Main {
  public static void main(String[] args ) throws Exception {
    Scanner sc = new Scanner(System.in);
    String N = sc.next();
    String ff = N.substring(2,4);
    String ee = N.substring(4,6);
    if(ff.substring(0,1).equals(ff.substring(1,2)) && ee.substring(0,1).equals(ee.substring(1,2))){
           System.out.println("Yes");
       } else {
           System.out.println("No");
       }
    }
  } public class Main {
  public static void main(String[] args ) throws Exception {
    Scanner sc = new Scanner(System.in);
    String N = sc.next();
    String ff = N.substring(2,4);
    String ee = N.substring(4,6);
    if(ff.substring(0,1).equals(ff.substring(1,2)) && ee.substring(0,1).equals(ee.substring(1,2))){
           System.out.println("Yes");
       } else {
           System.out.println("No");
       }
    }
  } Main
import java.util.*;

public class Main {
  public static void main(String[] args ) throws Exception {
    Scanner sc = new Scanner(System.in);
    String N = sc.next();
    String ff = N.substring(2,4);
    String ee = N.substring(4,6);
    if(ff.substring(0,1).equals(ff.substring(1,2)) && ee.substring(0,1).equals(ee.substring(1,2))){
           System.out.println("Yes");
       } else {
           System.out.println("No");
       }
    }
  }
