#include <bits/stdc++.h>
using namespace std;
char a[2], b[2];
int main() {
  cin >> a[0] >> a[1];
  for (int i = 1; i <= 5; i++) {
    cin >> b[0] >> b[1];
    if (a[0] == b[0] || a[1] == b[1]) {
      puts("YES");
      return 0;
    }
  }
  puts("NO");
}
