#include<iostream>
#include<cstdlib>
using namespace std;
int main(){
int m,h,a,i,j;
cin>>a;
for(j=1;j<=a;j++){
cin>>m>>h;
int b,hs,t,x[4],y[4],z[4];
for(i=1;i<=3;i++) cin>>x[i]>>y[i]>>z[i];
if(h>=21||(h>=0&&h<6)||(h>=14&&h<16)){
b=4*x[1];hs=10*x[3];t=6*x[2];
}
if((h>=9&&h<14)||(h>=19&&h<21)){
b=4*y[1];hs=10*y[3];t=6*y[2];
}
else{
b=4*z[1];hs=10*z[3];t=6*z[2];
}
if(hs<=m) {cout<<"HSR\n";continue;}
if(t<=m) {cout<<"Train\n";continue;}
if(b<=m) {cout<<"Bus\n";continue;}
else cout<<"Walk home\n";
}
}
WA(line:1) HSR,应为Train