#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n, i, j, ans;
  cin >> n;
  char a[n][n];
  for (i = 0; i < n; i++) {
    for (j = 0; j < n; j++) cin >> a[i][j];
  }
  for (i = 0; i < n; i++) {
    ans = 0;
    for (j = 0; j < n; j++) {
      if (i == 0) {
        if (j == 0) {
          if (a[i][j + 1] == 'o') ans++;
          if (a[i + 1][j] == 'o') ans++;
        } else if (j == n - 1) {
          if (a[i][j - 1] == 'o') ans++;
          if (a[i + 1][j] == 'o') ans++;
        } else {
          if (a[i][j + 1] == 'o') ans++;
          if (a[i + 1][j] == 'o') ans++;
          if (a[i][j - 1] == 'o') ans++;
        }
      } else if (i == n - 1) {
        if (j == 0) {
          if (a[i][j + 1] == 'o') ans++;
          if (a[i - 1][j] == 'o') ans++;
        } else if (j == n - 1) {
          if (a[i][j - 1] == 'o') ans++;
          if (a[i - 1][j] == 'o') ans++;
        } else {
          if (a[i][j + 1] == 'o') ans++;
          if (a[i - 1][j] == 'o') ans++;
          if (a[i][j - 1] == 'o') ans++;
        }
      } else if (j == 0) {
        if (a[i + 1][j] == 'o') ans++;
        if (a[i][j + 1] == 'o') ans++;
        if (a[i - 1][j] == 'o') ans++;
      } else if (j == n - 1) {
        if (a[i + 1][j] == 'o') ans++;
        if (a[i][j - 1] == 'o') ans++;
        if (a[i - 1][j] == 'o') ans++;
      } else if (i - 1 > 0 && j + 1 < n) {
        if (a[i][j + 1] == 'o') ans++;
        if (a[i][j - 1] == 'o') ans++;
        if (a[i + 1][j] == 'o') ans++;
        if (a[i - 1][j] == 'o') ans++;
      }
      if (ans % 2 == 1) {
        cout << "NO";
        return 0;
      }
    }
  }
  cout << "YES";
  return 0;
}
