#include<bits/stdc++.h>
using namespace std;
using Int = long long;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}


struct Dice{
  int s[6];
  void roll(char c){
    //the view from above
    // N
    //W E
    // S
    //s[0]:top
    //s[1]:south
    //s[2]:east
    //s[3]:west
    //s[4]:north
    //s[5]:bottom
    int b;
    if(c=='E'){
      b=s[0];
      s[0]=s[3];
      s[3]=s[5];
      s[5]=s[2];
      s[2]=b;
    }
    if(c=='W'){
      b=s[0];
      s[0]=s[2];
      s[2]=s[5];
      s[5]=s[3];
      s[3]=b;
    }
    if(c=='N'){
      b=s[0];
      s[0]=s[1];
      s[1]=s[5];
      s[5]=s[4];
      s[4]=b;
    }
    if(c=='S'){
      b=s[0];
      s[0]=s[4];
      s[4]=s[5];
      s[5]=s[1];
      s[1]=b;
    }
    
    // migi neji 
    if(c=='R'){
      b=s[1];
      s[1]=s[2];
      s[2]=s[4];
      s[4]=s[3];
      s[3]=b;
    }
    
    if(c=='L'){
      b=s[1];
      s[1]=s[3];
      s[3]=s[4];
      s[4]=s[2];
      s[2]=b;
    }
    
  }
  int top() {
    return s[0];
  }
  int hash(){
    int res=0;
    for(int i=0;i<6;i++) res=res*256+s[i];
    return res;
  }
};
vector<Dice> makeDices(Dice d){
  vector<Dice> res;
  for(int i=0;i<6;i++){
    Dice t(d);
    if(i==1) t.roll('N'); 
    if(i==2) t.roll('S'); 
    if(i==3) t.roll('S'),t.roll('S');
    if(i==4) t.roll('L'); 
    if(i==5) t.roll('R'); 
    for(int k=0;k<4;k++){
      res.push_back(t);
      t.roll('E');
    }
  }
  return res;
}


template<typename T>
vector<T> compress(vector<T> v){
  sort(v.begin(),v.end());
  v.erase(unique(v.begin(),v.end()),v.end());
  return v;
}

template<typename T>
map<T, int> dict(const vector<T> &v){
  map<T, int> res;
  for(int i=0;i<(int)v.size();i++)
    res[v[i]]=i;
  return res;
}

//INSERT ABOVE HERE
signed main(){
  int h,w;
  cin>>h>>w;
  vector<string> s(h);
  for(int i=0;i<h;i++) cin>>s[i];

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

  int dd[6][4]={{4,2,1,3},
                {0,2,5,3},
                {4,5,1,0},
                {4,0,1,5},
                {5,2,0,3},
                {1,2,4,3}};
  
  struct T{
    int y,x,v,p;
    T(){}
    T(int y,int x,int v,int p):y(y),x(x),v(v),p(p){}    
  };
  
  auto in=[&](int y,int x){return 0<=y&&y<h&&0<=x&&x<w;};

  vector<vector<int> > used(h,vector<int>(w,-1));
  vector<vector<int> > dc;
  auto bfs=
    [&](int sy,int sx)->void{
      queue<T> q;
      used[sy][sx]=0;
      q.emplace(sy,sx,0,4);
      vector<int> vs(6,'#');
      while(!q.empty()){
        T t=q.front();q.pop();
        vs[t.v]=int(s[t.y][t.x]);
        
        int pd=0,pv=used[t.y-dy[t.p]][t.x-dx[t.p]];
        for(int k=0;k<4;k++)
          if(dd[t.v][k]==pv) pd=(6-t.p)+(k);

        pd%=4;
        //cout<<t.v<<":"<<t.p<<":"<<char(vs[t.v])<<":"<<pv<<" "<<pd<<endl;
          
        for(int k=0;k<4;k++){
          int ny=t.y+dy[k],nx=t.x+dx[k];
          if(!in(ny,nx)||s[ny][nx]=='.'||~used[ny][nx]) continue;
          used[ny][nx]=dd[t.v][(pd+k)%4];
          q.emplace(ny,nx,used[ny][nx],k);
        }
      }      
      Dice di;
      for(int i=0;i<6;i++) di.s[i]=vs[i];
      auto ds=makeDices(di);
      for(Dice d:ds){
        if(d.s[0]=='#'||d.s[1]=='#'||d.s[2]=='#') continue;
        dc.push_back(vector<int>({d.s[0],d.s[1],d.s[2]}));
        // cout<<char(d.s[0])<<" "<<char(d.s[1])<<" "<<char(d.s[2])<<endl;
      }
    };
  
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      if(~used[i][j]||s[i][j]=='.') continue;
      bfs(i,j);
    }    
  }
  
  dc=compress(dc);
  int m=dc.size();

  using D = tuple<int, int, int>;
  set<D> ss;
  for(int i=0;i<m;i++)
    ss.emplace(dc[i][0],dc[i][1],dc[i][2]);

  auto YES=[&](){cout<<"Yes"<<endl;exit(0);};

  for(int i=0;i<m;i++){
    for(int j=0;j<i;j++){
      int a=dc[i][0],b=dc[i][1],c=dc[i][2];
      int d=dc[j][0],e=dc[j][1],f=dc[j][2];
      set<int> sc({a,b,c,d,e,f});
      if(sc.size()!=6u) continue;
      
      //cout<<char(a)<<" "<<char(b)<<" "<<char(c);
      //cout<<" "<<char(d)<<" "<<char(e)<<" "<<char(f)<<endl;
      
      if(!ss.count(D(d,b,e))) continue;   
      if(!ss.count(D(e,b,a))) continue; 
      if(!ss.count(D(a,b,c))) continue;
      if(!ss.count(D(c,b,d))) continue;  

      if(!ss.count(D(d,e,f))) continue;
      if(!ss.count(D(e,a,f))) continue;
      if(!ss.count(D(a,c,f))) continue;
      if(!ss.count(D(c,d,f))) continue;

      YES();
    }
  }
      
  
  cout<<"No"<<endl;
  return 0;
}



Measured memory_bytes: 3232