#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, c, d, e;
  cin >> a >> b >> c >> d >> e;
  if (a == 12) a = 0;
  a *= 10;
  if (b != 0 || c != 0) a += 1;
  b *= 2;
  if (c != 0) b += 1;
  c *= 2;
  if (d == 12) d = 0;
  d *= 10;
  if (e == 12) e = 0;
  e *= 10;
  if (d > e) {
    int tmp = d;
    d = e;
    e = tmp;
  }
  bool aa = false, bb = false;
  for (int i = d; i <= e; i++) {
    if (i == a || i == b || i == c || i == a + 120 || i == b + 120 ||
        i == c + 120)
      aa = true;
  }
  for (int i = e; i <= d + 120; i++) {
    if (i == a || i == b || i == c || i == a + 120 || i == b + 120 ||
        i == c + 120)
      bb = true;
  }
  if (aa && bb) {
    cout << "NO\n";
    return 0;
  } else {
    cout << "YES\n";
    return 0;
  }
}
