#include #include #include using namespace std; struct pp{int a,b,c;} p[3005]; bool cmp(const pp &i,const pp &j){ return (long long)i.b*(long long)j.c>(long long)i.c*(long long)j.b; } int n,t,f[1005][3005]; int main(){ int tt;scanf("%d",&tt); for (;tt--;){ scanf("%d%d",&n,&t); for (int i=1;i<=n;i++) scanf("%d%d%d",&p[i].a,&p[i].b,&p[i].c); sort(p+1,p+n+1,cmp);memset(f,0,sizeof(f)); for (int i=0;i