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