Mr. Das is a teacher teaching for several years in a school. He is not computer savvy. Due to lockdown, now he has to take classes online. Recently he took an online exam for students of different classes. Now, he will call parents of all the students who scored lower than average marks for the class. He has requested you to give the name $X$, parent's phone number $P$, and marks obtained $M$ to him.

-----Input:-----
- First line contains $T$ no. of test cases
- for every test case, first line contains an integer $N$, no. of students of his class 
- Next $N$ lines contain $X$, $P$ , and $M$ separated by space

-----Output:-----
For every test case, find details of the students who scored below average, then print $X, P, M$  separated by space on a new line as per the increasing order of their marks. In case there are multiple students with the same marks, print them as per the order of their occurrence in the input

-----Constraints-----
- $1 \leq T \leq 20$
- X contains characters between a-z and A-Z  with a maximum length of 20
- $1 \leq N \leq 100$
- P is 10 digits
- $0 \leq M \leq 100$

-----Sample Input:-----
2  
3
Rahul 1345964789 47
Rupendra 1457856987 58
Priya 1478569820 45
2
Tanuja 4310779415 97
Akash 3689781245 43

-----Sample Output:-----
Priya 1478569820 45
Rahul 1345964789 47
Akash 3689781245 43

-----EXPLANATION:-----
In #1, Priya and Rahul's number was lower than average.
In #2, Akash's number was lower than average

Starter code:

Solutions:
try:
 # cook your dish here
 t=int(input())
 for j in range(t):
  n=int(input())
  x=[]
  p=[]
  m=[]
  for i in range(n):
   X,P,M=list(map(str,input().split()))
   x.append(X)
   p.append(int(P))
   m.append(int(M))
   avg=sum(m)/n
  for i in m:
   if i<avg:
    z=sorted([k for k in m if k<avg])
    for i in range(len(z)):
     print(x[m.index(z[i])],p[m.index(z[i])],m[m.index(z[i])])
      
except:
 pass

# cook your dish here
t=int(input())
for _ in range(t):
 n=int(input())
 d={}
 for j in range(n):
  x,p,m=map(str,input().split())
  if((x,p) not in d):
   d[(x,p)]=int(m)
 lst=d.values()
 s=sum(lst)
 avg=s/n
 count=0
 
 d=sorted(d.items())
 for i in range(n):
  if(d[i][1]<avg):
   count=1
   print(d[i][0][0],d[i][0][1],d[i][1])
 if(count==0):
  print('\n')

# cook your dish here
t=int(input())
for _ in range(t):
 n=int(input())
 d={}
 for j in range(n):
  x,p,m=map(str,input().split())
  if((x,p) not in d):
   d[(x,p)]=int(m)
 lst=d.values()
 s=sum(lst)
 avg=s/n
 count=0
 
 d=sorted(d.items())
 for i in range(n):
  if(d[i][1]<avg):
   count=1
   print(d[i][0][0],d[i][0][1],d[i][1])
 if(count==0):
  print(-1)

# cook your dish here
for _ in range(int(input())):
 l=[]
 lll=[]
 s=0
 n=int(input())
 for _ in range(n):
  ll=list(map(str,input().split()))
  s+=float(ll[2])
  lll.append(ll)
 avg=s/n
 #print(avg)
 for i in lll:
  if float(i[2])<avg:
   l.append(i)
 #print(l,lll)
 l.sort(key = lambda x: x[2])
 for i in l:
  print(*i)

#Help the teacher
for _ in range(int(input())):
 n = int(input())
 list1 = []
 for i in range(n):
  list1.append(list(map(str,input().split())))
 sums = 0
 for i in list1:
  sums += int(i[2])
 avg = sums/n
 ans = []
 for i in list1:
  if(avg>int(i[2])):
   ans.append(i)
 ans.sort(key = lambda ans: int(ans[2]))
 for i in ans:
  print(*i)

# cook your dish here
import math
t=int(input())
for i in range(t):
 n=int(input())
 x={}
 p={}
 m=[]
 for j in range(n):
  x1,p1,m1=input().split()
  m.append(int(m1))
  x[int(m1)]=x1
  p[int(m1)]=p1
 su=sum(m)
 avg=su/n
 m.sort()
 for j in range(n):
  if(m[j]<50):
   print(x[m[j]],end=" ")
   print(p[m[j]],end=" ")
   print(m[j])
   
 

