#include <bits/stdc++.h>
int main() {
  char a[2], b[14];
  int i, f = 0;
  for (i = 0; i < 2; i++) scanf("%c", &a[i]);
  for (i = 0; i < 15; i++) {
    scanf("%c", &b[i]);
    if ((b[i] == a[0]) || (b[i] == a[1])) f++;
  }
  if (f > 0)
    printf("YES");
  else
    printf("NO");
  return 0;
}
