Chef is stuck on the minute hand of a giant clock. To escape from this clock he needs to get onto the hour hand which has an exit door. 
Since the minute hand and and hour hand are not connected at any point, chef will surely need to make a jump. Since he wants minimum risks, he chooses to jump on the hour hand so that the angle he has to cover is minimum possible.
You will be given a clock time in $UTC$ format denoting time of chef's jump and you have to compute the minimum angle that chef needs to cover while completing the jump.
For some reason chef times his jump only when the number of minutes is a multiple of 5.

-----Input:-----
The first line of the input contains a single integer $T$ denoting the number of test cases. The description of  $T$ test cases follows.
The first line of each test case contains a string denoting time in UTC format (e.g. 10:20 i.e. 10 hours and 20 minutes)

-----Output-----
For each test case, print a single line denoting the smallest angle of jump.

-----Constraints-----
- $1 \leq T \leq 10^3$
- $0 \leq hours \leq 23$
- $0 \leq minutes \leq 59$

-----Example Input-----
3
14:20
02:10
09:30

-----Example Output-----
50 degree 
5 degree  
105 degree

-----Explanation-----
- In the second case, once the hour hand reaches 2 it starts moving towards 3 with the passing of every minute, hence when the minute hand points 10 minutes, the hour hand has already covered some angle towards 3. 
In this scenario the two angles made by hour and minute hand are 355 and 5 degrees. Since chef will jump on the side with minimum angle, he chooses the one with 5-degree angle.

Starter code:

