#include <bits/stdc++.h>
using namespace std;
int k;
string s, a, b;
int main() {
  cin >> s;
  for (int i = 1; i <= 5; i++) {
    cin >> a;
    if (a[0] == s[0] || a[1] == s[1]) {
      k = 1;
    }
  }
  if (k == 1) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
}
