#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#define mul(x1,y1,x2,y2) ((x1)*(y2) - (x2)*(y1))
#define x first
#define y second
using namespace std;
typedef pair<double,double> PDD;
//判断线端是否相交
int n;
//要再加一个快速独立实验
bool find(PDD a,PDD b,PDD c,PDD d)
{
if(min(a.y,b.y) > max(c.y,d.y)) return false;
if(max(a.y,b.y) < min(c.y,d.y)) return false;
if(min(a.x,b.x) > max(c.x,d.x)) return false;
if(max(a.x,b.x) < min(c.x,d.x)) return false;
return true;
}
bool check(PDD a,PDD b,PDD c,PDD d)
{
if(!find(a,b,c,d)) return false;
double t1 = mul(c.x-a.x, c.y-a.y, b.x-a.x, b.y-a.y);
double t2 = mul(d.x-a.x, d.y-a.y, b.x-a.x, b.y-a.y);
//cout<<t1<<" "<<t2<<endl;
if(t1 * t2 <= 0) return true;
return false;
}
bool solve(PDD a,PDD b,PDD s,PDD t)
{
if(check(a,b,s,{s.x,t.y})) return true;
if(check(a,b,s,{t.x,s.y})) return true;
if(check(a,b,t,{t.x,s.y})) return true;
if(check(a,b,t,{s.x,t.y})) return true;
return false;
}
//要判断线段相交 和 点是否在矩阵内部
bool iner (PDD a,PDD s,PDD t)
{
if(a.x < min(s.x,t.x) || a.x > max(s.x,t.x)) return 0;
if(a.y < min(s.y,t.y) || a.y > max(s.y,t.y)) return 0;
return 1;
}
int main()
{
cin>>n;
double x1,y1,x2,y2,sx,sy,tx,ty;
for(int i = 1;i <= n;i ++)
{
cin>>x1>>y1>>x2>>y2 >> sx >> sy >> tx >> ty;
PDD a = {x1,y1}, b= {x2,y2}, c={sx,sy},d={tx,ty};
if(solve(a ,b ,c, d) || iner(a,c,d) || iner(b,c,d)) puts("T");
else puts("F");
}
return(0);
}