36
2 2 2 8 9 4 8 5
9 1 7 6 10 6 9 3
10 2 4 6 6 2 1 1
9 6 2 3 5 7 7 3
6 6 3 9 10 9 1 3
1 3 10 5 10 10 4 1
10 3 10 4 5 5 3 4
10 3 4 9 3 3 7 3
6 9 9 2 6 4 3 3
7 2 1 10 4 7 6 2
3 4 3 4 3 2 9 5
7 8 2 9 8 3 2 3
5 4 6 9 4 4 8 3
5 2 2 8 1 5 7 5
4 7 10 2 10 9 2 3
4 8 2 3 6 6 3 2
8 10 4 3 4 2 1 4
10 6 10 5 6 5 8 5
4 7 3 8 3 8 1 4
1 6 6 6 7 1 8 3
2 8 5 6 4 5 7 3
2 1 10 2 1 2 8 3
3 5 9 2 6 10 8 4
10 5 6 7 10 3 5 3
5 7 3 9 5 5 10 5
8 1 3 10 7 10 9 3
3 6 2 1 2 6 2 2
8 6 4 6 5 2 5 4
1 10 5 3 9 9 5 5
8 3 5 9 1 6 4 4
2 5 3 4 9 5 9 5
3 10 8 2 6 7 9 3
5 1 2 5 7 1 8 2
3 4 8 8 4 9 6 3
8 3 7 5 5 6 5 5
7 7 4 9 1 8 5 2
OUTSIDE
INSIDE
OUTSIDE
OUTSIDE
OUTSIDE
OUTSIDE
OUTSIDE
INSIDE
OUTSIDE
OUTSIDE
OUTSIDE
OUTSIDE
OUTSIDE
OUTSIDE
OUTSIDE
OUTSIDE
OUTSIDE
INSIDE
OUTSIDE
OUTSIDE
OUTSIDE
OUTSIDE
INSIDE
OUTSIDE
OUTSIDE
OUTSIDE
INSIDE
INSIDE
INSIDE
OUTSIDE
INSIDE
OUTSIDE
OUTSIDE
OUTSIDE
OUTSIDE
OUTSIDE

def area(x1,  y1,  x2,  y2,  x3,  y3):
   return abs((x1*(y2-y3) + x2*(y3-y1)+ x3*(y1-y2))/2.0)
def isInside( x1,  y1,  x2,  y2,  x3,  y3,  x,  y):
   A = float(area (x1, y1, x2, y2, x3, y3))
   A1 = float(area (x, y, x2, y2, x3, y3))
   A2 = float(area (x1, y1, x, y, x3, y3))
   A3 = float(area (x1, y1, x2, y2, x, y))

   # Check if sum of A1, A2 and A3 is same as A */
   return (A == A1 + A2 + A3)

def main():
    N = int(raw_input())
    l=[]
    o=[]
    for j in range(0,N):
        l=[]
        i = raw_input()
        l = [int(x) for x in i.split(' ')]
        k=isInside(l[0],l[1],l[2],l[3],l[4],l[5],l[6],l[7])
        if(k==0):
            o.append("OUTSIDE")
        else:
            o.append("INSIDE")
    for i in range(0,N):
        print o[i]
if __name__ == "__main__":
    main()