#include <bits/stdc++.h>
using namespace std;
char a[3][3];
int main() {
  int ox[4] = {-1, 0, 1, -1}, oy[4] = {-1, -1, -1, 0};
  for (int i = 0; i < 3; i++)
    for (int j = 0; j < 3; j++) cin >> a[i][j];
  for (int z = 0; z < 4; z++) {
    if (a[1 + oy[z]][1 + ox[z]] == a[1 - oy[z]][1 - ox[z]]) continue;
    cout << "NO";
    return 0;
  }
  cout << "YES";
  return 0;
}
