#include <bits/stdc++.h>
using namespace std;
int main() {
  int csno = 1, T;
  string str, str2;
  getline(cin, str);
  getline(cin, str2);
  int len = str2.length();
  for (int i = 0; i < len; i += 2) {
    if (str[0] == str2[i] || str[1] == str2[i + 1]) {
      cout << "YES\n";
      return 0;
    }
    i++;
  }
  cout << "NO\n";
  return 0;
  return 0;
}
