#include <bits/stdc++.h>
int main() {
  int a, b, c;
  int aa, bb, cc;
  while (~scanf("%d%d%d", &a, &b, &c)) {
    scanf("%d%d%d", &aa, &bb, &cc);
    if (aa == a || bb == b || cc == c) {
      printf("Yes\n");
      continue;
    } else {
      printf("No\n");
    }
  }
  return 0;
}
