#include <bits/stdc++.h>
using namespace std;
int main() {
  int x, y, z, x1, y1, z1;
  cin >> x >> y >> z >> x1 >> y1 >> z1;
  if (x == x1 || y == y1 || z == z1)
    cout << "YES";
  else
    cout << "NO";
  return 0;
}
