#include <bits/stdc++.h>
int main() {
  int a, b, c, d, e, f;
  scanf("%d%d%d%d%d%d", &a, &b, &c, &d, &e, &f);
  if ((a == d) || (b == e) || (c == f))
    printf("YES\n");
  else
    printf("NO\n");
}
