Have you ever tried to explain to the coordinator, why it is eight hours to the contest and not a single problem has been prepared yet? Misha had. And this time he has a really strong excuse: he faced a space-time paradox! Space and time replaced each other.

The entire universe turned into an enormous clock face with three hands — hour, minute, and second. Time froze, and clocks now show the time h hours, m minutes, s seconds.

Last time Misha talked with the coordinator at t_1 o'clock, so now he stands on the number t_1 on the clock face. The contest should be ready by t_2 o'clock. In the terms of paradox it means that Misha has to go to number t_2 somehow. Note that he doesn't have to move forward only: in these circumstances time has no direction.

Clock hands are very long, and Misha cannot get round them. He also cannot step over as it leads to the collapse of space-time. That is, if hour clock points 12 and Misha stands at 11 then he cannot move to 1 along the top arc. He has to follow all the way round the clock center (of course, if there are no other hands on his way).

Given the hands' positions, t_1, and t_2, find if Misha can prepare the contest on time (or should we say on space?). That is, find if he can move from t_1 to t_2 by the clock face.


-----Input-----

Five integers h, m, s, t_1, t_2 (1 ≤ h ≤ 12, 0 ≤ m, s ≤ 59, 1 ≤ t_1, t_2 ≤ 12, t_1 ≠ t_2).

Misha's position and the target time do not coincide with the position of any hand.


-----Output-----

Print "YES" (quotes for clarity), if Misha can prepare the contest on time, and "NO" otherwise.

You can print each character either upper- or lowercase ("YeS" and "yes" are valid when the answer is "YES").


-----Examples-----
Input
12 30 45 3 11

Output
NO

Input
12 0 1 12 1

Output
YES

Input
3 47 0 4 9

Output
YES



-----Note-----

The three examples are shown on the pictures below from left to right. The starting position of Misha is shown with green, the ending position is shown with pink. Note that the positions of the hands on the pictures are not exact, but are close to the exact and the answer is the same. $\oplus 0 \theta$

Source: codeforces | Difficulty: MEDIUM
Tags: Implementation


Solutions:
[h, m, s, t1, t2] = list(map(int, input().split()))
if h == 12:
	h = 0
if t1 == 12:
	t1 = 0
if t2 == 12:
	t2 = 0
if t1 > t2:
	(t1, t2) = (t2, t1)
sa = s * 360 * 12 * 60
ma = m * 360 * 12 * 60 + s * 360 * 12
ha = h * 360 * 60 * 60 + m * 360 * 60 + s * 360

def check(x):
	if t1 * 360 / 12 * 12 * 60 * 60 < x and x < t2 * 360 / 12 * 12 * 60 * 60:
		return 1
	return -1
if check(sa) == check(ma) and check(sa) == check(ha):
	print('YES')
	exit(0)
print('NO')


(h, m, s, t1, t2) = [int(i) for i in input().split()]
h *= 5
t1 *= 5
t2 *= 5
if h < t1:
	h += 60
if m < t1:
	m += 60
if s < t1:
	s += 60
if t2 < t1:
	t2 += 60
c = (t2 <= h) + (t2 <= m) + (t2 <= s)
ans = 'YES' if c == 0 or c == 3 else 'NO'
print(ans)


from functools import reduce
raws = [int(x) for x in input().split(' ')]
secpos = raws[2] / 5
minpos = raws[1] / 5 + secpos / 60
hrpos = raws[0] % 12 + minpos / 12
positions = [secpos, minpos, hrpos]
m = min(raws[3], raws[4])
n = max(raws[3], raws[4])
testcases = list(map(lambda x: x > n or x < m, positions))
out = reduce(lambda x, y: x and y, testcases) or reduce(lambda x, y: x and y, [not x for x in testcases])
if out:
	print('yes')
else:
	print('no')


(a, b, c, s, t) = map(int, input().split())
if a == 12:
	a = 0
if s == 12:
	s = 0
if t == 12:
	t = 0
a += b / 120 + c / 120
b += c / 60
b /= 5
c /= 5
f = [a, b, c]
f.sort()
if f[0] < s and s < f[1]:
	x = 1
elif f[1] < s and s < f[2]:
	x = 2
else:
	x = 3
if f[0] < t and t < f[1]:
	y = 1
elif f[1] < t and t < f[2]:
	y = 2
else:
	y = 3
if x == y:
	print('YES')
else:
	print('NO')


(h, m, s, t1, t2) = list(map(int, input().split()))
h = h % 12
t1 = t1 % 12
t2 = t2 % 12
t1 = t1 * 60 * 60
t2 = t2 * 60 * 60
(t1, t2) = (min(t1, t2), max(t1, t2))
hourHand = h * 60 * 60 + m * 60 + s
minHand = (m * 60 + s) * 12
secondHand = s * 60 * 12
count = 0
for val in [hourHand, minHand, secondHand]:
	if val >= t1 and val <= t2:
		count += 1
if count == 0 or count == 3:
	print('YES')
else:
	print('NO')


(h, m, s, t1, t2) = list(map(int, input().split()))
m += s / 60
h += m / 60
m /= 5
s /= 5
h = h % 12
m = m % 12
s = s % 12
T1 = min(t1, t2)
T2 = max(t1, t2)
if T1 < h < T2 and T1 < m < T2 and (T1 < s < T2):
	print('YES')
elif not (T1 < h < T2 or T1 < m < T2 or T1 < s < T2):
	print('YES')
else:
	print('NO')


(h, m, s, t1, t2) = map(int, input().split())
hh = h + m / 60 + s / 3600
mm = m / 5
ss = s / 5
ll = [hh, mm, ss, t1, t2]
ll = sorted(ll)
diff = abs(ll.index(t1) - ll.index(t2))
if diff == 1 or diff == 4:
	print('YES')
else:
	print('NO')


(h, m, s, t1, t2) = map(int, input().split())
h %= 12
t1 %= 12
t2 %= 12
angles = sorted([(3600 * h + 60 * m + s, 0), ((60 * m + s) * 12, 0), (s * 12 * 60, 0), (3600 * t1, 1), (3600 * t2, 2)])
x = [v[1] for v in angles]
good = False
for i in range(len(angles)):
	for j in range(i + 1, len(angles)):
		if x[i] + x[j] == 3:
			good |= all((x[k] != 0 for k in range(i + 1, j)))
			good |= all((x[k] != 0 for k in range(j + 1, len(angles)))) and all((x[k] != 0 for k in range(0, i)))
print('YES' if good else 'NO')


(h, m, s, t1, t2) = list(map(int, input().split()))
h %= 12
arr = []
arr.append(h * 30 + m / 2 + s / 120)
arr.append(6 * m + s / 10)
arr.append(6 * s)
arr.sort()
arr = arr + [360 + arr[0]]
t1 *= 30
t2 *= 30
x1 = -1
x2 = -1
for i in range(3):
	if arr[i] <= t1 and t1 <= arr[i + 1] or (arr[i] <= t1 + 360 and t1 + 360 <= arr[i + 1]):
		x1 = i
	if arr[i] <= t2 and t2 <= arr[i + 1] or (arr[i] <= t2 + 360 and t2 + 360 <= arr[i + 1]):
		x2 = i
print('YES' if x1 == x2 else 'NO')


(h, m, s, t1, t2) = map(int, input().split())
(h, t1, t2) = (h * 5 % 60, t1 * 5 % 60, t2 * 5 % 60)
if s != 0:
	m += s / 60
if m != 0:
	h += m / 60
lst = [h, m, s, t1, t2]
lst.sort()
res = 'NO'
if lst[0] == t1 and lst[1] == t2:
	res = 'YES'
for i in range(1, 4):
	if lst[i] == t1:
		if lst[i - 1] == t2:
			res = 'YES'
		if lst[i + 1] == t2:
			res = 'YES'
if lst[4] == t1 and lst[3] == t2:
	res = 'YES'
if lst[0] == t1 and lst[4] == t2 or (lst[0] == t2 and lst[4] == t1):
	res = 'YES'
print(res)


def getListInt():
	return [int(x) for x in input().split(' ')]