from operator import itemgetter
t=int(input())
for _ in range(t):
 n=int(input())
 #d=defaultdict(list)
 l=[]
 d={}
 sum1=0
 for i in range(n):
  name,p_mobile,marks=map(str,input().split())
  d['name']=name
  d['p_mobile']=p_mobile
  d['marks']=int(marks)
  l.append(d)
  sum1+=int(marks)
  d={}
 avg=sum1/n
 l=sorted(l,key=itemgetter('marks'))
 for i in l:
  if i['marks']<avg:
   print(i['name'],i['p_mobile'],i['marks'])

# cook your dish here
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])
  info.append(lst)
 info.sort(key=lambda info:info[2])
 #print(ans)
 final=[]
 val=val/n
 for i in range(n):
  if int(info[i][2])<val:
   final.append(info[i])
 
 for i in final:
  print(i[0],i[1],i[2])

from statistics import mean
from collections import Counter
for _ in range(int(input())):
 n=int(input());d={}
 for i in range(n):
  x,y,z=input().split()
  d[int(z)]=[x,y]
 avg=mean(d);a=[]
 for i in d:
  if(i<avg):a.append(i)
 a.sort()
 for i in a:print(*d[i],i)


# cook your dish here
t=int(input())
for i in range(t):
 n=int(input())
 x={}
 p={}
 m=[]
 for j in range(n):
  x1,p1,m1=input().split()
  m.append(int(m1))
  x[int(m1)]=x1
  p[int(m1)]=p1
 su=sum(m)
 avg=su/n
 m.sort()
 for j in range(n):
  if(m[j]<avg):
   print(x[m[j]],end=" ")
   print(p[m[j]],end=" ")
   print(m[j])
   
 

# cook your dish here
t=int(input())
for _ in range(t):
 n=int(input())
 l=[]
 avg=0
 for i in range(n):
  x,p,m=input().split(" ")
  p=int(p)
  m=int(m)
  avg+=m
  l.append([x,p,m])
 avg=avg//n
 ret=[]
 for i in range(n):
  if l[i][2]<=avg:
   ret.append([l[i][0],l[i][1],l[i][2]])
 ret.sort()
 for i in range(len(ret)):
  print(ret[i][0],ret[i][1],ret[i][2])

from statistics import mean
from collections import Counter
for _ in range(int(input())):
 n=int(input());d={}
 for i in range(n):
  x,y,z=input().split()
  d[int(z)]=[x,y]
 avg=mean(d);a=[]
 for i in d:
  if(i<avg):a.append(i)
 a.sort();c=0
 for i in range(len(a)-1):
  if(a[i]==a[i+1]):c=1;break
 if(c==1):
  result=sorted(a,key=a.count,reverse=True)
  for i in result:print(*d[i],i)
 else:
  for i in a:print(*d[i],i)

# cook your dish here
t=int(input())
for _ in range(t):
 n=int(input())
 l=[]
 avg=0
 for i in range(n):
  x,p,m=input().split(" ")
  p=int(p)
  m=int(m)
  avg+=m
  l.append([x,p,m])
 avg=avg//n
 ret=[]
 for i in range(n):
  if l[i][2]<avg:
   ret.append([l[i][0],l[i][1],l[i][2]])
 ret.sort()
 for i in range(len(ret)):
  print(ret[i][0],ret[i][1],ret[i][2])

# cook your dish here

t=int(input())
for i in range(t):
 n=int(input())
 l=[]
 for j in range(n):
  l.append(input().split())
 #print(l)
 sum=0
 avg=0
 for j in range(n):
  sum+=int(l[j][2])
 avg=sum/n
 x=[]
 #print(avg)
 for k in l:
  if int(k[2])<avg:
   x.append(k[2])
 x.sort()
 y=0
 le=len(x)
 while(le!=0):
  for k in l:
   #print(le)
   if y<len(x):
    if x[y]==k[2]:
     print(k[0],k[1],k[2])
     y+=1
     le-=1
     k[2]=-1
     break
    
 


# cook your dish here
try:
 t=int(input())
 for i in range(t):
  n=int(input())
  a=[]
  avg=0
  for j in range(n):
   t=list(input().split())
   avg=avg+int(t[2])
   a.append(t)
  avg//=n
  a.sort(key=lambda a:a[2])
  for x in a:
   if int(x[2])<=(avg):
    print(' '.join(map(str,x)))
except EOFError:
 pass

# cook your dish here
try:
 t=int(input())
 for i in range(t):
  n=int(input())
  a=[]
  avg=0
  for j in range(n):
   t=list(input().split())
   avg=avg+float(t[2])
   a.append(t)
  avg/=n
  a.sort(key=lambda a:a[2])
  for x in a:
   if round(float(x[2]))<=round(avg):
    print(' '.join(map(str,x)))
