#include <bits/stdc++.h>
using namespace std;
long long const mod = 1000000007;
long long const md = 998244353;
long long mypow(long long a, long long b) {
  long long res = 1;
  a %= mod;
  assert(b >= 0);
  for (; b; b >>= 1) {
    if (b & 1) res = res * a % mod;
    a = a * a % mod;
  }
  return res;
}
ifstream in("txt.in");
ofstream out("txt.out");
int main() {
  cout << fixed << setprecision(12);
  cin.tie(0);
  cout.tie(0);
  ios_base::sync_with_stdio(0);
  string a;
  cin >> a;
  for (int i = 1; i <= 5; ++i) {
    string s;
    cin >> s;
    if (s[0] == a[0] || s[1] == a[1]) {
      cout << "YES";
      exit(0);
    }
  }
  cout << "NO";
  return 0;
}
