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