#include <bits/stdc++.h>
using namespace std;
long long prime(long long x) {
  long long mark = 0;
  {
    for (int i = 2; i <= sqrt(x); i++) {
      if (x % i == 0) {
        mark = 1;
        break;
      }
    }
  }
  return mark;
}
int main() {
  long long mark = 0;
  string s, s1;
  cin >> s;
  for (int i = 0; i < 5; i++) {
    cin >> s1;
    if (s1[0] == s[0] || s1[1] == s[1]) {
      mark = 1;
    }
  }
  if (mark == 1) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
}
