#include <bits/stdc++.h>
const double PI = 2 * acos(0.0);
using namespace std;
int main() {
  int x = 0;
  string a, b;
  getline(cin, a);
  getline(cin, b);
  if ((a == "0 1 0" && b == "1 0 0") || (a == "1 1 0" && b == "0 0 0") ||
      (a == "1 1 1" && b == "0 0 1") || (a == "0 1 1" && b == "1 0 1") ||
      (a == "0 1 1" && b == "0 0 0") || (a == "0 1 0" && b == "0 0 1") ||
      (a == "1 1 0" && b == "1 0 1") || (a == "0 0 0" && b == "1 0 1") ||
      (a == "1 1 1" && b == "1 0 0") || (a == "0 1 0" && b == "1 1 1") ||
      (a == "0 0 1" && b == "1 0 0") || (a == "1 1 0" && b == "0 1 1") ||
      (b == "0 1 0" && a == "1 0 0") || (b == "1 1 0" && a == "0 0 0") ||
      (b == "1 1 1" && a == "0 0 1") || (b == "0 1 1" && a == "1 0 1") ||
      (b == "0 1 1" && a == "0 0 0") || (b == "0 1 0" && a == "0 0 1") ||
      (b == "1 1 0" && a == "1 0 1") || (b == "0 0 0" && a == "1 0 1") ||
      (b == "1 1 1" && a == "1 0 0") || (b == "0 1 0" && a == "1 1 1") ||
      (b == "0 0 1" && a == "1 0 0") || (b == "1 1 0" && a == "0 1 1")) {
    cout << "YES"
         << "\n";
    return 0;
  }
  for (int i = 0; i < a.size(); i++) {
    if (a[i] == b[i]) {
      x++;
    }
  }
  if (x == 4) {
    cout << "YES"
         << "\n";
  } else {
    cout << "NO"
         << "\n";
  }
  return 0;
}
