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