Solutions:
# cook your dish here
t=int(input())
while t>0:
 a=input().split(":")
 a1=int(a[0])
 a2=int(a[1])
 b1=a1%12 
 if a2%5!=0:
  b2=(a2//5)*5+5
 else:
  b2=a2
 
 c1=b1*30 
 
 extra=0.5*b2 
 c1+=extra
 c1%=360

 d1=(b2//5)*30 
 d1%=360 
 
 if c1>d1:
  ans1=c1-d1 
  ans2=360-ans1
 else:
  ans1=d1-c1
  ans2=360-ans1
 ans=min(ans1,ans2)
 if ans==int(ans):
  ans3=int(ans)
  y=str(ans3)+" degree"
  print(y)
 else:
  y=str(ans)+" degree"
  print(y)
 
 t-=1
 
  


# cook your dish here
T=int(input())
for _ in range(T):
 s=input()
 h,m=int(s[:2]),int(s[3:])
 if h>12:
  h-=12
 if h==12:
  h=0
 if m==60:
  m=0
  h+=1
  if h>12:
   h-=12
 hour_angle=0.5*(h*60+m)
 minute_angle=6*m
 angle=abs(hour_angle - minute_angle)
 angle=min(360 - angle, angle)
 my_st=str(angle)
 if my_st[-1]=='0':
  print(int(angle),'degree')
 else:
  print(angle,'degree')

for t in range(int(input())):
 a=input().split(":")
 hr,min=int(a[0]),int(a[1])
 if hr>=12:
  hr-=12
 m_angle=int(min/5)*30
 h_angle=hr*30+min/2
 if h_angle-int(h_angle)==0:
  h_angle=int(h_angle)
 if abs(m_angle-h_angle)<=180:
  print(abs(m_angle-h_angle),"degree")
 else:
  print(360-abs(m_angle-h_angle),"degree")

# cook your dish here
import math 
t = int(input())
for i in range(t):
 h,m = input().split(':')
 h_pos = int(h)*30
 if int(h)>=12:
  h_pos = (int(h)-12)*30
 m_pos = int(m)*6
 h_curpos = h_pos + int(m)*0.5
 ang = abs(h_curpos - m_pos)
 ang1 = 360-ang
 fin_ang =min(ang,ang1)
 if math.floor(fin_ang) == fin_ang:
  print(int(fin_ang),'degree')
 else:
  print(float(fin_ang),'degree')

def calcAngle(h,m):
   
  # validate the input
  if (h < 0 or m < 0 or h > 12 or m > 60):
   print('Wrong input')
   
  if (h == 12):
   h = 0
  if (m == 60):
   m = 0
   h += 1;
   if(h>12):
     h = h-12;
   
  # Calculate the angles moved by 
  # hour and minute hands with 
  # reference to 12:00
  hour_angle = 0.5 * (h * 60 + m)
  minute_angle = 6 * m
   
  # Find the difference between two angles
  angle = abs(hour_angle - minute_angle)
   
  # Return the smaller angle of two 
  # possible angles
  angle = min(360 - angle, angle)
   
  if angle.is_integer() : return int(angle)
  else: return angle
 
 
def __starting_point():
 T= int(input())
 for i in range(T):
  t = input()
  h = int(t.split(":")[0])%12
  m = int(t.split(":")[1])
  # print(h,m)
  print(calcAngle(h,m),"degree")
__starting_point()

# cook your dish here
try:
 for _ in range(int(input())):
  time = input().split(':')
  hour = int(time[0])
  minute = int(time[1])
  if hour == 0:
   hour = 12
  elif hour > 12:
   hour = hour - 12
  mindeg = minute * 6
  hourdeg = (hour * 30) + (minute/60)*30
  x = abs(hourdeg - mindeg)
  if str(x).split('.')[1] == '0':
   if x > 180:
    print(int(360-x),'degree')
   else:    
    print(int(x),'degree')
  else:
   if x > 180:
    print(360-x,'degree')
   else:    
    print(x,'degree')
except:
 pass

for _ in range(int(input())):
 H, M = [int(n) for n in input().split(":")]
 if (H >= 12):
  H-=12
 if(M==60):
  M=0
  H+=1
 angleH = H*30 + M*0.5
 angleM = M*6
 angle = abs(angleH-angleM)
 angle = min(360-angle, angle)
 if not (angle>int(angle)):angle=int(angle)
 print(str(angle) + " degree")

# cook your dish here
t=int(input())
for i in range(t):
 s=input()
 a=s.split(":")
 x=float(a[0])
 y=float(a[1])
 #z=x*60+y
 if x>=12:
  x-=12
 deg_min=(y*30)/5
 deg_hour=(x*30+deg_min/12)
 #print(deg_min,deg_hour)
 ans=min(abs(deg_min-deg_hour),360-abs(deg_min-deg_hour))
 print('{:g}'.format(ans),"degree")

for _ in range(int(input())):
 h,m = tuple(map(int, input().split(":")))
 #a = list(map(int, input().split()))
 if m % 5 != 0:
  m = m + (5 - m %5)
 anm = int(360 * (m/60))%360
 h = h % 12
 anh = h * 30 + 30 * (m/60)
 ans = abs(anh-anm) if abs(anh-anm) <= 180 else 360 - abs(anh-anm)
 if ans == int(ans):
  ans = int(ans)
 print(ans,"degree")
 


# cook your dish here
t=int(input())
for i in range(t):
 s=input()
 a=s.split(":")
 x=float(a[0])
 y=float(a[1])
 #z=x*60+y
 if x>=12:
  x-=12
 deg_min=(y*30)/5
 deg_hour=(x*30+deg_min/12)
 #print(deg_min,deg_hour)
 ans=min(abs(deg_min-deg_hour),360-abs(deg_min-deg_hour))
 print('{:g}'.format(ans),"degree")


# cook your dish here
n=int(input())
y=[]
for i in range(0,n):
 l=[]
 s=input()
 l=s.split(":")
 l[0]=int(l[0])
 l[1]=int(l[1])
 if l[0] >= 12:
  l[0]=l[0]-12
 l[1]=l[1]//5
 m,e=1,1
 r=0
 if l[0] < l[1]:
  m=m*l[1]*2.5
  e=(l[1]-l[0])*30*e
  r=e-m
 elif l[0] > l[1]:
  m=m*l[1]*2.5
  e=(l[0]-l[1])*30*e
  r=m+e
 else:
  m=m*l[1]*2.5
  r=m
 if r > 180:
  r=360-r
 y.append(r)
for j in y:
 print("{0:.2f}".format(j).rstrip('0').rstrip('.'),"degree")



def CHEFJUMP(hour, minute):

 h_m = (minute * 12) / 60 * 30
 diff = (30 * minute) / 60

 hour = (((hour % 12) * 30) + diff) % 360
 A = min(abs(hour - h_m), (360 - max(hour, h_m)) + min(hour, h_m))
 
 if A != int(A):
  return A
 else:
  return int(A)



TESTCASES = int(input().strip())

for i in range(0, TESTCASES):
 
 H, M = [int(x) for x in input().strip().split(":")]
  
 print(str(CHEFJUMP(H, M)) + " degree")
  


t = int(input())

while t:
 t -= 1

 time = input()
 hrs, mins = time.split(':')
 hrs, mins = int(hrs), int(mins)

 total_mins = hrs*60 + mins

 ha = (0.5*total_mins)%360
 ma = (6*total_mins)%360

 ans1 = abs(ha-ma)
 ans2 = 360-ans1

 ans = min(ans1, ans2)

 if not ans%1:
  ans = int(ans)

 print(ans, "degree")

test = int(input())
while test:
 t = input()
 h = int(t[0]+t[1])
 m = int(t[3]+t[4])
 h = h%12
 if m==60:
  m=0
  h += 1
  if h>12:
   h = h-12
 hour_angle = 0.5*(h*60+m) 
 minute_angle = 6*m

 angle = abs(hour_angle-minute_angle)

 angle = min(360-angle,angle) 
 a = angle
 b = int(angle)
 if a-b == 0:
  print(str(b)+' degree')
 else:    
  print(str(angle)+' degree') 


 test -= 1

# cook your dish here
for i in range(int(input())):
 t=input()
 l=t.split(":")
 l[0]=int(l[0])
 l[1]=int(l[1])
 if l[0]>=12:
  l[0]=l[0]-12
 m=l[1]*6
 h=l[0]*30+l[1]*0.5
 if abs(m-h)>180:
  ans=360-abs(m-h)
 else:
  ans=abs(m-h)
 
 print("{0:.2f}".format(ans).rstrip("0").rstrip("."),"degree")

# cook your dish here
t = int(input())
for j in range(t):
 s=input()
 h=int(s[:2])
 if h>11:
  h-=12
 m=int(s[3:])
 ah=h*30 + m/2
 am=(m//5)*30
 ans=abs(am-ah)
 if ans<=180:
  if int(ans)==ans:
   print(int(ans),'degree')
  else:
   print(ans,'degree')
 else:
  if int(ans)==ans:
   print(360-int(ans),'degree')
  else:
   print(360-ans,'degree')

for _ in range(int(input())):
 s = input()
 h = int(s[:2])
 m = int(s[3:])
 if h >= 12:
  h -= 12
 m1 = m/2
 if m%2 == 0:
  m1 = int(m1)
 hd = h*30 + m1
 md = m*6
 ans = abs(hd - md)
 if ans > 180:
  ans = 360-ans
 print(str(ans)+' degree')


# cook your dish here
t=int(input())
while t:
 t=t-1
 s=input()
 hrs=""
 mint=""
 for i in range(len(s)):
  if(s[i]!=":"):
   hrs+=s[i]
  else:
   mint=s[i+1:]
   break
 mint=int(mint)
 hrs=int(hrs)
 if mint%5!=0:
  mint+=(5-(mint%5))
 if hrs>=12:
  hrs-=12
 if mint==60:
  mint=0
 h_hand=30*hrs+(float)((float)(2.5)*(float)(mint/5))
 m_hand=30*(mint/5)
 hour=abs(h_hand-m_hand)
 if abs(h_hand-m_hand)==int(abs(h_hand-m_hand)):
  hour=int(abs(h_hand-m_hand))
 min1=min(360-hour,hour)
 print(min1,"degree") 


# cook your dish here
testcases = int(input())
while testcases != 0:
 testcases -= 1
 n=input()
 hr = int(n[0:2])%12
 minte=int(n[3:])
 degree = .5*(60*hr-11*minte)

 if degree.is_integer():
  degree = int(degree)
 
 degree=abs(degree)
 if degree > 180:
  degree = 360-degree
 print(str(degree) + " degree")

for _ in range(int(input())):
 s=input()
 lst=s.split(':')
 #print(lst)
 h=int(lst[0])
 m=int(lst[1])
 h=h%12
 h_angle=h*30+m*0.5
 m_angle=(m*30)/5
 val=abs(h_angle-m_angle)
 ans=min(360-val,val)
 if ans==int(ans):
  print(int(ans),'degree')
 else:
  print(ans,'degree')

t=int(input())
for i in range (t):
 h,m=list(map(int,input().split(":")))
 if (h>=12):
  h-=12
 hm=m/2
 a=m//2
 mm=m//5
 if (h<mm):
  ang=abs(mm-h)*30
  ang-=hm
  if (hm==a):
   print(int(min(ang,360-ang)),"degree")
  else:
   print(min(ang,360-ang),"degree")
 else:
  ang=abs(h-mm)*30
  ang+=hm
  if (hm==a):
   print(int(min(ang,360-ang)),"degree")
  else:
   print(min(ang,360-ang),"degree")


def jump(h,m):
 diff=abs(m-h)*30
 if m*5%2==0:
  ahead=m*5//2
 else:
  ahead=m*5/2
 if h>=m:
  diff+=ahead
 else:
  diff-=ahead
 if (h==12 or h==0 )and m==0:
  print(0, "degree")
 else:
  if diff<=180:
   print(diff , "degree")
  else:
   print(360-diff,"degree")
  
 
 
t=int(input()) 
for g in range(t):
 #n=int(input())
 a=input()
 h=int(a[:2])
 if h>12:
  h-=12
 elif h==0:
  h=12
 m=int(a[3:])//5
 jump(h,m)

t = int(input())
for t1 in range(t):
 h, m = input().split(":")
 h, m = int(h), int(m)
 
 h = h%12
 
 h = 30*h + m/2
 am = m*6;
 ans = min(abs(h - am), 360 - abs(am - h))
 if ans - int(ans) == 0:
  print(str(int(ans)) + " degree")
 else:
  print(str(ans) + " degree")

# cook your dish here
onehour=30 
oneminute=0.5 
d={0:0,5:30,10:60,15:90,20:120,25:150,30:180,35:210,40:240,45:270,50:300,55:330}
t=int(input())
for _ in range(t):
 h,s=list(map(int,input().split(":")))
 h=h%12 
 initial=h*5 
 modu=s%5 
 s+=modu 
 deg=d[s]-d[initial]
 
 if deg>=0:
  deg=deg-s*0.5
 else:
  deg=abs(deg)+s*0.5
 if deg>180:
  deg=360-deg 
 if deg==int(deg):
  print(abs(int(deg)),"degree")
 else:
  print(abs(deg),"degree")



for _ in range(int(input())):
 l=input().split(":")
 hr=int(l[0])%12
 mi=int(l[1])
 hour_angle = (hr % 12) * 30 + mi * 0.5
 minute_angle = mi * 6
 ans = abs(hour_angle - minute_angle)
 if ans%1==0:
  print(min(int(ans), 360 - int(ans)), "degree")
 else:
  print(min(ans,360-ans)," degree")