#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  clock_t launch = clock();
  long long t = 1;
  while (t--) {
    long long a[6];
    for (long long i = 0; i < 6; i++) cin >> a[i];
    for (long long i = 0; i < 3; i++)
      if ((a[i] ^ a[3 + i]) == 0) {
        cout << "YES";
        return 0;
      }
    cout << "NO";
  }
  clog << ((long double)(clock() - launch) / CLOCKS_PER_SEC) << "\n";
  return 0;
}
