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