#include <bits/stdc++.h>
using namespace std;
bool check(long long n) {
  stack<long long> st;
  while (n != 0) {
    int h = n % 10;
    if (!(h == 0 || h == 1)) {
      return false;
    }
    n /= 10;
  }
  return true;
}
bool check(char c) {
  if (c == 'A' || c == 'a')
    return true;
  else if (c == 'E' || c == 'e')
    return true;
  else if (c == 'O' || c == 'o')
    return true;
  else if (c == 'I' || c == 'i')
    return true;
  else if (c == 'U' || c == 'u')
    return true;
  else if (c == 'Y' || c == 'y')
    return true;
  return false;
}
bool check(string a) {
  for (int i = 0; i < a.length() - 1; i++) {
    if (a[i] == a[i + 1]) {
      return false;
    }
  }
  return true;
}
int coso(int a) {
  int max = 0;
  while (a != 0) {
    int h = a % 10;
    if (max < h) max = h;
    a /= 10;
  }
  return max;
}
int main() {
  char a[100][100];
  for (int i = 1; i <= 3; i++) {
    for (int j = 1; j <= 3; j++) {
      cin >> a[i][j];
    }
  }
  for (int i = 1; i <= 3; i++) {
    int dem = 0;
    for (int j = 1; j <= 3; j++) {
      if (a[i][j] == a[j + 2][i + 2] && a[i + 1][j] == a[i + 1][j + 2] &&
          a[i][j + 1] == a[i + 2][j + 1] && a[i][j + 2] == a[i + 2][j]) {
        cout << "YES" << endl;
        return 0;
      }
    }
  }
  cout << "NO" << endl;
}
