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

Difficulty: UNKNOWN_DIFFICULTY

Solutions:
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')


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
	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)


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)


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())
	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'])


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])
	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)


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)


t = int(input())
for i in range(t):
	n = int(input())
	l = []
	for j in range(n):
		l.append(input().split())
	sum = 0
	avg = 0
	for j in range(n):
		sum += int(l[j][2])
	avg = sum / n
	x = []
	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:
			if y < len(x):
				if x[y] == k[2]:
					print(k[0], k[1], k[2])
					y += 1
					le -= 1
					k[2] = -1
					break


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


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=' ')