def solution():
	(h, m, s, t1, t2) = getListInt()
	if t2 == min(t1, t2):
		(t1, t2) = (t2, t1)
	m = float(m) / 5
	s = float(s) / 5
	nbrIn = 0
	if s > t1 and s < t2:
		nbrIn += 1
	if m > t1 and m < t2 or (m == t1 and s != 0):
		nbrIn += 1
	if h > t1 and h < t2 or (h == t1 and (m != 0 or s != 0)):
		nbrIn += 1
	return nbrIn == 0 or nbrIn == 3
print('YES' if solution() else 'NO')


def judge(a, b, c):
	if b < a:
		b += 3600 * 12
	if c < a:
		c += 3600 * 12
	return c > b
yes = False
(h, m, s, t1, t2) = map(int, input().split())
h *= 3600
m *= 3600
s *= 3600
h = h + m / 60 + s / 3600
m = (m + s / 60) / 5
s /= 5
h %= 3600 * 12
m %= 3600 * 12
s %= 3600 * 12
t1 = t1 % 12 * 3600
t2 = t2 % 12 * 3600
if judge(t1, t2, h) and judge(t1, t2, m) and judge(t1, t2, s):
	print('YES')
	yes = True
else:
	(t1, t2) = (t2, t1)
	if judge(t1, t2, h) and judge(t1, t2, m) and judge(t1, t2, s):
		print('YES')
		yes = True
if not yes:
	print('NO')


a = [0] * 3
(a[0], a[1], a[2], t1, t2) = map(int, input().split())
a[0] += a[1] / 60 + a[2] / 3600
a[1] = a[1] / 5 + a[2] / 300
a[2] /= 5
a[0] %= 12
t1 %= 12
t2 %= 12
a = sorted(a)
if t1 > t2:
	(t1, t2) = (t2, t1)
if a[0] < t1 and t2 < a[1]:
	print('YES')
elif a[1] < t1 and t2 < a[2]:
	print('YES')
elif t1 > a[2] and t2 > a[2]:
	print('YES')
elif t2 > a[2] and t1 < a[0]:
	print('YES')
elif t1 < a[0] and t2 < a[0]:
	print('YES')
else:
	print('NO')


n = input().split()
h = int(n[0])
m = int(n[1])
s = int(n[2])
t1 = int(n[3])
t2 = int(n[4])
flag1 = 0
flag2 = 0
hour = h * 30 + m * (1 / 2) + s * (1 / 720)
minute = m * 6 + s * (1 / 60)
second = s * 6
if hour > 360:
	hour -= 360
maxi = max(t1, t2) * 30
mini = min(t1, t2) * 30
if mini < hour < maxi or mini < minute < maxi or mini < second < maxi:
	flag1 = 1
if (0 <= hour < mini or 360 >= hour > maxi) or (0 <= minute < mini or minute > maxi) or (second < mini or second > maxi):
	flag2 = 1
if flag1 == 1 and flag2 == 1:
	print('NO')
else:
	print('YES')


def main():
	string = input()
	if is_contest_in_time(*map(int, string.split())):
		print('YES')
	else:
		print('NO')

def is_contest_in_time(h, m, s, t1, t2):
	h = _hours_to_ticks(h, m, s)
	m = m + s / 60
	t1 = _hours_to_ticks(t1)
	t2 = _hours_to_ticks(t2)
	sorted_positions = sorted([h, m, s, t1, t2])
	current_position = sorted_positions.index(t1)
	contest_position = sorted_positions.index(t2)
	diff = abs(current_position - contest_position)
	return diff == 1 or diff == 4

def _hours_to_ticks(h, m=0, s=0):
	return h * 5 % 60 + m / 60 + s / 3600
main()


from sys import stdin, stdout
(h, m, s, t1, t2) = list(map(int, stdin.readline().rstrip().split()))
h += 0.1
m += 0.1
if t1 > t2:
	(t1, t2) = (t2, t1)
betweenCount = 0
if h < t2 and h > t1:
	betweenCount += 1
if m < t2 * 5 and m > t1 * 5:
	betweenCount += 1
if s < t2 * 5 and s > t1 * 5:
	betweenCount += 1
if betweenCount == 3 or betweenCount == 0:
	print('YES')
else:
	print('NO')


(h, m, s, t1, t2) = map(int, input().split())
if h == 12:
	h = 0
h = h * 60 * 60 + m * 60 + s
m = m * 12 * 60 + s
s = s * 12 * 60
if t1 == 12:
	t1 = 0
if t2 == 12:
	t2 = 0
t1 = t1 * 60 * 60
t2 = t2 * 60 * 60
i = t2
once = True
while True:
	if i == h or i == m or i == s:
		break
	i += 1
	if i == 12 * 60 * 60:
		if once:
			i = 0
			once = False
		else:
			break
	if i == t1:
		print('YES')
		exit(0)
i = t1
once = True
while True:
	if i == h or i == m or i == s:
		break
	i += 1
	if i == 12 * 60 * 60:
		if once:
			i = 0
			once = False
		else:
			break
	if i == t2:
		print('YES')
		exit(0)
print('NO')


(h, m, s, t1, t2) = map(int, input().split())
h = (h + m / 60 + s / 3600) % 12
m = (m + s / 60) % 60
h *= 5
t1 *= 5
t2 *= 5
things = sorted([h, m, s])
for i in range(3):
	if things[i] > t1:
		break
if things[2] < t1:
	i = 0
for j in range(3):
	if things[j] > t2:
		break
if things[2] < t2:
	j = 0
if i == j:
	print('YES')
else:
	print('NO')


def inside(a, b, c):
	return a > b and a < c

def outside(a, b, c):
	return a < b or a > c
(h, m, s, t1, t2) = list(map(int, input().split()))
a = h + m / 60 + s / 3600
b = (m + s / 60) / 5
c = s / 5
d = min(t1, t2)
e = max(t1, t2)
f1 = inside(a, d, e) and inside(b, d, e) and inside(c, d, e)
f2 = outside(a, d, e) and outside(b, d, e) and outside(c, d, e)
if f1 or f2:
	print('YES')
else:
	print('NO')


def __starting_point():
	(h, m, s, t1, t2) = [int(x) for x in input().split()]
	hand_angles = [s / 60 * 360, (m + s / 60) / 60 * 360, (h % 12 + m / 60 + s / 3600) / 12 * 360]
	t1_angle = t1 % 12 / 12 * 360
	t2_angle = t2 % 12 / 12 * 360
	if t1_angle > t2_angle:
		(t1_angle, t2_angle) = (t2_angle, t1_angle)
	can_go_clockwise = True
	can_go_counterclockwise = True
	for angle in hand_angles:
		if angle > t1_angle and angle < t2_angle:
			can_go_clockwise = False
		if not (angle >= t1_angle and angle <= t2_angle):
			can_go_counterclockwise = False
	print('YES' if can_go_clockwise or can_go_counterclockwise else 'NO')
__starting_point()


(h, m, s, t1, t2) = map(int, input().split())
a = [(h * 30 + m / 2 + s / 120) % 360, (m * 6 + s / 10) % 360, s * 6, t1 * 30, t2 * 30]
time = sorted(a[:3])
T = sorted(a[3:])
print('YES') if T[1] < time[0] or time[0] < T[0] < T[1] < time[1] or time[1] < T[0] < T[1] < time[2] or (time[2] < T[0]) or (T[0] < time[0] and T[1] > time[2]) else print('NO')


used = [0] * 121
(h, m, s, t1, t2) = map(int, input().split())
h %= 12
t1 %= 12
t2 %= 12
t1 *= 5
t2 *= 5
used[h * 5] = 1
used[h * 5 + 60] = 1
used[m] = 1
used[m + 60] = 1
used[s] = 1
used[s + 60] = 1
if t1 > t2:
	(t1, t2) = (t2, t1)
t3 = t1 + 60
if sum(used[t1:t2]) == 0 or sum(used[t2:t3]) == 0:
	print('YES')
else:
	print('NO')


