#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  string s1, s2, ans = "NO";
  cin >> s1;
  for (int i = 0; i < 5; i++) {
    cin >> s2;
    if (s1[0] == s2[0] || s1[1] == s2[1]) ans = "YES";
  }
  cout << ans;
  return 0;
}
