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