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