(h, m, s, t1, t2) = map(int, input().split())
ls = s * 2
lm = m * 2
if ls != 0:
	lm += 1
lh = h % 12 * 10
if ls != 0 or lm != 0:
	lh += 1
t1 = t1 % 12 * 10
t2 = t2 % 12 * 10
(t1, t2) = (min(t1, t2), max(t1, t2))
ans = False
ans1 = True
ans2 = True
if t1 <= ls <= t2 or t1 <= lm <= t2 or t1 <= lh <= t2:
	ans1 = False
if 0 <= ls <= t1 or 0 <= lm <= t1 or 0 <= lh <= t1:
	ans2 = False
if t2 <= ls <= 118 or t2 <= lm <= 118 or t2 <= lh <= 118:
	ans2 = False
if ans1 or ans2:
	ans = True
if ans:
	print('YES')
else:
	print('NO')


(h, m, s, t1, t2) = map(int, input().split())
h += m / 60 + s / 3600
h %= 12
m += s / 60
m %= 60
m /= 5
s /= 5
(t1, t2) = (min(t1, t2), max(t1, t2))
mark = 1
if t1 < h < t2:
	if t1 < m < t2 and t1 < s < t2:
		print('YES')
		mark = 0
elif (m < t1 or m > t2) and (s < t1 or s > t2):
	print('YES')
	mark = 0
if mark:
	print('NO')


def isBet(a, b, c):
	if c > a and c < b:
		return True
	return False
lst = input().split()
h = float(int(lst[0]))
m = float(lst[1]) / 5
s = float(lst[2]) / 5
a = int(lst[3])
b = int(lst[4])
if a > b:
	(a, b) = (b, a)
m += s / 720
h += m / 12
count = 0
if isBet(a, b, h):
	count += 1
if isBet(a, b, m):
	count += 1
if isBet(a, b, s):
	count += 1
if count == 0 or count == 3:
	print('YES')
else:
	print('NO')


a = list(map(int, input().split()))
if a[0] == 12 and (a[1] != 0 or a[2] != 0):
	a[0] = 0
if a[3] == 12:
	a[3] = 0
if a[4] == 12:
	a[4] = 0
t1 = min(a[3], a[4])
t2 = max(a[3], a[4])
a[0] += a[1] / 60 + a[2] / 3600
a[1] = a[1] / 5 + a[2] / 600
a[2] /= 5
a.sort()
ch = 0
if a[0] == t1 and a[4] == t2:
	ch = 1
for i in range(1, 5):
	if a[i] == t2 and a[i - 1] == t1:
		ch = 1
if ch == 1:
	print('YES')
else:
	print('NO')


d = list(map(int, input().split()))
d[0] *= 5
d[3] *= 5
d[4] *= 5
t1 = d[3]
t2 = d[4]
d.sort()
if abs(d.index(t1) - d.index(t2)) == 1 or abs(d.index(t1) - d.index(t2)) == 4:
	print('YES')
else:
	print('NO')


(h, m, s, t1, t2) = map(int, input().split())
m = m / 5
s = s / 5
co = 0
a = min(t1, t2)
b = t1 + t2
t1 = a
t2 = b - a
if t1 <= h and h < t2:
	co += 1
if t1 <= m and m < t2:
	co += 1
if t1 <= s and s < t2:
	co += 1
if co == 0 or co == 3:
	print('YES')
else:
	print('NO')


a = input().split()
times = [int(n) for n in a]
numbers = [(times[0] * 30 + times[1] / 2 + times[2] / 120) % 360, (times[1] * 6 + times[2] / 10) % 360, times[2] * 6 % 360]
numbers.sort(key=float)
t1 = times[3] * 30
t2 = times[4] * 30

def reg(x):
	if numbers[0] < x < numbers[1]:
		return 1
	if numbers[1] < x < numbers[2]:
		return 2
	else:
		return 3
if reg(t1) == reg(t2):
	print('YES')
else:
	print('NO')


from math import fabs as ag
(h, m, s, a, b) = map(int, input().split(' '))
p = [0] * 12
w = [0] * 12
if h < 12:
	p[h] = 1
else:
	p[0] = 1
