#include <bits/stdc++.h>
using namespace std;
double const pi = 3.1415926535897932384626433832795;
int const inf = (int)1e9;
long long const inf64 = (long long)2e18;
const string task = "";
int x1, qqqqqqq, x2, y2, z1, z2;
int main() {
  cin >> x1 >> qqqqqqq >> z1;
  cin >> x2 >> y2 >> z2;
  if ((x1 ^ x2) + (qqqqqqq ^ y2) + (z1 ^ z2) == 3)
    cout << "NO" << endl;
  else
    cout << "YES" << endl;
  return 0;
}
