#include<iostream>
#include<cstdio>
#include<cstring>
#include<cassert>
#include<climits>
#include<vector>
#include<algorithm>
#include<deque>
#include<map>
#include<set>
#include<queue>

#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define IINF INT_MAX
#define ALL(x) x.begin(),x.end()

using namespace std;

typedef long long ll;

const string YES = "Yes";
const string NO  = "No";

const int dx[] = {0,1,0,-1};
const int dy[] = {1,0,-1,0};

const bool debug = false;

int N,M;
vector<string> maze[1010];

vector<string> rotate90(vector<string>& piece){
  vector<string> ret;
  int h = piece[0].size(), w = piece.size();
  ret.resize(h);
  for(int i=0;i<h;i++)ret[i].resize(w);
  for(int y=0;y<(int)ret.size();y++){
    for(int x=0;x<(int)ret[0].size();x++){
      ret[y][x] = piece[ret[0].size()-1-x][y];
    }
  }
  return ret;
}

struct Data {
  vector<int> connection, sp_info;
  bool operator < ( const Data &data ) const {
    if( connection != data.connection ) return connection < data.connection;
    return sp_info < data.sp_info;
  }
};

int find(int x,vector<int> &par) {
  if( x == par[x] ) return x;
  return par[x] = find(par[x],par);
}

void unit(int x,int y,vector<int> &par) {
  x = find(x,par), y = find(y,par);
  if( x != y ) par[x] = y;
}

inline bool isValid(int x,int y) { return 0 <= x && x < N && 0 <= y && y < N; }

void compute() {
  // deque<Data> deq;
  set<Data> dp[2];
  // -- initialize -- BEGIN
  rep(i,4) {

    if( debug ) {
      puts("");
      cout << "INITIAL MAZE --" << endl;
      rep(j,N) cout << maze[0][j] << endl;
    }

    vector<int> connection(N,-1); 
    vector<int> sp_info(N,0); 
    vector<int> par(N*N);
    vector<string> &cmaze = maze[0];
    
    rep(j,(int)par.size()) par[j] = j;
    rep(y,N) rep(x,N) if( cmaze[y][x]  == '.') {
      rep(j,4) {
	int nx = x + dx[j], ny = y + dy[j];
	if( !isValid(nx,ny) ) continue;
	if( cmaze[ny][nx] == '.' ) unit(x+y*N,nx+ny*N,par);
      }
    }

    set<int> mp;
    rep(y,N) if( maze[0][y][0] == '.' ) mp.insert(find(y*N,par));
    rep(y,N) if( maze[0][y][N-1] == '.' ) {
      sp_info[y] = mp.count(find(N-1+y*N,par));
      connection[y] = find(N-1+y*N,par);
    }

    if( debug ) {
      puts("");
      cout << "INITIAL connection --" << endl;
      rep(j,(int)connection.size()) {
	cout << "ID : " << j << ", (" << maze[0][j][N-1] << ") : connection -> " << connection[j] << ", sp_info -> " << sp_info[j] << endl;
      }
      puts("");
    }

    dp[0].insert((Data){connection,sp_info});
    maze[0] = rotate90(maze[0]);

  }
  // -- initialize -- END
  
  REP(i,1,M) {
    vector<string> &cmaze = maze[i];
    int cur = i & 1;
    int pre = ( i - 1 ) & 1;
    dp[cur].clear();
    rep(_,4) {

      vector<int> par(N*(N+1));
      rep(j,N*(N+1)) par[j] = j;

      rep(y,N) rep(x,N) if( cmaze[y][x]  == '.') {
	rep(j,4) {
	  int nx = x + dx[j], ny = y + dy[j];
	  if( !isValid(nx,ny) ) continue;
	  if( cmaze[ny][nx] == '.' ) unit(1+x+y*(N+1),1+nx+ny*(N+1),par);
	}
      }      

      for(auto data : dp[pre]) {
	vector<int> npar = par;
	map<int,int> trans;
	rep(y,N) if( data.connection[y] != -1 ) {
	  if( !trans.count(data.connection[y]) ) trans[data.connection[y]] = y * (N+1);
	  npar[y*(N+1)] = trans[data.connection[y]];
	}

	rep(y,N) if( data.connection[y] != -1 && cmaze[y][0] == '.' ) {
	  unit(y*(N+1),1+y*(N+1),npar);
	}
	
	vector<int> connection(N,-1);
	vector<int> sp_info(N,0);

	set<int> mp;
	rep(y,N) if( data.sp_info[y] ) mp.insert(find(y*(N+1),npar));
	rep(y,N) if( cmaze[y][N-1] == '.' ) {
	  sp_info[y] = mp.count(find(N+y*(N+1),npar));
	  connection[y] = find(N+y*(N+1),npar);
	}

	dp[cur].insert((Data){connection,sp_info});
	
      }
      
      cmaze = rotate90(cmaze);
      
    }

  }

  for(auto data : dp[(M-1)&1]) {
    vector<int> &sp_info = data.sp_info;
    rep(i,N) if( sp_info[i] ) { puts(YES.c_str()); return; }
  }
  puts(NO.c_str());
}

int main() {
  while( cin >> N >> M, N|M ) {
    rep(i,M) {
      maze[i].resize(N);
      rep(j,N) cin >> maze[i][j];
    }
    compute();
  }
  return 0;
}

Measured memory_bytes: 4108