a = input()+input()+input() b = '#.#.#.#.#' c = '.#.#.#.#.' if a == b or a == c: print('Yes') else: print('No')