#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <queue>
#include <algorithm>
using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)
int n,m;

vector<vector<string> > s;

class UF {
private:
    int sz; vector<int> par,nrank,size;
public:
    UF(){}
    UF(int node_size){ sz = node_size; par.resize(sz),nrank.resize(sz),size.resize(sz);
        rep(i,sz){ par[i] = i; nrank[i] = 0; size[i] = 1;} }
    int find(int x){ if(par[x] == x){ return x; }else{ return par[x] = find(par[x]); } }
    void unite(int x,int y)
    { x = find(x),y = find(y); if(x == y) return; if(nrank[x] < nrank[y]) swap(x,y);
        par[y] = x; size[x] += size[y]; if(nrank[x] == nrank[y]) nrank[x]++; }
    int query(int x){ x = find(x); return size[x]; }
    bool same(int x,int y){ return find(x) == find(y); }
};


int row(int a){
    return a/n;
}
int col(int a){
    return a%n;
}

int val(int a,int b){
    return a*n+b;
}

vector<set<int> > create(vector<string> &p){
    UF uf(n*n+2);
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            if(p[i][j]=='#'){
                uf.unite(val(i,j),n*n+1);
            }
        }
    }
    for(int i=0;i<n;i++){
        for(int j=0;j<n-1;j++){
            if(p[i][j]=='.'&&p[i][j+1]=='.'){
                uf.unite(val(i,j),val(i,j+1));
            }
        }
    }
    for(int j=0;j<n;j++){
        for(int i=0;i<n-1;i++){
            if(p[i][j]=='.'&&p[i+1][j]=='.'){
                uf.unite(val(i,j),val(i+1,j));
            }
        }
    }
    map<int,set<int> > mp;
    for(int i=0;i<n;i++){
        if(!uf.same(val(i,0),n*n+1)){
            mp[uf.find(val(i,0))].insert(i);
        }
        if(!uf.same(val(i,n-1),n*n+1)){
            mp[uf.find(val(i,n-1))].insert(i+n);
        }
    }
    vector<set<int> > res;
    for(auto x:mp){
        res.push_back(x.second);
    }
    return res;
}

vector<string> rotate(vector<string> &p){
    vector<string> res(n);
    for(int i=n-1;i>=0;i--){
        for(int j=0;j<n;j++){
            res[j].push_back(p[i][j]);
        }
    }
    return res;
}

vector<int>  update(vector<int> &v,vector<set<int> > &st){
    vector<int> res(n,-1);
    int ma = -1;
    for(auto x:v){
        ma = max(ma,x);
    }

    UF uf(2*n+1);
    vector<int>s(n);
    map<int,vector<int> > mp;
    for(int i=0;i<n;i++){
        mp[v[i]].push_back(i);
    }
    for(auto x:mp){
        int tmp =0;
        if(x.first!=-1){
            for(int i=0;i<x.second.size();i++){
                if(i==0){
                    tmp = x.second[i];
                }else{
                    uf.unite(tmp,x.second[i]);
                }
            }
        }
    }
    // for(auto x:st){
    //     for(auto p:x){
    //         cout << p << " ";
    //     }
    //     cout << endl;
    // }
    for(auto x:st){
        bool flag = 1;
        int tmp = 0;
        for(auto p:x){
            if(flag){
                if(p<n){
                    if(v[p]!=-1){
                        tmp = p;
                        flag = 0;
                    }
                }else{
                    tmp = p;
                    flag = 0;
                }
            }else{
                if(p<n){
                    if(v[p]!=-1){
                        uf.unite(tmp,p);
                    }
                }else{
                    uf.unite(tmp,p);
                }
            }
        }
    }
    map<int,int>mi;
    for(int i=0;i<n;i++){
      
            if(v[i]!=-1){
                mi[uf.find(i)] = min(mi[uf.find(i)],v[i]);
            }
    
    }
    // for(int i=0;i<2*n;i++) cout << uf.find(i) <<  " ";
    // cout << endl;
    map<int,int> mp2;
    int cnt = ma  + 1;
    for(int i=n;i<2*n;i++){
        //cout << uf.find(i) << endl;
        if(uf.find(i)<n){
            res[i-n] = mi[uf.find(i)];
        }else{
            if(mp2.find(uf.find(i))==mp2.end()){
                mp2[uf.find(i)] = cnt;
                res[i-n] = cnt;
                cnt++;
            }else{
                res[i-n] = mp2[uf.find(i)];
            }
        }
    }
    vector<int>res2(n);
    map<int,int> tr; 
    int c = 1;
    for(int i=0;i<n;i++){
        if(res[i]==0){
            res[i] = 0;
        }else if(res[i]==-1){
            res2[i] = -1;
        }else if(tr.find(res[i])==tr.end()){
            tr[res[i]] = c;
            res2[i] = c;
            c++;
        }else{
            res2[i] = tr[res[i]];
        }
    }
    // for(auto x:v){
    //     cout << x << " ";
    // }
    // cout << endl;
    // for(auto x:res){
    //     cout << x << " ";
    // }
    // cout << endl;
    return res2;
}


int main(){
    while(cin >> n >> m &&n!=0){
        s.resize(m);
        for(int i=0;i<m;i++){
            s[i].resize(n);
            for(int j=0;j<n;j++){
                cin >> s[i][j];
            }
        }
        vector<int> v(n);
        set<vector<int> > st;
        st.insert(v);
        vector<vector<vector< set<int> > > > reach(m,vector<vector<set<int> > > (4));
        rep(i,m){
            vector<string> a = s[i];
            rep(j,4){
                reach[i][j]=create(a);
                a = rotate(a);
            }
        }
        for(int i=0;i<m;i++){
            set<vector<int> > st2;
            for(auto x:st){
                vector<int> ppp;
                for(int j=0;j<4;j++){
                    ppp = update(x,reach[i][j]);
                    bool insertflag = 0;
                    for(auto u:ppp){
                        if(u==0)insertflag =1;
                    }
                    if(insertflag)st2.insert(ppp);
                   
                    // for(auto y:ppp) cout << y << " ";
                    // cout << endl;
                }
            }
            //cerr << i << " " << st.size() << endl;
            st = st2;
        }
        //cerr << st.size() << endl;
        bool flag = 0;
        for(auto x:st){
            for(auto y:x){
                if(y==0){
                    flag = 1;
                }
            }
        }
        if(flag){
            cout << "Yes" << endl;
        }else{
            cout << "No" << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 7252