#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimization("unroll-loops") cpp fast
using namespace std;
const long long remi = 1000000007;
const long long remi2 = 998244353;
const long long inf = 1e18 + 1e17 + 1e16;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  ;
  int x1, y1, z1, x2, y2, z2;
  cin >> x1 >> y1 >> z1 >> x2 >> y2 >> z2;
  int k = abs(x2 - x1) + abs(y2 - y1) + abs(z2 - z1);
  if (k > 2) {
    cout << "NO";
  } else {
    cout << "YES";
  }
  return 0;
}
