#52787: python


rumm2859@gmail.com (青)


h1,m1=map(int,input().split())  #開始時間 h1=小時 m1=分鐘
h2,m2=map(int,input().split())  #結束時間 h2=小時 m2=分鐘
 
#全部換成分鐘
t1=h1*60+m1  
t2=h2*60+m2
 
# 總共時間
t=t2-t1
 
# 如果t為負數(代表有隔夜)
if t<0:
    t+=24*60 # 加上24小時(換成分鐘)
 
# 輸出答案  把分鐘換回小時
print(t//60,t%60)