#include <bits/stdc++.h>
using namespace std;
template <class T>
inline T checkmin(T &a, T b) {
  return (a < b) ? a : a = b;
}
template <class T>
inline T checkmax(T &a, T b) {
  return (a > b) ? a : a = b;
}
template <class T>
T GCD(T a, T b) {
  if (a < 0) return GCD(-a, b);
  if (b < 0) return GCD(a, -b);
  return (a == 0) ? b : GCD(b % a, a);
}
template <class T>
T LCM(T a, T b) {
  if (a < 0) return LCM(-a, b);
  if (b < 0) return LCM(a, -b);
  return (a == 0 || b == 0) ? 0 : a / GCD(a, b) * b;
}
namespace Poor {
void Run() {
  int a, b, c, d, e, f;
  cin >> a >> b >> c >> d >> e >> f;
  if (a == d || b == e || c == f)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
}
}  // namespace Poor
int main() { Poor::Run(); }
