#include <bits/stdc++.h>
using namespace std;
const int N = 0;
int n, k, x;
string s;
vector<int> v;
int main() {
  int a, b, c, d, e, f;
  int cnt = 0;
  scanf("%d%d%d%d%d%d", &a, &b, &c, &d, &e, &f);
  if (a == d) cnt++;
  if (b == e) cnt++;
  if (c == f) cnt++;
  if (cnt >= 1) {
    printf("YES\n");
  } else {
    printf("NO\n");
  }
  return 0;
}
