#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:1024000000,1024000000")
using namespace std;
const int MOD = 1000000007;
const double PI = acos(-1.0);
const double EPS = 1e-8;
const int dir[4][2] = {{-1, 0}, {0, -1}, {0, 1}, {1, 0}};
inline void II(int &n) {
  char ch = getchar();
  n = 0;
  bool t = 0;
  for (; ch < '0'; ch = getchar())
    if (ch == '-') t = 1;
  for (; ch >= '0'; n = n * 10 + ch - '0', ch = getchar())
    ;
  if (t) n = -n;
}
inline void OO(int a) {
  if (a < 0) {
    putchar('-');
    a = -a;
  }
  if (a >= 10) OO(a / 10);
  putchar(a % 10 + '0');
}
inline int sgn(double x) { return (x > EPS) - (x < -EPS); }
int n;
struct node {
  double t;
  bool s;
  node() {}
  node(double _t, bool _s) {
    t = _t;
    s = _s;
  }
  bool operator<(const node &rhs) const { return t < rhs.t; }
} a[100];
int h, m, s, t1, t2;
int main() {
  scanf("%d%d%d", &h, &m, &s);
  if (h == 12) h = 0;
  int hs = h * 3600 + m * 60 + s;
  int ms = m * 60 + s;
  int ss = s;
  double ha = hs * 1.0 / 12 / 3600;
  double ma = ms * 1.0 / 3600;
  double sa = ss * 1.0 / 60;
  scanf("%d%d", &t1, &t2);
  if (t1 == 12) t1 -= 12;
  if (t2 == 12) t2 -= 12;
  double a1 = t1 * 1.0 / 12;
  double a2 = t2 * 1.0 / 12;
  a[1] = node(ha, 0);
  a[2] = node(ma, 0);
  a[3] = node(sa, 0);
  a[4] = node(a1, 1);
  a[5] = node(a2, 1);
  sort(a + 1, a + 1 + 5);
  bool ok = 0;
  for (int i = 1; i <= 4; ++i)
    if (a[i].s && a[i + 1].s) ok = 1;
  if (a[1].s && a[5].s) ok = 1;
  puts(ok ? "YES" : "NO");
  return 0;
}
