#include <bits/stdc++.h>
using namespace std;
int main() {
  string table;
  string hand;
  cin >> table;
  cin.ignore();
  getline(cin, hand);
  string::size_type index;
  if (hand.find_first_of(table) == string::npos) {
    cout << "NO";
  } else {
    cout << "YES";
  }
}
