/*
这题如果想明白以后,其实并没有那么难
两个长方形A, B若要合并,(a1 == b1 || a1 == b2 || a2 == b1 || a2 == b2)四种条件中,必定要满足至少一个,也就是说,两个长方形必有相等的边,假设这两个长方形已经合成了一个大长方形
第三个长方形,如果要和大三角形合并,除非有边和它们相等的那条边相等,或者有边和它们合并后得到的边相等
因为就4种情况,循环反而并不太好,因为循环一般是4个三角形组成的排列,而非组合,可能会枚举重复的情况,虽然不会造成答案错误,但毕竟不太完美...对这题而言,枚举反而更好
参考了此博客的思路:
http://www.cnblogs.com/Ritchie/p/5741823.html
*/
#include <iostream>
//#define debug
using namespace std;
struct triangle
{
int w, h;
triangle(int _w = 0, int _h = 0):w(_w), h(_h)
{
}
bool isvalid()
{
return (w > 0 && h > 0);
}
}a[4];
typedef triangle tri;
tri unite(tri i, tri j)
{
if (i.h == j.h) return tri(i.h, i.w + j.w);
if (i.h == j.w) return tri(i.h, i.w + j.h);
if (i.w == j.w) return tri(i.w, i.h + j.h);
if (i.w == j.h) return tri(i.w, i.h + j.w);
return tri(-1, -1);
}
bool judge(tri a, tri b, tri c)
{
if (( unite( unite(a, b), c ) ).isvalid() || ( unite( unite(a, c), b ) ).isvalid() || ( unite( unite(b, c), a ) ).isvalid()) return true;
return false;
}
void solve()
{
if (judge(a[0], a[1], a[2]) || judge(a[0], a[1], a[3]) || judge(a[0], a[2], a[3]) || judge(a[1], a[2], a[3])) cout << "Yes" << endl;
else cout << "No" << endl;
}
int main()
{
#ifdef debug
freopen("E:\\in.txt", "r", stdin);
freopen("E:\\out.txt", "w", stdout);
#endif
int t;
cin >> t;
while (t--)
{
for (int i = 0; i < 4; i++) cin >> a[i].w >> a[i].h;
solve();
}
#ifdef debug
fclose(stdin);
fclose(stdout);
#endif
return 0;
}