#include <bits/stdc++.h>
using namespace std;
int main() {
  string table, one, two, three, four, five, ans = "NO";
  cin >> table >> one >> two >> three >> four >> five;
  if (table[0] == one[0] || table[0] == two[0] || table[0] == three[0] ||
      table[0] == four[0] || table[0] == five[0])
    ans = "YES";
  if (table[1] == one[1] || table[1] == two[1] || table[1] == three[1] ||
      table[1] == four[1] || table[1] == five[1])
    ans = "YES";
  cout << ans;
  return 0;
}
