Problem9906--ABC309 —— F - Box in Box

9906: ABC309 —— F - Box in Box

[Creator : ]
Time Limit : 1.000 sec  Memory Limit : 512 MiB

Description

There are $N$ boxes. The $i$-th box has a shape of a rectangular cuboid whose height, width, and depth are $h_i,w_i$, and $d_i$, respectively.

Determine if there are two boxes such that one's height, width, and depth are strictly greater than those of the other after rotating them if necessary.

Input

The input is given from Standard Input in the following format:

```
$N$
$h_1$ $w_1$ $d_1$
$\vdots$
$h_N$ $w_N$ $d_N$
```

Output

Print `Yes` if there are two boxes such that one's height, width, and depth are strictly greater than those of the other after rotating them if necessary; print `No` otherwise.

Constraints

-   $2 \leq N \leq 2 \times 10^5$
-   $1 \leq h_i,w_i,d_i \leq 10^9$
-   All input values are integers.

Sample 1 Input

3
19 8 22
10 24 12
15 25 11

Sample 1 Output

Yes
If you rotate the 2-nd box to swap its height and depth, the 3-rd box will have greater height, depth, and width.

Sample 2 Input

3
19 8 22
10 25 12
15 24 11

Sample 2 Output

No

Sample 3 Input

2
1 1 2
1 2 2

Sample 3 Output

No

Source/Category