#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  t = 1;
  while (t--) {
    string tableCard;
    cin >> tableCard;
    bool ansfound = false;
    for (int i = 0; i < 5; i++) {
      if (ansfound) continue;
      string myCard;
      cin >> myCard;
      if (myCard[0] == tableCard[0] || myCard[1] == tableCard[1])
        ansfound = true;
    }
    if (ansfound)
      cout << "YES\n";
    else
      cout << "NO\n";
  }
  return 0;
}
