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