#include <bits/stdc++.h>
using namespace std;
int main() {
  char x, y;
  cin >> x >> y;
  bool ans = false;
  for (int i = 0; i < 5; i++) {
    char t;
    cin >> t;
    if (t == x) {
      ans = true;
    }
    cin >> t;
    if (t == y) {
      ans = true;
    }
  }
  if (ans) {
    cout << "YES";
  } else {
    cout << "NO";
  }
  return 0;
}
