Tara was completing an Algorithms assignment and got stuck on a question. She thought of who can help her, and got reminded of Kabir who has good problem solving skills. The question is:
Given N$N$ the number of elements in the sequence A1$A_1$,A2$A_2$ … An$A_n$. Find out the prime factor which occurred maximum number of times among the largest prime factor corresponding to each element. if there are more than one such prime factors print the largest one.
You are friends with Kabir, help him to solve the problem for Tara.

-----Input:-----
- The first line of the input contains a single integer T$T$ denoting the number of test cases. The description of T test cases follows. 
- First line of each test case contains N$N$, the number of elements in the sequence.
- Second line contains N space separated elements A1$A_1$,A2$A_2$ … An$A_n$.

-----Output:-----
- For each test case, print a single line, the number which occurs maximum number of times from the largest prime factor corresponding to each element.

-----Constraints-----
- 1≤T≤10$1 \leq T \leq 10$
- 1≤N≤105$1 \leq N \leq 10^5$
- 2≤A[i]≤105$2 \leq A[i] \leq 10^5$

-----Sample Input:-----
1
7

3 2 15 6 8 5 10

-----Sample Output:-----
5

-----EXPLANATION:-----
The largest prime factors of numbers are:
3 2  5  3  2  5  5 , of which 5 is most frequent.

Source: codechef | Difficulty: UNKNOWN_DIFFICULTY


Solutions:
store = [0] * (10 ** 5 + 1)

def sieve():
	for i in range(2, 10 ** 5 + 1):
		if store[i] == 0:
			store[i] = 1
			for j in range(i, 10 ** 5 + 1, i):
				store[j] = i
sieve()
for _ in range(int(input())):
	n = int(input())
	li = [int(x) for x in input().split()]
	dp = [0] * (10 ** 5 + 1)
	for i in li:
		dp[store[i]] += 1
	max_re = 0
	res = 0
	for i in li:
		if dp[store[i]] == max_re:
			if store[i] > res:
				res = store[i]
		elif dp[store[i]] > max_re:
			max_re = dp[store[i]]
			res = store[i]
	print(res)


def maxPrimeFactors(n):
	Prime = -1
	while n % 2 == 0:
		Prime = 2
		n >>= 1
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			Prime = i
			n = n / i
	if n > 2:
		Prime = n
	return int(Prime)
import math
array = [0] * 100001
for i in range(1, 100001):
	array[i] = maxPrimeFactors(i)
t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	d = {}
	for i in range(n):
		prime_fact = array[arr[i]]
		if prime_fact not in d:
			d[prime_fact] = 1
		else:
			d[prime_fact] += 1
	maxCount = max(d.values())
	ans = -1
	for i in d:
		if d[i] == maxCount:
			if i >= ans:
				ans = i
	print(ans)


import math

def primes(n):
	maxPrime = -1
	while n % 2 == 0:
		maxPrime = 2
		n >>= 1
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			maxPrime = i
			n = n / i
	if n > 2:
		maxPrime = n
	return int(maxPrime)

def prtable(n):
	dp = [0 for i in range(n + 1)]
	dp[1] = 1
	dp[2] = 2
	dp[3] = 3
	for i in range(4, n + 1):
		dp[i] = primes(i)
	return dp
pr = prtable(100000)
for i in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	d = {}
	for i in range(n):
		if pr[a[i]] in d:
			d[pr[a[i]]] += 1
		else:
			d[pr[a[i]]] = 1
	ans = 0
	maxx = 0
	for i in d:
		if d[i] > ans:
			ans = d[i]
			maxx = i
		elif d[i] == ans:
			if maxx < i:
				maxx = i
				ans = d[i]
	print(maxx)


from collections import Counter
import math as mt
MAXN = 100001
spf = [0 for i in range(MAXN)]

def sieve():
	spf[1] = 1
	for i in range(2, MAXN):
		spf[i] = i
	for i in range(4, MAXN, 2):
		spf[i] = 2
	for i in range(3, mt.ceil(mt.sqrt(MAXN))):
		if spf[i] == i:
			for j in range(i * i, MAXN, i):
				if spf[j] == j:
					spf[j] = i

def getFactorization(x):
	ret = list()
	while x != 1:
		ret.append(spf[x])
		x = x // spf[x]
	return ret.pop()
sieve()
t = int(input())
for test in range(t):
	n = int(input())
	A = tuple(map(int, input().split()))
	li = []
	mx = 1
	mx_li = []
	for a in A:
		li.append(getFactorization(a))
	c = Counter(li)
	for key in c:
		if c[key] > mx:
			mx_li = [key]
			mx = c[key]
		elif c[key] == mx:
			mx_li.append(key)
	print(max(mx_li))


def prime(num):
	if n > 1:
		for i in range(2, int(num ** 0.5) + 1):
			if num % i == 0:
				return False
				break
		else:
			return True
	else:
		return False
t = int(input())
for k in range(t):
	n = int(input())
	a = [0] * n
	l = list(map(int, input().split()))
	s = max(l)
	a1 = [0] * (s + 1)
	i = 2
	while i <= s:
		if prime(i):
			for j in range(i, s + 1, i):
				a1[j] = i
		i += 1
	for j in range(n):
		a[j] = a1[l[j]]
	a.sort()
	ti = 1
	ma = 1
	nu = a[0]
	for j in range(1, n):
		if a[j] == a[j - 1]:
			ti += 1
		else:
			if ti >= ma:
				ma = ti
				nu = a[j - 1]
			ti = 1
	if ti >= ma:
		ma = ti
		nu = a[n - 1]
	print(nu)


from collections import Counter
from math import sqrt

def facts(n):
	if n % 2 == 0:
		yield 2
		while n % 2 == 0:
			n //= 2
	for i in range(3, int(sqrt(n)) + 1, 2):
		if n % i == 0:
			yield i
			while n % i == 0:
				n //= i
	if n > 2:
		yield n
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	ms = [max(facts(i)) for i in a]
	cnt = Counter(ms)
	m = max(cnt.values())
	x = {i for i in ms if cnt[i] == m}
	print(max(x))