#include <bits/stdc++.h>
using namespace std;
struct pair_hash {
  template <class T1, class T2>
  std::size_t operator()(std::pair<T1, T2> const &pair) const {
    std::size_t h1 = std::hash<T1>()(pair.first);
    std::size_t h2 = std::hash<T2>()(pair.second);
    return h1 ^ h2;
  }
};
unsigned long long max(unsigned long long a[], unsigned long long b[]) {
  unsigned long long r(*a);
  unsigned long long *k = a;
  while (k != b) {
    r = (r > (*k)) ? r : (*k);
    k++;
  }
  return r;
}
unsigned long long min(unsigned long long a[], unsigned long long b[]) {
  unsigned long long r(*a);
  unsigned long long *k = a;
  while (k != b) {
    r = (r < (*k)) ? r : (*k);
    k++;
  }
  return r;
}
void sieve(bool prime[], int n) {
  memset(prime, true, sizeof(bool) * n);
  for (int p = 2; p * p <= n; p++) {
    if (prime[p] == true) {
      for (int i = p * p; i <= n; i += p) prime[i] = false;
    }
  }
}
template <typename T>
bool compair(pair<T, T> a, pair<T, T> b) {
  return a.second < b.second;
}
void solve() {
  int a, b, c, p, q, r;
  cin >> a >> b >> c >> p >> q >> r;
  if (a != p && b != q && c != r)
    cout << "NO";
  else
    cout << "YES";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  { solve(); }
  return 0;
}
