#include <bits/stdc++.h>
using namespace std;
void solve();
mt19937 rnd(2007);
signed main() {
  mt19937 rrnd(
      std::chrono::high_resolution_clock::now().time_since_epoch().count());
  swap(rrnd, rnd);
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  solve();
}
void solve() {
  string t;
  cin >> t;
  vector<string> a(5);
  for (long long(i) = 0; (i) < (5); ++(i)) cin >> a[i];
  for (long long(i) = 0; (i) < (5); ++(i)) {
    if (t[0] == a[i][0] || t[1] == a[i][1]) {
      cout << "YES" << '\n';
      return;
    }
  }
  cout << "NO" << '\n';
}
