A sequence of $n$ numbers is called permutation if it contains all integers from $1$ to $n$ exactly once. For example, the sequences [$3, 1, 4, 2$], [$1$] and [$2,1$] are permutations, but [$1,2,1$], [$0,1$] and [$1,3,4$] — are not.

Kristina had a permutation $p$ of $n$ elements. She wrote it on the whiteboard $n$ times in such a way that:

while writing the permutation at the $i$-th ($1 \le i \le n)$ time she skipped the element $p_i$

So, she wrote in total $n$ sequences of length $n-1$ each.

For example, suppose Kristina had a permutation $p$ = $[4,2,1,3]$ of length $4$. Then she did the following:

Wrote the sequence $[2, 1, 3]$, skipping the element $p_1=4$ from the original permutation.

Wrote the sequence $[4, 1, 3]$, skipping the element $p_2=2$ from the original permutation.

Wrote the sequence $[4, 2, 3]$, skipping the element $p_3=1$ from the original permutation.

Wrote the sequence $[4, 2, 1]$, skipping the element $p_4=3$ from the original permutation.

You know all $n$ of sequences that have been written on the whiteboard, but you do not know the order in which they were written. They are given in arbitrary order. Reconstruct the original permutation from them.

For example, if you know the sequences $[4, 2, 1]$, $[4, 2, 3]$, $[2, 1, 3]$, $[4, 1, 3]$, then the original permutation will be $p$ = $[4, 2, 1, 3]$.


-----Input-----

The first line of input data contains a single integer $t$ ($1 \le t \le 10^4$) — the number of test cases.

The description of the test cases follows.

The first line of each test case contains one integer $n$ ($3 \le n \le 100$).

This is followed by $n$ lines, each containing exactly $n-1$ integers and describing one of the sequences written out on the whiteboard.

It is guaranteed that all sequences could be obtained from some permutation $p$, and that the sum $n^2$ over all input sets does not exceed $2 \cdot 10^5$.


-----Output-----

For each test case, output on a separate line a permutation $p$ such that the given $n$ sequences could be obtained from it.

It is guaranteed that the answer exists and it is the only one. In other words, for each test case the required permutation is sure to exist.


-----Examples-----

Input
5
4
4 2 1
4 2 3
2 1 3
4 1 3
3
2 3
1 3
1 2
5
4 2 1 3
2 1 3 5
4 2 3 5
4 1 3 5
4 2 1 5
4
2 3 4
1 3 4
1 2 3
1 2 4
3
2 1
1 3
2 3
Output
4 2 1 3 
1 2 3 
4 2 1 3 5 
1 2 3 4 
2 1 3


-----Note-----

The first test case is described in the problem statement.

In the second test case, the sequences are written in the correct order.

Difficulty: EASY

Solutions:
import sys, math, cmath, time
from bisect import bisect_left
start_time = time.time()

def solve():
	n = inp()
	a = []
	for i in range(n):
		l = [int(k) for k in inps()]
		a.append(l)
	k = a[0][0]
	d = {}
	for i in a:
		d[i[0]] = d.get(i[0], 0) + 1
	for i in a:
		if d[i[0]] == 1:
			ans = i
	for i in d:
		if d[i] > 1:
			k = [i]
	k.extend(ans)
	for i in k:
		print(i, end=' ')
	print()

def main():
	testcases = 1
	testcases = inp()
	for t in range(testcases):
		solve()

def inp():
	return int(input())

def inps():
	return input().split()
ONLINE_JUDGE = __debug__
if ONLINE_JUDGE:
	input = sys.stdin.readline
main()


import math
import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	n = int(input())
	tree = []
	for i in range(n):
		tree.append([])
	for i in range(n):
		tree[i] = list(map(int, input().split()))
	if tree[0][0] == tree[1][0]:
		a = tree[0][0]
		b = 0
	elif tree[0][0] == tree[2][0]:
		a = tree[0][0]
		b = 0
	else:
		a = tree[1][0]
		b = 1
	for i in range(n):
		if tree[i][0] != a:
			ans = i
			break
	print(a, end=' ')
	for i in range(n - 1):
		print(tree[ans][i], end=' ')
	print()


