n=int(input())for i in range(n): i=list(map(int,input().split())) min=abs((i[0]-i[2])*60+i[1]-i[3]) if min>=i[4]: print("Yes") else: print("No")