#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f, maxn = 100007, mod = 1e9 + 7;
const long long linf = 0x3f3f3f3f3f3f3f3fLL;
const long long P = 19260817;
string str;
string s;
bool flag;
int main() {
  cin >> str;
  for (int i = 1; i <= 5; i++) {
    cin >> s;
    if (s[0] == str[0] || s[1] == str[1]) flag = true;
  }
  if (flag) {
    printf("YES");
  } else {
    printf("NO");
  }
  return 0;
}
