get_number(Number) :-
    get_string(String),
    number_string(Number, String).

get_string(String) :-
    current_input(Input),
    read_string(Input, ' \n', '', _, String).

/* memo
    string_code(1, S, C),
*/

main:-
    get_string(S),
    string_code(3, S, C3),
    string_code(4, S, C4),
    string_code(5, S, C5),
    string_code(6, S, C6),
    (C3 =:= C4 , C5 =:= C6) -> writeln("Yes") ; writeln("No").
