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