#include <bits/stdc++.h>
using namespace std;
int main() {
  string str, s;
  int x = 0;
  cin >> str;
  for (size_t i = 0; i < 5; i++) {
    cin >> s;
    for (size_t j = 0; j < 2; j++) {
      if (s[j] == str[j]) x++;
    }
  }
  if (x > 0)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
  return 0;
}
