#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int arr[n][n];
  char c;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      cin >> c;
      arr[i][j] = (c == 'x' ? 1 : 0);
    }
  }
  bool b = 1;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      int ctr = 0;
      if (j - 1 >= 0) ctr += (arr[i][j - 1] == 0 ? 1 : 0);
      if (j + 1 < n) ctr += (arr[i][j + 1] == 0 ? 1 : 0);
      if (i - 1 >= 0) ctr += (arr[i - 1][j] == 0 ? 1 : 0);
      if (i + 1 < n) ctr += (arr[i + 1][j] == 0 ? 1 : 0);
      if (ctr % 2) b = 0;
    }
  }
  cout << (b ? "YES" : "NO");
  return 0;
}
