#include #include #include #include #include using namespace std; #define ABS(a) ((a)>0?(a):-(a)) string solver(int S, int SG, int FG, int D, int T) { //the other car speed in km/s: S/3600 + D/(20*T) int OST = S * 20 * T + 3600 *D ;//other car speed in km/h and multiply it 20*T int SGT = SG * 20 * T; //Sebi guess in km/s and multiply it 20*T int FGT = FG * 20 * T; //Father guess in km/s and multiply it 20*T if ( ABS(SGT-OST) < ABS(FGT-OST)) { return "SEBI"; } else if ( ABS(SGT-OST) > ABS(FGT-OST)) { return "FATHER"; } return "DRAW"; } int main(int argc, char* argv[]) { int C,S,SG,FG,D,T; scanf("%d", &C); while (C--) { scanf("%d %d %d %d %d", &S, &SG, &FG, &D, &T); printf("%s\n", solver(S, SG, FG, D, T).c_str()); } return 0; }