#include <bits/stdc++.h>
using namespace std;
int main() {
  int h, m, s, t1, t2;
  cin >> h >> m >> s >> t1 >> t2;
  m = m / 5;
  s = s / 5;
  bool bh1, bm1, bs1, bh2, bm2, bs2;
  bh1 = bm1 = bs1 = bh2 = bm2 = bs2 = 0;
  if (t1 > h) {
    bh1 = 1;
  }
  if (t1 > m) {
    bm1 = 1;
  }
  if (t1 > s) {
    bs1 = 1;
  }
  if (t2 > h) {
    bh2 = 1;
  }
  if (t2 > m) {
    bm2 = 1;
  }
  if (t2 > s) {
    bs2 = 1;
  }
  if (bh1 == bh2 && bm1 == bm2 && bs1 == bs2 ||
      bh1 != bh2 && bm2 != bm1 && bs1 != bs2) {
    cout << "YES";
  } else {
    cout << "NO";
  }
}
