#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define irep(i, n) for (int i = (n); i >= 0; i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = 1 << 30;
 
int main() {
  vector<queue<char>> s(3);
  rep(i,3) {
    string t; cin >> t;
    rep(j,t.size()) s[i].push(t[j]);
  }
  int turn = 0;
  //!s[0].empty()&&!s[1].empty()&&!s[2].empty()
  while (true)
  {
    if (s[turn].empty()) break;
    char c = s[turn].front(); s[turn].pop();
    if (c == 'a') turn = 0;
    else if (c=='b') turn = 1;
    else turn = 2;
  }
  if (turn==0) cout << 'A' << endl;
  else if (turn==1) cout << 'B' << endl;
  else cout << 'C' << endl;
  return 0;
}
#include <bits/stdc++.h>
using namespace std;
int main(){
  int H,W; cin>>H>>W;
  vector<vector<char>>A(H+2,vector<char>(W+2,'.'));
  for(int i=1;i<=H;i++){
    string S; cin>>S;
    for(int j=1;j<=W;j++){
      A[i][j]=S.at(j-1);
    }
  }
  for(int i=1;i<=H;i++){
    for(int j=1;j<=W;j++){
      if(A[i][j]=='.')continue;
      if(A[i+1][j]=='#')continue;
      if(A[i-1][j]=='#')continue;
      if(A[i][j+1]=='#')continue;
      if(A[i][j-1]=='#')continue;
      cout<<"No"<<endl;
      return 0;
    }
  }
  cout<<"Yes"<<endl;
}