s = Array.new(3) { read_line.chars } puts 3.times.all? { |i| 3.times.all? { |j| (s[i][j] == s[0][0]) == ((i + j) % 2 == 0) } } ? "Yes" : "No"