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