I am not understanding where i am wrong…pls help!

the problem link : https://www.codechef.com/COMT2020/problems/HELPTECH

```
from operator import itemgetter
for _ in range(int(input())):
n=int(input())
info=[]
val=0
for i in range(n):
lst=list(input().strip().split())
val+=int(lst[2]) # finding the total sum of marks
info.append(lst)
final=[] # for storing the students with marks lower than avg
val=val/n
for i in range(n):
if int(info[i][2])<val:
final.append(info[i])
ans=sorted(final,key=itemgetter(2)) # sort aray with marks as key
for i in ans:
print(i[0],i[1],i[2])
```