t=int(input())

for i in range(t):

transmorgifier=int(input())

number_of_minions=int(input())

dna_values=[]

```
for j in range(number_of_minions):
charac_val=int(input())
charac_val+=transmorgifier
dna_values.append(charac_val)
for k in range(len(dna_values)):
if dna_values[k]%7==0:
print(k)
```

(Both the last and second-last forloops are under the first one)