import core.thread; import std.conv, std.stdio, std.string; import std.algorithm, std.array, std.bigint, std.container, std.math, std.range, std.regex; // Input class EOFException : Throwable { this() { super("EOF"); } } string[] tokens; string readToken() { for (; tokens.empty; ) { tokens = readln.split; if (tokens.empty && stdin.eof) throw new EOFException; } auto token = tokens[0]; tokens.popFront; return token; } int readInt() { return to!int(readToken); } long readLong() { return to!long(readToken); } real readReal() { return to!real(readToken); } // chmin/chmax void chmin(T)(ref T t, in T f) { if (t > f) t = f; } void chmax(T)(ref T t, in T f) { if (t < f) t = f; } // Pair struct Pair(S, T) { S x; T y; int opCmp( const Pair p) const { return (x < p.x) ? -1 : (x > p.x) ? +1 : (y < p.y) ? -1 : (y > p.y) ? +1 : 0; } int opCmp(ref const Pair p) const { return (x < p.x) ? -1 : (x > p.x) ? +1 : (y < p.y) ? -1 : (y > p.y) ? +1 : 0; } string toString() const { return "(" ~ to!string(x) ~ ", " ~ to!string(y) ~ ")"; } } auto pair(S, T)(inout(S) x, inout(T) y) { return Pair!(S, T)(x, y); } // Array int binarySearch(T)(in T[] as, in bool delegate(T) test) { int low = -1, upp = as.length; for (; low + 1 < upp; ) { int mid = (low + upp) >> 1; (test(as[mid]) ? low : upp) = mid; } return upp; } int lowerBound(T)(in T[] as, in T val) { return as.binarySearch((T a) { return (a < val); }); } int upperBound(T)(in T[] as, in T val) { return as.binarySearch((T a) { return (a <= val); }); } T[] unique(T)(in T[] as) { T[] bs; foreach (a; as) if (bs.empty || bs[$ - 1] != a) bs ~= a; return bs; } int M, N; string[] A; bool solve() { foreach (rot; 0 .. 4) { int xMin = int.max, yMin = int.max; int xMax = int.min, yMax = int.min; int cnt; foreach (x; 0 .. M) foreach (y; 0 .. N) if (A[x][y] == '.') { chmin(xMin, x); chmin(yMin, y); chmax(xMax, x); chmax(yMax, y); ++cnt; } debug{ writeln(xMin," ",xMax," ",yMin," ",yMax); } if (xMin == xMax || yMin == yMax) { return false; } if (cnt != 2 * ((xMax - xMin) + (yMax - yMin))) { return false; } { bool ok = true; foreach (x; xMin .. xMax + 1) { ok = ok && (A[x][yMin] == '.'); ok = ok && (A[x][yMax] == '.'); } foreach (y; yMin .. yMax + 1) { ok = ok && (A[xMin][y] == '.'); ok = ok && (A[xMax][y] == '.'); } if (ok) { return true; } } foreach (sx; xMin + 1 .. xMax) foreach (sy; yMin + 1 .. yMax) { bool ok = true; foreach (y; yMin .. sy + 1) { ok = ok && (A[sx][y] == '.'); } foreach (x; sx .. xMax + 1) { ok = ok && (A[x][yMin] == '.'); } foreach (y; yMin .. yMax + 1) { ok = ok && (A[xMax][y] == '.'); } foreach (x; xMin .. xMax + 1) { ok = ok && (A[x][yMax] == '.'); } foreach (y; sy .. yMax + 1) { ok = ok && (A[xMin][y] == '.'); } foreach (x; xMin .. sx + 1) { ok = ok && (A[x][sy] == '.'); } if (ok) { return true; } } auto AA = A.dup; swap(M, N); A = new string[M]; foreach (x; 0 .. M) foreach (y; 0 .. N) { A[x] ~= AA[N - 1 - y][x]; } } return false; } void main(string[] args) { try { for (; ; ) { M = readInt; N = readInt; A = new string[M]; foreach (x; 0 .. M) { A[x] = readToken; } const ans = solve; writeln(ans ? "YES" : "NO"); } } catch (EOFException) {} }