#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <vector>
#include <cassert>
using namespace std;
typedef long long ll;
const double pi = acos (-1.0);
typedef int T;
struct pt{
T x, y;
pt (){}
pt (T _x, T _y){
x = _x; y = _y;
}
pt operator + (pt p){
return pt (x + p.x, y + p.y);
}
pt operator - (pt p){
return pt (x - p.x, y - p.y);
}
pt operator / (T d){
return pt (x / d, y / d);
}
};
T dot (pt v, pt w){
return v.x * w.x + v.y * w.y;
}
T cross (pt v, pt w){
return v.x * w.y - v.y * w.x;
}
T orient (pt a, pt b, pt c){
return cross (b - a, c - a);
}
bool inDisk (pt a, pt b, pt p){
return dot (a - p, b - p) <= 0;
}
bool onSegment (pt a, pt b, pt p){
return orient (a, b, p) == 0 and inDisk (a, b, p);
}
bool properInter (pt a, pt b, pt c, pt d, pt& i){
int oa = orient (c, d, a),
ob = orient (c, d, b),
oc = orient (a, b, c),
od = orient (a, b, d);
if (oa * ob < 0 and oc * od < 0){
i = (a * ob - b * oa) / (ob - oa);
return true;
}
return false;
}
bool inters (pt a, pt b, pt c, pt d){
pt out;
if (properInter (a, b, c, d, out)) return true;
if (onSegment (c, d, a)) return true;
if (onSegment (c, d, b)) return true;
if (onSegment (a, b, c)) return true;
if (onSegment (a, b, d)) return true;
return false;
}
bool pointInPolygon(const vector<pt> &p, pt q){
bool c = false;
for (int i = 0; i < p.size(); i++){
int j = (i + 1) % p.size();
if ((p[i].y <= q.y and q.y < p[j].y or p[j].y <= q.y and q.y < p[i].y) and
q.x < p[i].x + (p[j].x - p[i].x) * (q.y - p[i].y) / (p[j].y - p[i].y))
c = !c;
}
return c;
}
vector <pt> v;
int main (){
// freopen ("in.txt", "r", stdin);
int test;
scanf("%d", &test);
for (int _z = 0; _z < test; _z++){
pt a, b;
int x1, y1, x2, y2;
scanf("%d %d %d %d", &a.x, &a.y, &b.x, &b.y);
scanf("%d %d %d %d", &x1, &y1, &x2, &y2);
v.clear();
v.push_back (pt (x1, y1));
v.push_back (pt (x2, y1));
v.push_back (pt (x2, y2));
v.push_back (pt (x1, y2));
bool ret = inters (v[0], v[1], a, b) | inters (v[1], v[2], a, b) | inters (v[2], v[3], a, b) | inters (v[3], v[0], a, b);
if (pointInPolygon(v, a) and pointInPolygon(v, b)) ret = true;
if (ret) puts ("T");
else puts ("F");
}
return 0;
}