#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, c, a1, b1, c1;
  cin >> a >> b >> c >> a1 >> b1 >> c1;
  if (a == a1 || b == b1 || c == c1)
    cout << "YES";
  else
    cout << "NO";
}
