#include <bits/stdc++.h>
using namespace std;
string s[3];
int main() {
  int ok = 1;
  for (int i = 0; i < (3); ++i) cin >> s[i];
  for (int i = 0; i < (3); ++i)
    for (int j = 0; j < (3); ++j)
      if (s[i][j] == 'X' && s[i + (1 - i) * 2][j + (1 - j) * 2] != 'X') ok = 0;
  cout << (ok ? "YES" : "NO") << endl;
  return 0;
}
