#include <bits/stdc++.h>
using namespace std;
int main() {
  string a, b;
  cin >> a;
  char s = getchar();
  getline(cin, b);
  for (int i = 0; i < b.size(); i++) {
    if (b[i] == a[0] || b[i] == a[1]) {
      cout << "Yes";
      return 0;
    }
  }
  cout << "No";
  return 0;
}
