#include <bits/stdc++.h>
using namespace std;
long long a[10001];
void run() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
}
int main() {
  run();
  string s, x1, x2, x3, x4, x5;
  cin >> s >> x1 >> x2 >> x3 >> x4 >> x5;
  if (s[0] == x1[0] || s[0] == x3[0] || s[0] == x3[0] || s[0] == x4[0] ||
      s[0] == x5[0])
    cout << "YES"
         << "\n";
  else if (s[1] == x1[1] || s[1] == x3[1] || s[1] == x3[1] || s[1] == x4[1] ||
           s[1] == x5[1])
    cout << "YES"
         << "\n";
  else
    cout << "NO"
         << "\n";
  return 0;
}
