#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, c, d, e, f;
  cin >> a >> b >> c >> d >> e >> f;
  int l = 0;
  if (a == d) l++;
  if (b == e) l++;
  if (c == f) l++;
  if (l)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
}
