#include #include #include using namespace std; using ll = long long; using ld = long double; using pll = array; using vl = vector; template using vec = vector; template using vv = vec>; template using vvv = vv>; template using minpq = priority_queue, greater>; #define all(a) (a).begin(), (a).end() #define rep(i, n) for (ll i = 0; i < (n); ++i) #define reps(i, l, r) for (ll i = (l); i < (r); ++i) #define rrep(i, l, r) for (ll i = (r) - 1; i >= (l); --i) #define sz(x) (ll)(x).size() template bool chmax(T &a, const T &b) { return a < b ? a = b, true : false; } template bool chmin(T &a, const T &b) { return a > b ? a = b, true : false; } const ll INF = 1LL << 60; using ull = unsigned long long; using ulll = __uint128_t; void solve() { // hmm // まあ高さ2だけを考えれば良い // ##### // #...# // .基準に探すか、#基準に探すか? // ?を.にする意味はある? // ###? ←ここはどちらにせよ#にすべきだし、 // #..? ←上が#にできないならここを.にしても意味がない // ただ↓は例外か // ### // #?# とか // .を一つ以上確保しつつ、止まったところで考えるなど // OK 書く ll h, w; cin >> h >> w; vec s(h); rep(i, h) cin >> s[i]; reps(x, 1, h) { reps(y, 1, w-1) { if(s[x][y] == '#') continue; if(s[x][y-1] == '.') continue; if(s[x-1][y] == '.') continue; if(s[x-1][y-1] == '.') continue; ll k = 1; while(y + k < w && s[x][y+k] == '.' && s[x-1][y+k] != '.') k++; if(y + k == w) continue; if(s[x-1][y+k] == '.') continue; cout << "Yes" << endl; return; } } cout << "No" << endl; } int main() { cin.tie(nullptr); ios_base::sync_with_stdio(false); cout << fixed << setprecision(20); int t = 1; cin >> t; while (t--) { solve(); } }