import sys
from math import *
from collections import defaultdict, deque
input = sys.stdin.readline
mod = 10 ** 9 + 7
INF = 1061109567
N = int(2 * 10 ** 5 + 5)
LINF = 4557430888798830399

def solve():
	n = int(input())
	a = []
	for i in range(n):
		a.append(list(map(int, input().split())))
	cnt = [0] * (n + 1)
	(num, idx) = (0, 0)
	for i in range(n):
		cnt[a[i][0]] += 1
		if cnt[a[i][0]] >= idx:
			idx = cnt[a[i][0]]
			num = a[i][0]
	for i in range(n):
		if a[i][0] != num:
			print(num, end=' ')
			for j in range(n - 1):
				print(a[i][j], end=' ')
			print()
			break
T = int(input())
for t in range(T):
	solve()


import sys
input = sys.stdin.readline
t = int(input())
while t > 0:
	n = int(input())
	(l, l1) = ([], [])
	for i in range(n):
		s = list(map(int, input().split()))
		l.append(s)
		l1.append(l[i][0])
	u = list(set(l1))
	a = {}
	for i in u:
		a[i] = l1.count(i)
	m = max(a, key=a.get)
	s1 = [m]
	for i in range(n):
		if l[i][0] != m:
			for i in l[i]:
				s1.append(i)
			break
	for i in s1:
		print(i, end=' ')
	print()
	t -= 1


for sol in range(int(input())):
	d = dict()
	ans = ''
	n = int(input())
	for i in range(n):
		lst = input().split()
		if lst[0] in d:
			d[lst[0]][0] += 1
		else:
			d[lst[0]] = [1, lst]
	p = []
	for el in d.keys():
		p.append(d[el])
	if p[0][0] < p[1][0]:
		print(str(p[1][1][0]), end=' ')
		for el in p[0][1]:
			print(el, end=' ')
		print()
	else:
		print(str(p[0][1][0]), end=' ')
		for el in p[1][1]:
			print(el, end=' ')
		print()


t = int(input())
for _ in range(t):
	n = int(input())
	li = []
	ans_li = []
	for _ in range(n):
		arr = list(map(int, input().split()))
		li.append(arr)
	li_sorted = sorted(li, key=lambda x: x[0])
	if li_sorted[0][0] == li_sorted[1][0] and li_sorted[0][0] != li_sorted[-1][0]:
		ans_li.append(li_sorted[0][0])
		ans_li.append(li_sorted[-1])
	else:
		ans_li.append(li_sorted[-1][0])
		ans_li.append(li_sorted[0])
	print(ans_li[0], *ans_li[1], end=' ')
	print()


T = int(input())
while T:
	T -= 1
	n = int(input())
	first = -1
	flag = False
	temp = []
	tt = False
	q = [0] * 101
	for i in range(n):
		a = list(map(int, input().split()))
		if tt:
			continue
		temp.append(a)
		if flag:
			q = [0] * 101
			if temp[0][0] == temp[2][0]:
				print(temp[0][0], end=' ')
				for cc in temp[1]:
					print(cc, end=' ')
				print()
			else:
				print(temp[1][0], end=' ')
				for cc in temp[0]:
					print(cc, end=' ')
				print()
			tt = True
			continue
		if first == -1:
			first = a[0]
			q[a[0]] += 1
			continue
		elif first != a[0]:
			if q[first] > 1 and q[a[0]] == 0:
				print(first, end=' ')
				for cc in a:
					print(cc, end=' ')
				print()
				tt = True
				continue
			elif q[first] == 1 and q[a[0]] == 0:
				flag = True
				continue
		else:
			q[first] += 1
			continue