#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  string t;
  string a, b, c, d, e;
  cin >> t;
  cin >> a >> b >> c >> d >> e;
  if (t[0] == a[0] or t[0] == b[0] or t[0] == c[0] or t[0] == d[0] or
      t[0] == e[0] or t[1] == a[1] or t[1] == b[1] or t[1] == c[1] or
      t[1] == d[1] or t[1] == e[1])
    cout << "YES";
  else
    cout << "NO";
  return 0;
}
