#include <bits/stdc++.h>
using namespace std;
const int INF = 2147483647;
const int mod = 1e9 + 7;
const long long int seed = 0xdefaced;
inline long long int rit() {
  long long int f = 0, key = 1;
  char c;
  do {
    c = getchar();
    if (c == '-') key = -1;
  } while (c < '0' || c > '9');
  do {
    f = f * 10 + c - '0';
    c = getchar();
  } while (c >= '0' && c <= '9');
  return f * key;
}
int check(int n, string s, int *ans) {
  int now = 0;
  for (int i = 0; i < n; i++) {
    if (s[i] == '(') {
      now++;
    } else {
      now--;
    }
    if (now < 0) {
      *ans = i;
      return now;
    }
  }
  return now;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  string a, s[10];
  cin >> a;
  for (int i = 0; i < 5; i++) {
    cin >> s[i];
  }
  for (int i = 0; i < 5; i++) {
    if (a[0] == s[i][0] || a[1] == s[i][1]) {
      cout << "YES" << '\n';
      return 0;
    }
  }
  cout << "NO" << '\n';
  return 0;
}
