#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:256000000")
using namespace std;
int t;
void solve();
vector<vector<int> > g(13);
void dfs(int v);
int h, m, s;
int t1, t2;
vector<bool> used(13, false);
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  t = 1;
  for (int i = 0; i < t; ++i) {
    solve();
  }
}
void solve() {
  cin >> h >> m >> s;
  cin >> t1 >> t2;
  for (int i = 2; i <= 12; ++i) {
    if (m == 0 && s == 0) {
      if (h == (i - 1) || h == i) {
        continue;
      }
    } else {
      if (h == (i - 1)) {
        continue;
      }
    }
    if (s == 0) {
      if (m >= (i - 1) * 5 && m <= i * 5) {
        continue;
      }
    } else {
      if (m >= (i - 1) * 5 && m < i * 5) {
        continue;
      }
    }
    if (s >= (i - 1) * 5 && s <= i * 5) {
      continue;
    }
    g[i - 1].push_back(i);
    g[i].push_back(i - 1);
  }
  if (h == 12 || (h == 1 && s == 0 && m == 0)) {
  } else {
    if ((m >= 0 && m <= 5 && s == 0) || (m >= 0 && m < 5 && s > 0)) {
    } else {
      if (s >= 0 && s <= 5) {
      } else {
        g[1].push_back(12);
        g[12].push_back(1);
      }
    }
  }
  dfs(t1);
  if (used[t2]) {
    cout << "YES";
  } else
    cout << "NO";
}
void dfs(int v) {
  used[v] = true;
  for (auto i = g[v].begin(); i != g[v].end(); ++i)
    if (!used[*i]) dfs(*i);
}
