문제1638--Intersection

### 1638: Intersection

실행시간 제한: 1 Sec  메모리사용 제한: 128 MB
제출: 218  통과: 102
[제출] [채점기록] [묻고답하기]

#### 문제 설명

You are to write a program that has to decide whether a given line segment intersects a given rectangle.

#### An example:

line: start point: (4,9)
end point: (11,2)
rectangle: left-top: (1,5)
right-bottom: (7,1)

The line is said to intersect the rectangle if the line and the rectangle have at least one point in common. The rectangle consists of four straight lines and the area in between. Although all input values are integer numbers, valid intersection points do not have to lay on the integer grid.

#### 입력 설명

The input consists of n test cases. The first line of the input file contains the number n. Each following line contains one test case of the format: xstart ystart xend yend xleft ytop xright ybottom where (xstartystart) is the start and (xendyend) the end point of the line and (xleftytop) the top left and (xrightybottom) the bottom right corner of the rectangle. The eight numbers are separated by a blank. The terms top left and bottom right do not imply any ordering of coordinates. The absolute values of the coordinates will be less than 100.

#### 출력 설명

For each test case in the input file, the output file should contain a line consisting either of the letter "T" if the line segment intersects the rectangle or the letter "F" if the line segment does not intersect the rectangle.

#### 입력 예시 Copy

1
4 9 11 2 1 5 7 1

#### 출력 예시 Copy

F