#include <bits/stdc++.h>
using namespace std;
int startX, startY, endX, endY;
char piece[550][550], pieceright[550][550], piecedown[550][550];
bool RemoveTop() {
  for (int j = startY; j <= endY; j++)
    if (piece[startX][j] != '.') return false;
  startX++;
  return true;
}
bool RemoveBottom() {
  for (int j = startY; j <= endY; j++)
    if (piece[endX][j] != '.') return false;
  endX--;
  return true;
}
bool RemoveLeft() {
  for (int i = startX; i <= endX; i++)
    if (piece[i][startY] != '.') return false;
  startY++;
  return true;
}
bool RemoveRight() {
  for (int i = startX; i <= endX; i++)
    if (piece[i][endY] != '.') return false;
  endY--;
  return true;
}
int main() {
  cin >> endX >> endY;
  startX = 1;
  startY = 1;
  for (int i = startX; i <= endX; i++)
    for (int j = startY; j <= endY; j++) cin >> piece[i][j];
  while (RemoveTop())
    ;
  while (RemoveBottom())
    ;
  while (RemoveLeft())
    ;
  while (RemoveRight())
    ;
  int width = endY - startY + 1;
  int height = endX - startX + 1;
  for (int i = 1, k = startX; i <= height; i++, k++)
    for (int j = 1, l = startY; j <= width; j++, l++) piece[i][j] = piece[k][l];
  {
    int poz = 0;
    for (int j = width; j >= 1; j--)
      if (piece[1][j] != '.') {
        poz = j + 1;
        break;
      }
    for (int i = 1; i <= height; i++)
      for (int j = 1, k = poz; j <= width; j++, k++)
        pieceright[i][k] = piece[i][j];
    int reEnd = poz + width - 1;
    for (int i = 1; i <= height; i++)
      for (int j = 1; j <= reEnd; j++) {
        if (piece[i][j] == 'x' && pieceright[i][j] == 'x') goto MAYBE;
        if ((piece[i][j] == '.' || piece[i][j] == 0) &&
            (pieceright[i][j] == '.' || pieceright[i][j] == 0))
          goto MAYBE;
      }
    goto YEP;
  }
MAYBE : {
  int poz = 0;
  for (int i = height; i >= 1; i--)
    if (piece[i][1] != '.') {
      poz = i + 1;
      break;
    }
  for (int i = 1, k = poz; i <= height; i++, k++)
    for (int j = 1; j <= width; j++) piecedown[k][j] = piece[i][j];
  int reEnd = poz + height - 1;
  for (int i = 1; i <= reEnd; i++)
    for (int j = 1; j <= width; j++) {
      if (piece[i][j] == 'x' && piecedown[i][j] == 'x') goto NO;
      if ((piece[i][j] == '.' || piece[i][j] == 0) &&
          (piecedown[i][j] == '.' || piecedown[i][j] == 0))
        goto NO;
    }
  goto YEP;
}
NO:
  cout << "NO";
  return 0;
YEP:
  cout << "YES";
  return 0;
}
