#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int a, b, c, x, y, z;
  cin >> a >> b >> c >> x >> y >> z;
  if (x == a) {
    cout << "YES";
    return 0;
  }
  if (x != a && z == c) {
    cout << "YES";
    return 0;
  }
  if (abs(x - a) == abs(z - c) && y == b) {
    cout << "YES";
    return 0;
  }
  cout << "NO" << endl;
  return 0;
}
