#define _USE_MATH_DEFINES #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; typedef unsigned long long ull; typedef pair i_i; typedef pair ll_i; typedef pair d_i; typedef pair ll_ll; typedef pair d_d; struct edge { int u, v; ll w; }; ll MOD = 1000000007; ll _MOD = 1000000009; double EPS = 1e-10; int main() { int N, M; cin >> N >> M; vector A(N); for (int i = 0; i < N; i++) cin >> A[i]; int cnt = 0, l = M, r = 0, u = N, d = 0; for (int i = 0; i < N; i++) for (int j = 0; j < M; j++) if (A[i][j] == '.') { cnt++; l = min(l, j); r = max(r, j + 1); u = min(u, i); d = max(d, i + 1); } if (cnt == (r - l + d - u) * 2 - 4) cout << "YES" << endl; else cout << "NO" << endl; }