#include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;
const int N =20;
struct note{
int t,d,l;
}p[N];
bool st[N];
bool cmp(note a,note b)
{
return a.t<b.t;
}
int n;
bool uo=false;
void dfs(int t,int d,int l,int c)
{
if(c==n)
{
uo=true;
return ;
}
for(int i=1;i<=n;i++)
{
if(st[i]==true)
continue;
else if(l>p[i].t+p[i].d)
continue;
else
{
st[i]=true;
dfs(p[i].t,p[i].d,p[i].l+l,c+1);
st[i]=false;
if(uo)
return;
}
}
}
int main()
{
int T;
cin >> T;
while(T--)
{
memset(p,0,sizeof p);
memset(st,false,sizeof st);
cin >> n;
uo=false;
for(int i=1;i<=n;i++)
{
int t,d,l;
cin >> t >>d >>l;
p[i]={t,d,l};
}
for(int i=1;i<=n;i++)
{
st[i]=true;
dfs(p[i].t,p[i].d,p[i].l,1);
st[i]=false;
if(uo)
break;
}
if(uo)
cout <<"YES\n";
else
cout <<"NO\n";
}
return 0;
}
``
1`
10
57700 38541 1942
49149 28431 7596
73419 11683 11139
235 225 7148
10316 3748 6874
6960 577 663
10611 32462 34507
15741 5130 8697
5089 24479 13534
578 7622 5941