import java.util.Scanner;
public class b572 {
public static void main(String[]args){
Scanner input = new Scanner(System.in);
while (input.hasNextInt()){
int n =input.nextInt();
for (int i =0;i<n;i++) {
int h1 = input.nextInt();
int m1 = input.nextInt();
int h2 = input.nextInt();
int m2 = input.nextInt();
int bus = input.nextInt();
System.out.println(((60*(h2-h1))+(m2-m1)>=bus)? "Yes" : "No");
}
}
}
}