#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, c, d, e, f;
  scanf("%d %d %d %d %d %d", &a, &b, &c, &d, &e, &f);
  printf("%s\n", (a == d or b == e or c == f) ? "YES" : "NO");
  return 0;
}
