#include <cstdio> #include <iostream> #include <queue> using namespace std; struct _zz{int now,a,b,c,num;}; bool operator < (_zz x,_zz y){return x.num>y.num;} priority_queue<_zz,vector<_zz>,less<_zz> > q; int n,m; int main(){ scanf("%d%d",&n,&m); while(n--){ int x,y,z; scanf("%d%d%d",&x,&y,&z); q.push((_zz){1,x,y,z,x+y+z}); } while(m--){ _zz x=q.top(); int now=x.now+1; q.pop(); printf("%d ",x.num); q.push((_zz){now,x.a,x.b,x.c,now*now*x.a+now*x.b+x.c}); } return 0; }