#include <bits/stdc++.h>
using namespace std;
int main() {
  bool a, b, c, d, ki = 0;
  cin >> a >> b >> c >> d;
  if (d == a) ki = 1;
  cin >> d;
  if (d == b) ki = 1;
  cin >> d;
  if (d == c) ki = 1;
  cout << (ki ? "YES" : "NO");
  return 0;
}
