#include <bits/stdc++.h>
using namespace std;
const int MOD = 998244353;
int main() {
  string a, v[6];
  cin >> a;
  for (int i = 1; i <= 5; ++i) {
    cin >> v[i];
    if (v[i][0] == a[0] || v[i][1] == a[1]) {
      cout << "YES\n";
      return 0;
    }
  }
  cout << "NO\n";
  return 0;
}
