#include <bits/stdc++.h>
using namespace std;
int main() {
  char c1, c2;
  cin >> c1 >> c2;
  char c3[15];
  for (int i = 0; i < 10; i++) {
    cin >> c3[i];
    if (c3[i] == c1 || c3[i] == c2) {
      cout << "YES" << endl;
      return 0;
    }
  }
  cout << "NO" << endl;
  return 0;
}
