#include <bits/stdc++.h>
using namespace std;
int main() {
  string s, a, b, c, d, e;
  cin >> s;
  cin >> a >> b >> c >> d >> e;
  bool ok = 0;
  if (s[0] == a[0] || s[0] == b[0] || s[0] == c[0] || s[0] == d[0] ||
      s[0] == e[0]) {
    ok = 1;
  } else if (s[1] == a[1] || s[1] == b[1] || s[1] == c[1] || s[1] == d[1] ||
             s[1] == e[1]) {
    ok = 1;
  } else {
    ok = 0;
  }
  if (!ok)
    cout << "NO";
  else
    cout << "YES";
  exit(0);
}