p[m // 5] = 1
p[s // 5] = 1
a = a % 12
b = b % 12
w[a] = 1
w[b] = 2
ch = 0
for i in range(1, 12):
	if p[(a + i - 1) % 12] == 1:
		break
	elif (a + i) % 12 == b:
		print('YES')
		ch = 1
		break
if ch == 0:
	for i in range(1, 12):
		if p[a - i] == 1:
			break
		elif w[a - i] == 2:
			print('YES')
			ch = 1
			break
if ch == 0:
	print('NO')


def main():
	line = input()
	(hh, mm, ss, t1, t2) = map(int, line.split(' '))
	temp = mm
	mm += ss / 60
	hh += temp / 60
	hh += ss / 60 ** 2
	mm = mm / 5
	ss = ss / 5
	c_space = 0
	if t1 > t2:
		(t1, t2) = (t2, t1)
	if t1 == hh and (mm != 0 or ss != 0):
		c_space += 1
	elif hh > t1 and hh < t2:
		c_space += 1
	if mm > t1 and mm < t2:
		c_space += 1
	if ss > t1 and ss < t2:
		c_space += 1
	if c_space == 0 or c_space == 3:
		print('YES')
	else:
		print('NO')
	return
main()


(h, m, s, t1, t2) = list(map(int, input().split()))
h %= 12
t1 %= 12
t2 %= 12
(t1, t2) = sorted([t1, t2])
m += s / 60
h += m / 60
s = s / 60 * 12
m = m / 60 * 12
if t1 < s < t2 and t1 < m < t2 and (t1 < h < t2) or (not t1 < s < t2 and (not t1 < m < t2) and (not t1 < h < t2)):
	print('YES')
else:
	print('NO')


(h, m, s, t1, t2) = [int(i) for i in input().split(' ')]
if h == 12:
	h = 0
h = h + m / 60 + s / 3600
m = m / 5 + s / 60 / 5
s = s / 5
if t1 == 12:
	t1 = 0
if t2 == 12:
	t2 = 0
rule = sorted([h, m, s])
result = 'NO'
if rule[0] < t1 < rule[1] and rule[0] < t2 < rule[1]:
	result = 'YES'
elif rule[1] < t1 < rule[2] and rule[1] < t2 < rule[2]:
	result = 'YES'
elif (t1 < rule[0] or t1 > rule[2]) and (t2 < rule[0] or t2 > rule[2]):
	result = 'YES'
print(result)


(H, M, S, T1, T2) = map(int, input().split())
h = H % 12 * 30 + M % 60 * 0.5 + S % 60 * (1 / 120)
m = M % 60 * 6 + S % 60 * 0.1
s = S % 60 * 6
t1 = T1 % 12 * 30
t2 = T2 % 12 * 30
(h, m, s) = sorted([h, m, s])
flag = False
if h < t1 < m and h < t2 < m:
	flag = True
elif m < t1 < s and m < t2 < s:
	flag = True
elif (s < t1 <= 360 or 0 <= t1 < h) and (s < t2 <= 360 or 0 <= t2 < h):
	flag = True
if flag:
	print('YES')
else:
	print('NO')


(h, m, s, t1, t2) = input().split()
h = int(h)
m = int(m)
s = int(s)
t1 = int(t1)
t2 = int(t2)
mins = m + s / 60
hrs = h + mins / 60
tmin = min(t1, t2)
tmax = max(t1, t2)
if (tmax > hrs and hrs > tmin) and (tmax * 5 > mins and mins > tmin * 5) and (tmax * 5 > s and s > tmin * 5) or (not (tmax > hrs and hrs > tmin) and (not (tmax * 5 > mins and mins > tmin * 5)) and (not (tmax * 5 > s and s > tmin * 5))):
	print('YES')
else:
	print('NO')


(h, m, s, a, b) = list(map(int, input().split()))
mx = m + s / 60
hx = 5 * h + mx / 60
ax = 5 * a
bx = 5 * b
t = [s, mx, hx]
t.sort()
if t[0] <= ax <= t[1] and t[0] <= bx <= t[1]:
	print('YES')
elif t[1] <= ax <= t[2] and t[1] <= bx <= t[2]:
	print('YES')
elif ax <= t[0] and bx <= t[0]:
	print('YES')
elif ax >= t[2] and bx >= t[2]:
	print('YES')
elif ax >= t[2] and bx <= t[0]:
	print('YES')
elif ax <= t[0] and bx >= t[2]:
	print('YES')
else:
	print('NO')


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, copy, functools
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
eps = 1.0 / 10 ** 15
mod = 10 ** 9 + 7

def LI():
	return [int(x) for x in sys.stdin.readline().split()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def main():
	(h, m, s, t1, t2) = LI()
	h *= 5
	h %= 60
	h += 0.1
	m += 0.1
	s += 0.1
	a = sorted([h, m, s])
	a = [a[-1] - 60] + a
	a.append(a[1] + 60)
	for i in range(4):
		if (a[i] / 5.0 < t1 < a[i + 1] / 5.0 or a[i] / 5.0 < t1 + 12 < a[i + 1] / 5.0) and (a[i] / 5.0 < t2 < a[i + 1] / 5.0 or a[i] / 5.0 < t2 + 12 < a[i + 1] / 5.0):
			return 'YES'
	return 'NO'
print(main())


def dstr(a, b):
	return (b - a) % (12 * 60 * 60)
(h, m, s, t1, t2) = map(int, input().split())
cd = [(h * 60 * 60 + m * 60 + s) % (12 * 60 * 60), m * 12 * 60 + s, s * 12 * 60]
if dstr(cd[0], cd[2]) < dstr(cd[0], cd[1]):
	cd = cd[::-1]
t1 *= 60 * 60
t2 *= 60 * 60
ans = False
for i in range(-1, 2):
	if dstr(cd[i], t1) <= dstr(cd[i], cd[i + 1]) and dstr(cd[i], t2) <= dstr(cd[i], cd[i + 1]):
		ans = True
if len(set(cd)) == 1:
	ans = True
if ans:
	print('YES')
else:
	print('NO')


def ok(h, m, s, t1, t2):
	if s > t1 and t2 > s:
		return 0
	elif m > t1 and t2 > m:
		return 0
	elif h > t1 and t2 > h:
		return 0
	elif s + 1 > t1 and t2 > s + 1:
		return 0
	elif m + 1 > t1 and t2 > m + 1:
		return 0
	elif h + 1 > t1 and t2 > h + 1:
		return 0
	else:
		return 1
(h, m, s, t1, t2) = map(int, input().split())
s /= 60
m = m / 60 + 1 * s / 60
m %= 1
h = h / 12 + 1 * m / 60
h %= 1
t1 /= 12
t2 /= 12
(a, b, c, d) = (t1, t2, t2, t1)
a %= 1
c %= 1
if a > b:
	b += 1
if c > d:
	d += 1
print('YES' if ok(h, m, s, a, b) or ok(h, m, s, c, d) else 'NO')


import collections
(h, m, s, t1, t2) = map(int, input().split())
positions = {}
totalSeconds = h * 360 + m * 60 + s
secondHandDegreesAt = s * 6
minuteHandDegreesAt = m * 6 + 6 / 60 * s
hourHandDegreesAt = h * 30 + (m * 60 + s) * 0.008333
if hourHandDegreesAt >= 360:
	hourHandDegreesAt -= 360
t1DegreesAt = t1 * 30
if t1DegreesAt >= 360:
	t1DegreesAt -= 360
t2DegreesAt = t2 * 30
if t2DegreesAt >= 360:
	t2DegreesAt -= 360
positions[secondHandDegreesAt] = 's'
positions[minuteHandDegreesAt] = 'm'
positions[hourHandDegreesAt] = 'h'
positions[t1DegreesAt] = 't1'
positions[t2DegreesAt] = 't2'
od = collections.OrderedDict(sorted(positions.items()))
values = list(od.values())
if values[0] == 't1' and values[len(values) - 1] == 't2' or (values[0] == 't2' and values[len(values) - 1] == 't1') or 't1t2' in ''.join(values) or ('t2t1' in ''.join(values)):
	print('YES')
else:
	print('NO')


(h, m, s, t1, t2) = list(map(int, input().split()))
h = h % 12 * 60 * 5 + m + s
t1 = t1 % 12 * 60 * 5
t2 = t2 % 12 * 60 * 5
m = m * 60 + s
s = s * 60
list = [(h, 'h'), (m, 'm'), (s, 's'), (t1, 't1'), (t2, 't2')]
l = list[:]
for j in range(4):
	if list[j][1] != 't1' and list[j][1] != 't2' and (list[j][0] == t1) or list[j][0] == t2:
		l.remove(list[j])
l.sort()
list = l[:]
for i in range(len(list)):
	if list[i][1] == 't1':
		if i != len(list) - 1 and i != 0:
			if list[i + 1][1] == 't2' or list[i - 1][1] == 't2':
				print('YES')
			else:
				print('NO')
		elif i == len(list) - 1:
			if list[0][1] == 't2' or list[-2][1] == 't2':
				print('YES')
			else:
				print('NO')
		elif i == 0:
			if list[i + 1][1] == 't2' or list[-1][1] == 't2':
				print('YES')
			else:
				print('NO')


def main():
	(h, m, s, t1, t2) = [int(x) for x in input().split()]
	if h == 12:
		h = 0
	m += s / 60
	h = h * 5 + m / 60
	l = set([h, m, s])
	if t1 == 12:
		t1 = 0
	if t2 == 12:
		t2 = 0
	(t1, t2) = (t1 * 5, t2 * 5)
	l = list(l) + [t1, t2]
	l.sort()
	if abs(l.index(t1) - l.index(t2)) == 1 or abs(l.index(t1) - l.index(t2)) == len(l) - 1:
		print('YES')
	else:
		print('NO')
main()


(h, m, s, t1, t2) = map(int, input().split(' '))
if h == 12:
	h = 0
ha = h + m / 60 + s / 3600
ha *= 30
m += s / 60
ma = m * 6
sa = s * 6
if t1 == 12:
	t1 = 0
if t2 == 12:
	t2 = 0
t1a = t1 * 30
t2a = t2 * 30
a = min(t1a, t2a)
b = max(t1a, t2a)
l = [ha, ma, sa]
ans = 0
for i in range(0, 3):
	if l[i] > a and l[i] < b:
		ans += 1
if ans == 0 or ans == 3:
	print('YES')
else:
	print('NO')


from math import *

def secs(h, m, s):
	return h * 60 * 60 + m * 60 + s

def chop():
	return (int(i) for i in input().split())
(h, m, s, t1, t2) = chop()
sh = (h * 60 * 60 + m * 60 + s) % 43200
sm = (m * 60 + s) * 12 % 43200
ss = s * 720 % 43200
st1 = t1 * 60 * 60 % 43200
st2 = t2 * 60 * 60 % 43200
pr1 = []
(st1, st2) = (min(st1, st2), max(st1, st2))
for i in range(st1, st2 + 1):
	pr1.append(i)
pr2 = []
(st1, st2) = (max(st1, st2), min(st1, st2))
for i in range(st1, 43201):
	pr2.append(i)
for i in range(0, st2 + 1):
	pr2.append(i)
(f1, f2) = (False, False)
if sm in pr1 or ss in pr1 or sh in pr1:
	f1 = True
if sm in pr2 or ss in pr2 or sh in pr2:
	f2 = True
if f1 and f2:
	print('NO')
else:
	print('YES')


def bet(x):
	return t1 <= x <= t2 or t2 <= x + 3600 * 12 <= t1 or t2 <= x <= t1
read = lambda : map(int, input().split())
(h, m, s, t1, t2) = read()
h %= 12
t1 %= 12
t2 %= 12
N = 12 * 3600 + 10
nt = [0] * N
k1 = h * 3600 + 1
k2 = m * 720 + 1
k3 = s * 720
t1 *= 3600
t2 *= 3600
if t1 > t2:
	(t1, t2) = (t2, t1)
ans = 'NO'
flag = 1
if bet(k1) or bet(k2) or bet(k3):
	flag = 0
if flag:
	ans = 'YES'
flag = 1
t1 += 12 * 3600
if bet(k1) or bet(k2) or bet(k3):
	flag = 0
if flag:
	ans = 'YES'
print(ans)


(h, m, s, t1, t2) = map(int, input().split())
p = [0] * 12
p[(h + 1) % 12] = 1
p[(m // 5 + 1) % 12] = 1
p[(s // 5 + 1) % 12] = 1
q = [0] * 12
if m == s == 0:
	q[(h - 1) % 12] = 1
else:
	q[h % 12] = 1
if m % 5 == 0 and s == 0:
	q[(m // 5 - 1) % 12] = 1
else:
	q[m // 5 % 12] = 1
if s % 5 == 0:
	q[(s // 5 - 1) % 12] = 1
else:
	q[s // 5 % 12] = 1
i = t1 % 12
t2 = t2 % 12
d = True
while i != t2:
	i = (i + 1) % 12
	if p[i] == 1:
		i = t1 % 12
		while i != t2:
			i = (i + 11) % 12
			if q[i] == 1:
				d = False
				print('NO')
				break
		break
if d:
	print('YES')


(h, m, s, t1, t2) = list(map(int, input().split()))
h = h + m / 60 + s / 3600
m = m + s / 60
m = m * 12 / 60
s = s * 12 / 60
if t1 > t2:
	t3 = t1
	t1 = t2
	t2 = t3
numb = 0
if t1 < h < t2:
	numb += 1
if t1 < m < t2:
	numb += 1
if t1 < s < t2:
	numb += 1
if numb == 0 or numb == 3:
	print('YES')
else:
	print('NO')


(h, m, s, t1, t2) = [int(x) for x in input().split(' ')]
m += s / 60
h += m / 60
m /= 5
s /= 5
iarr = [('h', h % 12), ('m', m % 12), ('s', s % 12), ('t1', t1 % 12), ('t2', t2 % 12)]
arr = [('t1', t1 % 12), ('t2', t2 % 12)]
for idx in range(3):
	if not (iarr[idx][1] == iarr[-2][1] or iarr[idx][1] == iarr[-1][1]):
		arr.append(iarr[idx])
arr.sort(key=lambda x: x[1])
found = False
for idx in range(len(arr)):
	if arr[idx][0][0] == arr[(idx + 1) % len(arr)][0][0]:
		print('YES')
		found = True
		break
if not found:
	print('NO')


(h, m, s, t1, t2) = map(int, input().split())
k = min(t1, t2)
t = max(t1, t2)
l = 0
if s >= k * 5 and s < t * 5:
	l += 1
if m >= k * 5 and m < t * 5:
	l += 1
if h >= k and h < t:
	l += 1
if l > 0 and l < 3:
	print('NO')
else:
	print('YES')


(a, b, c, d, e) = map(int, input().split())
if a == 0:
	a = 12
if b == 0:
	b = 60
if c == 0:
	c = 60
a = a * 5
d *= 5
e *= 5
t = 1
t2 = False
while True:
	if t > 60:
		t = t % 60
	if t == d:
		t2 = True
	if t2:
		if t == e:
			break
		if t == a or t == b or t == c:
			t2 = False
			break
	t += 1
t = 1
t3 = False
while True:
	if t > 60:
		t = t % 60
	if t == e:
		t3 = True
	if t3:
		if t == d:
			break
		if t == a or t == b or t == c:
			t3 = False
			break
	t += 1
if t2 or t3:
	print('YES')
else:
	print('NO')


(h, m, s, a, b) = list(map(int, input().split()))
m += s / 60
h += m / 60
m /= 5
s /= 5
c = [h, m, s, a, b]
c = c + list([x + 12 for x in c])
c = sorted(c)
p = c.index(a)
for x in [p - 1, p + 1]:
	for y in [b, b + 12]:
		if c[x] == y:
			print('YES')
			return
print('NO')


def main():
	hands = [int(i) for i in input().split()]
	hands[0] *= 5
	hands[3] *= 5
	hands[4] *= 5
	for i in range(5):
		if hands[i] >= 60:
			hands[i] -= 60
	hands[1] += hands[2] / 60
	hands[0] += hands[1] / 60
	(t1, t2) = hands[3:]
	hands = hands[:3]
	if t1 > t2:
		(t1, t2) = (t2, t1)
	ans1 = True
	ans2 = True
	for t in hands:
		if t > t1 and t < t2:
			ans1 = False
		if t > t2 and t < 60 or (t >= 0 and t < t1):
			ans2 = False
	if ans1 or ans2:
		print('YES')
	else:
		print('NO')

def __starting_point():
	main()
__starting_point()


def zero_based(hour):
	return hour if hour < 12 else 0
(h, m, s, t1, t2) = map(int, input().split())
(t1, t2) = sorted([t1, t2])
h *= 5
t1 *= 5
t2 *= 5
can_reach = False
if s > 0:
	m += 0.5
if m > 0:
	h += 0.5
if t2 > h and h > t1:
	can_reach = t2 > m and m > t1 and (t2 > s) and (s > t1)
else:
	can_reach = not (t2 > m and m > t1) and (not (t2 > s and s > t1))
print('YES' if can_reach else 'NO')


(h, m, s, t1, t2) = map(int, input().split())
m //= 5
s //= 5
a = [h, m, s, h + 12, m + 12, s + 12]
up = 1
dw = 1
if t1 > t2:
	(t1, t2) = (t2, t1)
t1u = t1 + 12
for i in a:
	if t1 <= i and i < t2:
		up = 0
	if t2 <= i and i < t1u:
		dw = 0
if dw + up == 0:
	print('NO')
else:
	print('YES')


(h, m, s, t1, t2) = map(int, input().split())
h %= 12
t1 %= 12
t2 %= 12
t1 = 3600 * t1
t2 = 3600 * t2
h = 3600 * h + 60 * m + s
m = 720 * m + 12 * s
s = 720 * s
h %= 43200
m %= 43200
s %= 43200
obstacles = [h, m, s]
a = [t1, t2]
(t1, t2) = (min(a), max(a))
canGoForward = True
canGoBack = True
for o in obstacles:
	if t1 < o and o < t2:
		canGoForward = False
	else:
		canGoBack = False
can = canGoBack or canGoForward
print({True: 'Yes', False: 'No'}[can])


(h, m, s, x, y) = map(int, input().split())
h = h + m / 60 + s / 3600
m = m / 5
s = s / 5
l = [h, m, s, x, y]
l.sort()
z = abs(l.index(x) - l.index(y))
if z == 1 or z == 4:
	print('YES')
else:
	print('NO')


(h, m, s, t1, t2) = map(int, input().split())
h *= 5
t1 *= 5
t2 *= 5
s %= 60
m %= 60
h %= 60
t1 %= 60
t2 %= 60
m += s / 60
h += m / 60 * 5
a = min(t1, t2)
b = max(t1, t2)
ct = 0
ov = 0
if a <= h and h <= b:
	if a == h or h == b:
		ov += 1
	ct += 1
if a <= m and m <= b:
	if a == m or m == b:
		ov += 1
	ct += 1
if a <= s and s <= b:
	if a == s or s == b:
		ov += 1
	ct += 1
if ct % 3 == 0 or ct == ov:
	print('YES')
else:
	print('NO')


import sys
(h, m, s, a, b) = map(int, input().split())
if h == 12:
	h = 0
b1 = 6 * s
b2 = 6 * m + s / 10
b3 = h * 30 + m / 2 + s / 120
a = 30 * a
b = 30 * b
arr = [(b1, 0), (b2, 0), (b3, 0), (a, 1), (b, 1)]
arr.sort()
if arr[0][1] == 1 and arr[-1][1] == 1:
	print('YES')
	sys.exit()
for i in range(4):
	if arr[i][1] == 1 and arr[i + 1][1] == 1:
		print('YES')
		sys.exit()
print('NO')


import math

def func(a):
	(h, m, s, x, y) = a
	m = m // 5
	s = s // 5
	b = [h, m, s]
	b.sort()
	(r1, r2) = (0, 0)
	if x in range(b[0] + 1, b[1] + 1):
		r1 = 1
	elif x in range(b[1] + 1, b[2] + 1):
		r1 = 2
	else:
		r1 = 3
	if y in range(b[0] + 1, b[1] + 1):
		r2 = 1
	elif y in range(b[1] + 1, b[2] + 1):
		r2 = 2
	else:
		r2 = 3
	if r1 == r2:
		return 'YES'
	return 'NO'
for _ in range(1):
	a = list(map(int, input().split()))
	print(func(a))


(h, m, s, t1, t2) = map(int, input().split())
a = [0] * 43200
a[(h * 3600 + 60 * m + s) % 43200] = 1
a[(m * 720 + 12 * s) % 43200] = 1
a[s * 720 % 43200] = 1
a[t2 * 3600 % 43200] = 2
possible = False
for i in range(t1 * 3600, t1 * 3600 + 43200):
	if a[i % 43200] == 1:
		break
	elif a[i % 43200] == 2:
		possible = True
		break
for i in range(t1 * 3600, t1 * 3600 - 43200, -1):
	if a[i % 43200] == 1:
		break
	elif a[i % 43200] == 2:
		possible = True
		break
if possible:
	print('Yes')
else:
	print('No')


from math import sqrt
import heapq

def main():
	(h, m, s, t1, t2) = [int(x) for x in input().split(' ')]
	hdeg = (h * 30 + m / 60 * 30 + s / 3600 * 30) % 360
	mdeg = (m * 6 + s / 60 * 6) % 360
	sdeg = s * 6 % 360
	start = t1 * 30 % 360
	end = t2 * 30 % 360
	if end < start:
		(start, end) = (end, start)
	if hdeg > end or mdeg > end or sdeg > end:
		pass
	elif hdeg < start or mdeg < start or sdeg < start:
		pass
	else:
		print('YES')
		return
	if start < hdeg < end or start < mdeg < end or start < sdeg < end:
		pass
	else:
		print('YES')
		return
	print('NO')
main()


def check1(h):
	global t1, t2
	if h == t1 or h == t2:
		return -1
	if h > min(t1, t2) and h < max(t1, t2):
		return 1
	else:
		return 0

def check2(m):
	if m == 5 * t1 or m == 5 * t2:
		return -1
	if m > 5 * min(t1, t2) and m < 5 * max(t1, t2):
		return 1
	else:
		return 0
(h, m, s, t1, t2) = list(map(int, input().split()))
if m != 0 or s != 0:
	h += 0.5
if s != 0:
	m += 0.5
if h > 12:
	h -= 12
l = [check1(h), check2(m), check2(s)]
for i in range(len(l) - 1, -1, -1):
	if l[i] == -1:
		l.pop(i)
flag = 0
for val in l:
	if val != l[0]:
		flag = 1
		break
if flag:
	print('NO')
else:
	print('YES')


(h, m, s, t1, t2) = [int(i) for i in input().split()]
blockers = []
if m == 0 and s == 0:
	blockers.append(h)
else:
	blockers.append(h + 0.1)
if s == 0:
	if m == 0:
		blockers.append(12)
	elif m < 5:
		blockers.append(12.1)
	else:
		blockers.append(m / 5.0)
elif m == 0:
	blockers.append(12.1)
elif m < 5:
	blockers.append(12.1)
elif m % 5 == 0:
	blockers.append(m / 5.0 + 0.1)
else:
	blockers.append(m / 5.0)
if s == 0:
	blockers.append(12)
elif s < 5:
	blockers.append(12.1)
else:
	blockers.append(s / 5.0)
mint = min(t1, t2)
maxt = max(t1, t2)
flag = 1
count = 0
for i in range(3):
	if blockers[i] > mint and blockers[i] < maxt:
		flag = 0
		count = count + 1
if flag == 1 or count == 3:
	print('YES')
else:
	print('NO')


(h, m, s, t1, t2) = map(int, input().split())
h = h * 5 % 60
t1 = t1 * 5 % 60
t2 = t2 * 5 % 60
if h <= m <= s:
	if t1 > s and t2 > s:
		print('YES')
	elif t1 <= h and t2 <= h:
		print('YES')
	elif t1 <= h and t2 > s:
		print('YES')
	elif t1 > s and t2 <= h:
		print('YES')
	elif h < t1 <= m and h < t2 <= m:
		print('YES')
	elif m < t1 <= s and m < t2 <= s:
		print('YES')
	else:
		print('NO')
elif h <= s <= m:
	if t1 > m and t2 > m:
		print('YES')
	elif t1 <= h and t2 <= h:
		print('YES')
	elif t1 <= h and t2 > m:
		print('YES')
	elif t1 > m and t2 <= h:
		print('YES')
	elif h < t1 <= s and h < t2 <= s:
		print('YES')
	elif s < t1 <= m and s < t2 <= m:
		print('YES')
	else:
		print('NO')
elif m <= h <= s:
	if t1 > s and t2 > s:
		print('YES')
	elif t1 <= m and t2 <= m:
		print('YES')
	elif t1 <= m and t2 > s:
		print('YES')
	elif t1 > s and t2 <= m:
		print('YES')
	elif m < t1 <= h and m < t2 <= h:
		print('YES')
	elif h < t1 <= s and h < t2 <= s:
		print('YES')
	else:
		print('NO')
elif m <= s <= h:
	if t1 > h and t2 > h:
		print('YES')
	elif t1 <= m and t2 <= m:
		print('YES')
	elif t1 <= m and t2 > h:
		print('YES')
	elif t1 > h and t2 <= m:
		print('YES')
	elif m < t1 <= s and m < t2 <= s:
		print('YES')
	elif s < t1 <= h and s < t2 <= h:
		print('YES')
	else:
		print('NO')
elif s <= h <= m:
	if t1 > m and t2 > m:
		print('YES')
	elif t1 <= s and t2 <= s:
		print('YES')
	elif t1 <= s and t2 > m:
		print('YES')
	elif t1 > m and t2 <= s:
		print('YES')
	elif s < t1 <= h and s < t2 <= h:
		print('YES')
	elif h < t1 <= m and h < t2 <= m:
		print('YES')
	else:
		print('NO')
elif s <= m <= h:
	if t1 > h and t2 > h:
		print('YES')
	elif t1 < s and t2 < s:
		print('YES')
	elif t1 <= s and t2 > h:
		print('YES')
	elif t1 > h and t2 <= s:
		print('YES')
	elif s < t1 <= m and s < t2 <= m:
		print('YES')
	elif m < t1 <= h and m < t2 <= h:
		print('YES')
	else:
		print('NO')


def fun(s, e, m):
	return m > s and e > m
(h, m, s, t1, t2) = [int(i) for i in input().split()]
hp = h + (m * 60 + s) / 3600
mp = m / 5 + s / 300
sp = s / 5
if t1 > t2:
	(t1, t2) = (t2, t1)
if fun(t1, t2, hp) and fun(t1, t2, mp) and fun(t1, t2, sp) or not (fun(t1, t2, hp) or fun(t1, t2, mp) or fun(t1, t2, sp)):
	print('yes')
else:
	print('no')


import sys
input = sys.stdin.readline

def prog():
	(h, m, s, t1, t2) = map(int, input().split())
	marked = [0] * 3600 * 12
	h = h % 12
	t1 = t1 % 12
	t2 = t2 % 12
	marked[3600 * h + 60 * m + s] = 1
	marked[720 * m + 12 * s] = 1
	marked[720 * s] = 1
	(t1, t2) = (min(t1, t2), max(t1, t2))
	t1 *= 3600
	t2 *= 3600
	fail = False
	for i in range(t1 + 1, t2):
		if marked[i]:
			fail = True
	if not fail:
		print('YES')
	else:
		fail = False
		for i in range(3600 * 12 - 1, t2, -1):
			if marked[i]:
				fail = True
		for i in range(t1):
			if marked[i]:
				fail = True
		if not fail:
			print('YES')
		else:
			print('NO')
prog()


def main():
	(m1, m2, m3, t1, t2) = tuple(map(int, input().split()))
	t1 *= 3600
	c = 3600 * 12
	t2 = t2 * 3600 % c
	l = [m1 * 3600 % c, m2 * 3600 / 5 % c, m3 * 3600 / 5]

	def ans(p):
		last = 100000000
		if t1 % c in l and p == 1:
			return False
		for i in range(c):
			cc = (t1 + i * p) % c
			if last in l or last - c in l:
				return False
			if cc == t2:
				if t2 in l:
					return p == 1
				return True
			if i > 1:
				last = cc - p
	return 'YES' if ans(1) or ans(-1) else 'NO'
print(main())


def solve():
	(hour, minute, second, t1, t2) = [int(st) for st in input().split(' ')]
	angle_hour = 360 * (hour + minute / 60 + second / 3600) / 12
	angle_minute = 360 * (minute + second / 60) / 60
	angle_second = 360 * second / 60
	angle_t1 = 360 * t1 / 12
	angle_t2 = 360 * t2 / 12
	if angle_hour > 360:
		angle_hour -= 360
	if angle_minute > 360:
		angle_minute -= 360
	anglelist = [angle_hour, angle_minute, angle_second]
	if angle_t1 > angle_t2:
		(angle_t1, angle_t2) = (angle_t2, angle_t1)
	(statusT12, statusT21) = (True, True)
	for angle in anglelist:
		if angle_t1 < angle and angle < angle_t2:
			statusT12 = False
		if angle_t2 < angle or angle_t1 > angle:
			statusT21 = False
	ans = {True: 'YES', False: 'NO'}
	return ans[statusT12 or statusT21]
print(solve())


import math, copy
from collections import defaultdict, Counter
from itertools import permutations

def fact(n):
	return 1 if n == 1 or n == 0 else n * fact(n - 1)

def prime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def inp():
	l = list(map(int, input().split()))
	return l

def main():
	(h, m, s, t1, t2) = inp()
	t1 = t1 % 12
	t2 = t2 % 12
	p = s / 60 * 12 % 12
	q = (m / 60 + s / 3600) * 12 % 12
	r = (h + (m / 60 + s / 3600)) % 12
	l = [p, q, r]
	l.sort()
	c = False
	for i in range(t1, 100):
		ii = i % 12
		if ii == t2:
			c = True
			break
		if ii <= l[0] <= ii + 1 or ii <= l[1] <= ii + 1 or ii <= l[2] <= ii + 1:
			break
	for i in range(t2, 100):
		ii = i % 12
		if ii == t1:
			c = True
			break
		if ii <= l[0] <= ii + 1 or ii <= l[1] <= ii + 1 or ii <= l[2] <= ii + 1:
			break
	if c:
		print('YES')
	else:
		print('NO')
import os, sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()

def random():
	rating = 100
	rating = rating * 100
	rating = rating * 100
	print(rating)

def random():
	rating = 100
	rating = rating * 100
	rating = rating * 100
	print(rating)

def random():
	rating = 100
	rating = rating * 100
	rating = rating * 100
	print(rating)

def random():
	rating = 100
	rating = rating * 100
	rating = rating * 100
	print(rating)


(h, m, s, a, b) = map(int, input().split())
(x, y, z) = sorted([h + m / 60 + s / 3600, m / 5 + s / 300, s / 5])
if a > b:
	(a, b) = (b, a)
d = (x < a) * (b < y) + (y < a) * (b < z) + (b > z) * (a < x) + (b < x) + (a > z)
print('YES' if d else 'NO')


import sys
(h, m, s, t1, t2) = map(lambda x: int(x), sys.stdin.read().split())
h = h if h != 12 else 0
m == m if m != 60 else 0
t1 = t1 if t1 != 12 else 0
t2 = t2 if t2 != 12 else 0
ha = 30 * h + 0.5 * m + s / 120
ma = 6 * m + 0.1 * s
sa = 6 * s
t1a = 30 * t1
t2a = 30 * t2
tmin = min(t1a, t2a)
tmax = max(t1a, t2a)
result = False
if all((tmin < x < tmax for x in (ha, ma, sa))):
	result = True
elif all((x < tmin or x > tmax for x in (ha, ma, sa))):
	result = True
if result:
	print('YES')
else:
	print('NO')


(h, m, s, t1, t2) = tuple(map(int, input().split()))
t2 = t2 % 12 * 5
t1 = t1 % 12 * 5
s = float(s)
m = float(m + s / 60)
h = float(h % 12 * 5 + m / 12)

def dt(u, v):
	if v < u:
		return 60 - u + v
	return v - u

def check(t1, t2, h, m, s):
	d = dt(t1, t2)
	return d < dt(t1, h) and d < dt(t1, m) and (d < dt(t1, s))
r = check(t1, t2, h, m, s) or check(t2, t1, h, m, s)
print('YES' if r else 'NO')


(h, m, s, t1, t2) = map(int, input().split())
t = [t1, t2]
hms = [h, m / 5, s / 5]
ans = [[0, 0] for i in range(3)]
for i in range(2):
	for j in range(3):
		ans[j][i] = t[i] > hms[j]
ans2 = [(ans[i][0] + ans[i][1]) % 2 for i in range(3)]
if sum(ans2) == 3 or sum(ans2) == 0:
	print('YES')
else:
	print('NO')


import math
import collections
import bisect
import heapq
import time
import random
(H, M, S, t1, t2) = map(int, input().split())
h = H % 12 * 60 * 60 + M * 60 + S
m = M * 12 * 60 + S * 12
s = S * 12 * 60
t1 = t1 % 12 * 3600
t2 = t2 % 12 * 3600
if t1 > t2:
	(t1, t2) = (t2, t1)
if not (t1 < h < t2 or t1 < m < t2 or t1 < s < t2):
	print('YES')
	exit(0)
if not ((t2 < h or h < t1) or (t2 < m or m < t1) or (t2 < s or s < t1)):
	print('YES')
	exit(0)
print('NO')


(h, m, s, t1, t2) = map(int, input().split())
h = h % 12
t1 = t1 % 12
t2 = t2 % 12
h = h / 12 * 60 + (m * 60 + s) / 3600
t1 = t1 / 12 * 60
t2 = t2 / 12 * 60
m = m + s / 60
l = sorted([(h, 0), (m, 1), (s, 2), (t1, 3), (t2, 4)])
i1 = -1
i2 = -1
for (i, t) in enumerate(l):
	if t[1] == 3:
		i1 = i
	elif t[1] == 4:
		i2 = i
lo = min(i1, i2)
hi = max(i1, i2)
fail = False
for i in range(lo + 1, hi):
	if l[i][0] != l[lo][0] and l[i][0] != l[hi][0]:
		fail = True
p = False
if not fail:
	print('Yes')
	p = True
fail = False
for ii in range(hi + 1, lo + len(l)):
	i = ii % len(l)
	if l[i][0] != l[lo][0] and l[i][0] != l[hi][0]:
		fail = True
if not p:
	print('No' if fail else 'Yes')


import sys

def ReadInput():
	return sys.stdin.read().splitlines()

def Check(start, end, block, step):
	while start != end:
		start += step
		if start < 0:
			start += 24
		if start >= 24:
			start -= 24
		if start in block:
			return False
	return True

def main():
	input = ReadInput()
	[h, m, s, t1, t2] = [int(x) for x in input[0].split(' ')]
	h = h * 2 + 1
	h %= 24
	m = m // 5 * 2 + 1
	m %= 24
	s = s // 5 * 2 + 1
	s %= 24
	t1 = t1 * 2
	t1 %= 24
	t2 = t2 * 2
	t2 %= 24
	start = min(t1, t2)
	end = max(t1, t2)
	if Check(start, end, [h, m, s], 1) or Check(start, end, [h, m, s], -1):
		print('YES')
		return
	print('NO')
main()


(h, m, s, t1, t2) = map(int, input().split())
a = s / 60
b = (m + a) / 60
c = (h + b) / 12
t1 /= 12
t2 /= 12
d = [a, b, c, t1, t2]
d.sort()
if d.index(t1) == 0 and (d.index(t2) == 4 or d.index(t2) == 1) or (d.index(t1) == 1 and (d.index(t2) == 2 or d.index(t2) == 0)) or (d.index(t1) == 2 and (d.index(t2) == 3 or d.index(t2) == 1)) or (d.index(t1) == 3 and (d.index(t2) == 4 or d.index(t2) == 2)) or (d.index(t1) == 4 and (d.index(t2) == 3 or d.index(t2) == 0)):
	print('YES')
else:
	print('NO')


(h, m, s, t1, t2) = list(map(int, input().split()))
if h == 12:
	h = 0

def cmp(ang1, ang2):
	pass
a1 = t1 * 30
a2 = t2 * 30
asec = s * 6
if asec >= min(a1, a2) and asec <= max(a1, a2):
	secsit = 'Mid'
else:
	secsit = 'notMid'
amin = m * 6 + s / 10
if amin >= min(a1, a2) and amin <= max(a1, a2):
	minsit = 'Mid'
else:
	minsit = 'notMid'
ahour = h * 30 + m / 2 + s / 120
if ahour >= min(a1, a2) and ahour <= max(a1, a2):
	hoursit = 'Mid'
else:
	hoursit = 'notMid'
if hoursit == secsit == minsit:
	print('YES')
else:
	print('No')


(h, m, s, t1, t2) = [int(z) for z in input().split()]
if h == 12:
	h = 0
adds = s / 60
s = adds * 12
addm = (m + adds) / 60
m = addm * 12
h += addm
if h <= m <= s:
	if h < t1 < m and h < t2 < m:
		print('YES')
		exit(0)
	if m < t1 < s and m < t2 < s:
		print('YES')
		exit(0)
	if (s < t1 <= 12 or 1 <= t1 < h) and (s < t2 <= 12 or 1 <= t2 < h):
		print('YES')
		exit(0)
elif h <= s <= m:
	if h < t1 < s and h < t2 < s:
		print('YES')
		exit(0)
	if s < t1 < m and s < t2 < m:
		print('YES')
		exit(0)
	if (m < t1 <= 12 or 1 <= t1 < h) and (m < t2 <= 12 or 1 <= t2 < h):
		print('YES')
		exit(0)
elif m <= h <= s:
	if m < t1 < h and m < t2 < h:
		print('YES')
		exit(0)
	if h < t1 < s and h < t2 < s:
		print('YES')
		exit(0)
	if (s < t1 <= 12 or 1 <= t1 < m) and (s < t2 <= 12 or 1 <= t2 < m):
		print('YES')
		exit(0)
elif s <= h <= m:
	if s < t1 < h and s < t2 < h:
		print('YES')
		exit(0)
	if h < t1 < m and h < t2 < m:
		print('YES')
		exit(0)
	if (m < t1 <= 12 or 1 <= t1 < s) and (m < t2 <= 12 or 1 <= t2 < s):
		print('YES')
		exit(0)
elif s <= m <= h:
	if s < t1 < m and s < t2 < m:
		print('YES')
		exit(0)
	if m < t1 < h and m < t2 < h:
		print('YES')
		exit(0)
	if (h < t1 <= 12 or 1 <= t1 < s) and (h < t2 <= 12 or 1 <= t2 < s):
		print('YES')
		exit(0)
elif m <= s <= h:
	if m < t1 < s and m < t2 < s:
		print('YES')
		exit(0)
	if s < t1 < h and s < t2 < h:
		print('YES')
		exit(0)
	if (h < t1 <= 12 or 1 <= t1 < m) and (h < t2 <= 12 or 1 <= t2 < m):
		print('YES')
		exit(0)
print('NO')


import sys
read = sys.stdin.readline

def solve(h, m, s, t1, t2):
	h = (h % 12 + m / 60 + s / 3600) * 5
	m = m + s / 60
	t1 = t1 % 12 * 5
	t2 = t2 % 12 * 5
	a = min(t1, t2)
	b = max(t1, t2)
	h_inner = a < h and h < b
	m_inner = a < m and m < b
	s_inner = a < s and s < b
	if h_inner and m_inner and s_inner:
		return 'YES'
	if not h_inner and (not m_inner) and (not s_inner):
		return 'YES'
	return 'NO'

def run():
	(h, m, s, t1, t2) = list(map(int, read().replace('\n', '').split()))
	print(solve(h, m, s, t1, t2))
run()


x = [int(i) for i in input().split()]
s = x[0] * 60 * 60 + x[1] * 60 + x[2]
h = x[0] * 360 // 12 % 360 + 30 / 60 * x[1] + 0.5 / 60 * x[2]
m = x[1] * 360 // 60 % 360 + 6 / 60 * x[2]
s = x[2] * 360 // 60 % 360
t1 = x[3] * 360 // 12 % 360
t2 = x[4] * 360 // 12 % 360
if t2 < t1:
	(t1, t2) = (t2, t1)
y = set()
y.add(h)
y.add(m)
y.add(s)
y = sorted(list(y))
answ = 'NO'
for i in range(1, len(y)):
	if t1 >= y[i - 1] and t1 <= y[i] and (t2 >= y[i - 1]) and (t2 <= y[i]) or (t1 >= y[i - 1] and t2 >= y[i - 1] and (t1 < y[i]) and (t2 <= y[i])):
		answ = 'YES'
		break
if y[0] >= t1 and y[len(y) - 1] <= t2 or (y[0] >= t1 and y[0] >= t2) or (y[len(y) - 1] <= t1 and y[len(y) - 1] <= t2):
	answ = 'YES'
print(answ)


def clc(a, b, c):
	if min(a, c) == c and a != c or (min(b, c) == b or b == c):
		return 0
	else:
		return 1
(h, m, s, t1, t2) = map(int, input().split())
h = 5 * h % 60
t1 = 5 * t1 % 60
t2 = 5 * t2 % 60
(t1, t2) = (min(t1, t2), max(t1, t2))
if clc(t1, t2, h) == clc(t1, t2, m) and clc(t1, t2, m) == clc(t1, t2, s):
	print('YES')
else:
	print('NO')


def main():
	(h, m, s, t1, t2) = map(int, input().split())
	m = (m + s / 60) / 5
	s = s / 5
	h = h + m / 60
	times = [h, m, s]
	times.sort()
	if times[0] < t1 < times[1] and times[0] < t2 < times[1] or (times[1] < t1 < times[2] and times[1] < t2 < times[2]) or ((times[2] < t1 <= 12 or times[2] < t2 <= 12) and (0 <= t1 < times[0] or 0 <= t2 < times[0])) or (times[2] < t2 <= 12 and times[2] < t1 <= 12 or (0 <= t1 < times[0] and 0 <= t2 < times[0])):
		print('YES')
	else:
		print('NO')
main()


from sys import stdin
(h, m, s, t1, t2) = [int(i) for i in stdin.readline().split(' ')]
borders = sorted([5 * h, m, s])
bool1a = 5 * t1 <= borders[0] or borders[2] < 5 * t1
bool1b = 5 * t2 <= borders[0] or borders[2] < 5 * t2
bool2a = borders[0] < 5 * t1 and 5 * t1 <= borders[1]
bool2b = borders[0] < 5 * t2 and 5 * t2 <= borders[1]
bool3a = borders[1] < 5 * t1 and 5 * t1 <= borders[2]
bool3b = borders[1] < 5 * t2 and 5 * t2 <= borders[2]
if (bool1a and bool1b or (bool2a and bool2b)) or (bool3a and bool3b):
	print('YES')
else:
	print('NO')


(h, m, s, t1, t2) = map(int, input().split())
splits = [False] * 12
m = m // 5
s = s // 5
splits[h % 12] = True
splits[m % 12] = True
splits[s % 12] = True
start = t1 % 12
end = t2 % 12
if start > end:
	a = splits[start:] + splits[:end]
	b = splits[end:start]
else:
	a = splits[:start] + splits[end:]
	b = splits[start:end]
if True in a and True in b:
	print('NO')
else:
	print('YES')