logo AlgoBeat OnlineJudge
登录 注册

#217692. [PacNW 2025] Fractal Painting

内存限制:2048 MiB 时间限制:1000 ms 标准输入输出
题目类型:VJudge(洛谷) 评测方式:VJudge
上传者: 匿名

题目描述

A fractal painting consists of infinitely many line segments. The first segment, called A, connects to . Segments B and C connect to and , respectively.

The rest of the painting is defined recursively. From , draw segments D and E so that the three-segment figure B-D-E is similar to A-B-C. Here, similar means that one figure can be matched point-for-point to the other by translation, rotation, and scaling. Likewise, draw segments F and G from so that C-F-G is similar to A-B-C. Continue this process forever.

Determine whether some rectangle of finite size can contain the entire fractal painting.

输入格式

The first line contains an integer (), the number of test cases.

Each test case contains six integers . Every coordinate is between and , inclusive. The points , , , and are all distinct.

输出格式

For each test case, output YES if the entire painting fits inside some rectangle of finite size. Otherwise, output NO.

样例

样例输入 1

3
1 3 -1 3 3 4
1 1 67 0 0 67
67 67 1 0 0 1

样例输出 1

YES
NO
YES