#include <bits/stdc++.h>
const long long int mv = 1e6 + 5;
const double pi = 3.14;
const long long int inf = 1e18;
using namespace std;
int main() {
  string a, b, c, d, e, f, g, h, i, o, k;
  cin >> a;
  cin >> b >> c >> d >> e >> f;
  if (a[0] == b[0] || a[0] == c[0] || a[0] == d[0] || a[0] == e[0] ||
      a[0] == f[0]) {
    cout << "YES";
    return 0;
  }
  if (a[1] == b[1] || a[1] == c[1] || a[1] == d[1] || a[1] == e[1] ||
      a[1] == f[1]) {
    cout << "YES";
    return 0;
  } else {
    cout << "NO";
  }
}
