#include <iostream>
using namespace std;
int main() {
int n,i = 0;
int h1,m1,h2,m2,t;
cin >> n;
while(i < n){
cin >> h1 >> m1 >> h2 >> m2 >> t;
if((h2 * 60 + m2 - h1 * 60 - m1 - t) >= 0){
cout << "Yes" << endl;
}else{
cout << "No" << endl;
}
i++;
}
}