目录

A.-Draw-a-Square

目录

A. Draw a Square

time limit per test

1 second

memory limit per test

256 megabytes

The pink soldiers have given you 44 distinct points on the plane. The 44 points’ coordinates are (−l,0)(−l,0), (r,0)(r,0), (0,−d)(0,−d), (0,u)(0,u) correspondingly, where ll, rr, dd, uu are positive integers.

https://i-blog.csdnimg.cn/img_convert/348a6ecb7072afe3925f70609aa65c5e.png

In the diagram, a square is drawn by connecting the four points LL, RR, DD, UU.

Please determine if it is possible to draw a square∗∗ with the given points as its vertices.

∗∗A square is defined as a polygon consisting of 44 vertices, of which all sides have equal length and all inner angles are equal. No two edges of the polygon may intersect each other.

Input

Each test contains multiple test cases. The first line contains the number of test cases tt (1≤t≤1041≤t≤104). The description of the test cases follows.

The first line of each test case contains four integers ll, rr, dd, uu (1≤l,r,d,u≤101≤l,r,d,u≤10).

Output

For each test case, if you can draw a square using the four points, output “Yes”. Otherwise, output “No”.

You can output the answer in any case. For example, the strings “yEs”, “yes”, and “YES” will also be recognized as positive responses.

Example

Input

Copy

2

2 2 2 2

1 2 3 4

Output

Copy

Yes
No

Note

On the first test case, the four given points form a square, so the answer is “Yes”.

On the second test case, the four given points do not form a square, so the answer is “No”.

解题说明:几何题,为了构成正方形,确保所有数字一样即可。

#include <iostream>  
#include <string>  
using namespace std;

int main()
{
	int t;
	cin >> t;
	while (t--)
	{
		int l, r, d, u;
		cin >> l >> r >> d >> u;
		if ((l == r) &&(r==d)&&(d==u))
		{
			cout << "YES" << endl;
		}
		else
		{
			cout << "NO" << endl;
		}
	}
	return 0;
}