#include <bits/stdc++.h>
using namespace std;
int main() {
  int i, n, up1 = 0, up2 = 0, l = 0, r = 0, j;
  char in[5][5], c;
  for (i = 1; i <= 3; i++) {
    scanf(" ", &c);
    for (j = 1; j <= 3; j++) {
      scanf("%c", &in[i][j]);
    }
  }
  for (i = 1; i <= 3; i++) {
    if (in[1][i] != '.') {
      if (i % 2 == 0)
        up1 += 3;
      else
        up1++;
    }
    if (in[3][i] != '.') {
      if (i % 2 == 0)
        up2 += 3;
      else
        up2++;
    }
  }
  if (in[1][2] != '.') l = 3;
  if (in[3][2] != '.') r = 3;
  if (up1 == up2) {
    if (in[2][1] == in[2][3])
      printf("YES");
    else
      printf("NO");
  } else
    printf("NO");
}
