#include <bits/stdc++.h>
using namespace std;
vector<long long int> v;
void finddiv(long long int n) {
  for (long long int i = 1; i <= sqrt(n); i++) {
    if (n % i == 0) {
      if (i == n / i)
        v.push_back(i);
      else {
        v.push_back(i);
        v.push_back(n / i);
      }
    }
  }
  sort(v.begin(), v.end());
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int tt = 1;
  while (tt--) {
    string s;
    cin >> s;
    string a, b, c, d, e;
    cin >> a >> b >> c >> d >> e;
    if (s[0] == a[0] or s[0] == b[0] or s[0] == c[0] or s[0] == d[0] or
        s[0] == e[0])
      cout << "YES";
    else if (s[1] == a[1] or s[1] == b[1] or s[1] == c[1] or s[1] == d[1] or
             s[1] == e[1])
      cout << "YES";
    else
      cout << "NO";
  }
  return 0;
}
