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