#include <bits/stdc++.h>
int main() {
  char A[2], B[2];
  int i, count = 0;
  scanf("%s", A);
  for (i = 0; i < 5; i++) {
    scanf("%s", B);
    if (B[0] == A[0]) {
      count++;
    } else if (B[1] == A[1]) {
      count++;
    }
  }
  if (count > 0)
    printf("YES");
  else
    printf("NO");
}
