#include <bits/stdc++.h>
using namespace std;
int dir[4][2] = {{0, -1}, {-1, 0}, {0, 1}, {1, 0}};
template <class T>
class Cmp {
 public:
  bool operator()(const T& lhs, const T& rhs) { return lhs > rhs; }
};
int main() {
  int a, b, c, d, e, f;
  cin >> a >> b >> c;
  cin >> d >> e >> f;
  if (a + d == 1 && b + e == 1 && c + f == 1) {
    cout << "NO" << endl;
  } else {
    cout << "YES" << endl;
  }
  return 0;
}
