#include <bits/stdc++.h>
using namespace std;
struct point {
  int x;
  int y;
  int z;
};
int main() {
  point a, b;
  cin >> a.x >> a.y >> a.z;
  cin >> b.x >> b.y >> b.z;
  cout << (((double)(sqrt(((a.x - b.x) * (a.x - b.x)) +
                          ((a.y - b.y) * (a.y - b.y)) +
                          ((a.z - b.z) * (a.z - b.z)))) == 1 ||
            (double)(sqrt(((a.x - b.x) * (a.x - b.x)) +
                          ((a.y - b.y) * (a.y - b.y)) +
                          ((a.z - b.z) * (a.z - b.z)))) -
                    sqrt(2) <=
                0.000000001)
               ? "YES"
               : "NO")
       << endl;
  return 0;
}
