#include <bits/stdc++.h>
using namespace std;
int main() {
  char s[2];
  int flag = 0;
  cin >> s;
  char hands[5][2];
  for (int i = 0; i < 5; i++) {
    cin >> hands[i];
    if (s[0] == hands[i][0] || s[1] == hands[i][1]) flag = 1;
  }
  if (flag)
    cout << "yes";
  else
    cout << "no";
  return 0;
}
