For each test cases, k is given. k is the number of ingredients.
Following k, there are k lines. Each line has 3 numbers. They represent protein, fat and carbohydrate content in the kth ingredient.
Following these k lines, 3 lines are given. Each line has 3 numbers. They represent protein, fat and carbohydrate. For these 3 targets, we need to find out the ingredients to be added to exactly match the target.
Output : for the 3 lines in each test case, print space separated numbers denoting the ingredients to be added to get the exact match.
The ingredients must be printed in the sorted order. If there are many combinations, print the one which minimum number of ingredients.
for _ in range(int(input())):
ing = []
n,t = map(int,input().split())
for i in range(n):
ing.append(list(map(int,input().split())))
for _ in range(t):
ans = []
val = list(map(int,input().split()))
for i in range(n):
for j in range(i,n):
lst = ing[i:j+1]
temp = [0,0,0]
for i in range(len(lst)):
temp[0] += lst[i][0]
temp[1] += lst[i][1]
temp[2] += lst[i][2]
if temp == val:
ans.append(lst)
if not ans:
print(-1)
break
minlen = ans[0]
for an in ans:
if len(minlen) > len(an):
minlen = an
for val in minlen:
print(ing.index(val)+1,end=" ")
print()