#include <iostream>
using namespace std;
int main()
{
int n;
cin >> n;
for (int i=1; i<=n; i++){
int h1, m1, h2, m2, m3;
while (cin >> h1 >> m1 >> h2 >> m2 >> m3){
if (h1==0){
h1=24;
}
int a=h1*24+m1;
int b=h2*24+m2;
if (m3<=abs(b-a)){
cout << "Yes" << endl;
}
else {
cout << "No" << endl;
}
}
}
return 0;
}