#include<iostream>
using namespace std;
int main(){
int i,H1,M1,H2,M2,needtime;
while(cin>>i>>H1>>M1>>H2>>M2>>needtime){
if(i>0){
i--;
if(60*(H2-H1)+M2-M1>=needtime){
cout<<"Yes\n";
}
if(60*(H2-H1)+M2-M1<needtime){
cout<<"No\n";
}
}
}
return 0;
}
(救救孩子吧!!!!!!)