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$

Difficulty: competition

Starter code:

Solutions:
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 = 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')


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 = [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)


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 = 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")


3

def dstr(a, b):
    return (b - a) % (12 * 60 * 60)

h, m, s, t1, t2 = list(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 __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

	# try going clockwise (from t1 to t2)
	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,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 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 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())

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")

def check1(h):
	nonlocal 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")


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")
else:
	if 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")

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()

h,m,s,t1,t2 = list(map(int, input().split()))
m += s/60
h += m/60
h %= 12
t1, t2 = min(t1,t2), max(t1, t2)
if ((t1 <= h <= t2) and (t1 <= m/5 <= t2) and (t1 <= s/5 <= t2)) or \
    (not (t1 <= h <= t2) and not (t1 <= m/5 <= t2) and not (t1 <= s/5 <= t2)):
    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 = list(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')
    


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]
    # print(hands, t1, t2)
    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
    # print(ans1, ans2)
    if ans1 or ans2:
        print("YES")
    else:
        print("NO")

def __starting_point():
    main()
__starting_point()

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')


h,m,s,t1,t2 = list(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

#print(h,m,s,t1,t2)

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")
		return
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")
		return

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')


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
#print(ans1)
if 0 <= ls <= t1 or 0 <= lm <= t1 or 0 <= lh <= t1:
    ans2 = False
#print(ans2)
if t2 <= ls <= 118 or t2 <= lm <= 118 or t2 <= lh <= 118:
    ans2 = False
#print(ans2)
if ans1 or ans2:
    ans = True
if ans:
    print('YES')
else:
    print('NO')