#include <bits/stdc++.h>
using namespace std;
int main() {
  bool f = false;
  char c1, c2;
  scanf("%c%c", &c1, &c2);
  char ch1, ch2, ch3;
  for (int i = 0; i < 5; i++) {
    scanf(" %c%c", &ch1, &ch2);
    if (ch1 == c1 || ch2 == c2) f = true;
  }
  if (ch1 == c1 || ch2 == c2) f = true;
  if (f)
    printf("YES");
  else
    printf("NO");
  return 0;
}
