#include <bits/stdc++.h>
using namespace std;
int x1, x2, y, y2, z1, z2;
int main() {
  scanf("%d %d %d %d %d %d", &x1, &y, &z1, &x2, &y2, &z2);
  if ((x1 == x2) || (y == y2) || (z1 == z2))
    cout << "YES\n";
  else
    cout << "NO\n";
}
