#include <bits/stdc++.h>
using namespace std;
long long a, b, n, ans;
string str, s;
bool mark;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> s;
  for (int i = 0; i < 5; i++) {
    cin >> str;
    if (str[0] == s[0] || str[1] == s[1]) mark = true;
  }
  if (!mark)
    cout << "NO";
  else
    cout << "YES";
  return 0;
}