except EOFError:
 pass

# cook your dish here
try:
 t=int(input())
 for i in range(t):
  n=int(input())
  a=[]
  avg=0
  for j in range(n):
   t=list(input().split())
   avg=avg+float(t[2])
   a.append(t)
  avg/=n
  a.sort(key=lambda a:a[2])
  for x in a:
   if int(x[2])<=round(avg):
    print(' '.join(map(str,x)))
except EOFError:
 pass

# cook your dish here
try:
 t=int(input())
 for i in range(t):
  n=int(input())
  a=[]
  avg=0
  for j in range(n):
   t=list(input().split())
   avg=avg+float(t[2])
   a.append(t)
  avg/=n
  a.sort(key=lambda a:a[2])
  for x in a:
   if float(x[2])<round(avg):
    print(' '.join(map(str,x)))
except EOFError:
 pass

# cook your dish here
try:
 t=int(input())
 for i in range(t):
  n=int(input())
  a=[]
  avg=0
  for j in range(n):
   t=list(input().split())
   avg=avg+float(t[2])
   a.append(t)
  avg/=n
  
  a.sort(key=lambda a:a[2])
  for x in a:
   if int(x[2])<round(avg):
    print(' '.join(map(str,x)))
except EOFError:
 pass

# cook your dish here
for _ in range(int(input())):
 l=[]
 lll=[]
 s=0
 n=int(input())
 for _ in range(n):
  ll=list(map(str,input().split()))
  s+=float(ll[2])
  lll.append(ll)
 avg=s/n
 #print(avg)
 for i in lll:
  if float(i[2])<avg:
   l.append(i)
 l.sort(key = lambda x: x[2])
 for i in l:
  print(*i)

# cook your dish here
try:
 t=int(input())
 for i in range(t):
  n=int(input())
  a=[]
  avg=0
  for j in range(n):
   t=list(input().split())
   avg=avg+float(t[2])
   a.append(t)
  avg/=n
  a.sort(key=lambda a:a[2])
  for x in a:
   if float(x[2])<avg:
    print(' '.join(map(str,x)))
except EOFError:
 pass

# cook your dish here
try:
 t=int(input())
 for i in range(t):
  n=int(input())
  a=[]
  avg=0
  for j in range(n):
   t=list(input().split())
   avg=avg+int(t[2])
   a.append(t)
  avg//=n
  a.sort(key=lambda a:a[2])
  for x in a:
   if int(x[2])<avg:
    print(' '.join(map(str,x)))
except EOFError:
 pass

# cook your dish here
def swapPositions(list, pos1, pos2): 
 list[pos1], list[pos2] = list[pos2], list[pos1] 
 return list

t = int(input())
while(t):
 t-=1 
 avg = 0
 x=[]
 y=[]
 z=[]
 
 n = int(input())
 for i in range(0,n):
  a,b,c = input().split(' ')
  c = int(c)
  x.append(a)
  y.append(b)
  z.append(c)
  avg = avg + c
 avg = avg/n
 '''for i in range(0,n):
     for j in range(0,n):
      if z[i]>z[j]:
       swapPositions(z,i,j)
       swapPositions(x,i,j)
       swapPositions(y,i,j)'''
 for i in range(0,n):
  if z[i]<avg:
   print(x[i] + " "+ y[i] + " "+ str(z[i]))

# cook your dish here
for _ in range(int(input())):
 l=[]
 lll=[]
 s=0
 n=int(input())
 for _ in range(n):
  ll=list(map(str,input().split()))
  s+=int(ll[2])
  lll.append(ll)
 avg=s//n
 #print(avg)
 for i in lll:
  if int(i[2])<avg:
   l.append(i)
 l.sort(key = lambda x: x[2])
 for i in l:
  print(*i)

# -*- coding: utf-8 -*-
"""
Created on Thu Jul 30 11:31:06 2020

@author: MONIMOY
"""

t = int(input())

def sortkey(ele):
 return int(ele[2])

def avg(s):
 total = 0
 for i in range(len(s)):
  total += int(s[i][2])
 return total/len(s)

out=[]
for i in range(t):
 n = int(input())
 s = []
 
 for j in range(n):
  a = input().split()
  s.append(a)
 s.sort(key=sortkey)
 av = avg(s)
 for k in s:
  if int(k[2]) < av:
   out.append(k)
  
for i in range(len(out)):
 print(*out[i], sep=" ")