There are $n$ people who want to participate in a boat competition. The weight of the $i$-th participant is $w_i$. Only teams consisting of two people can participate in this competition. As an organizer, you think that it's fair to allow only teams with the same total weight.

So, if there are $k$ teams $(a_1, b_1)$, $(a_2, b_2)$, $\dots$, $(a_k, b_k)$, where $a_i$ is the weight of the first participant of the $i$-th team and $b_i$ is the weight of the second participant of the $i$-th team, then the condition $a_1 + b_1 = a_2 + b_2 = \dots = a_k + b_k = s$, where $s$ is the total weight of each team, should be satisfied.

Your task is to choose such $s$ that the number of teams people can create is the maximum possible. Note that each participant can be in no more than one team.

You have to answer $t$ independent test cases.


-----Input-----

The first line of the input contains one integer $t$ ($1 \le t \le 1000$) — the number of test cases. Then $t$ test cases follow.

The first line of the test case contains one integer $n$ ($1 \le n \le 50$) — the number of participants. The second line of the test case contains $n$ integers $w_1, w_2, \dots, w_n$ ($1 \le w_i \le n$), where $w_i$ is the weight of the $i$-th participant.


-----Output-----

For each test case, print one integer $k$: the maximum number of teams people can compose with the total weight $s$, if you choose $s$ optimally.


-----Example-----
Input
5
5
1 2 3 4 5
8
6 6 6 6 6 6 8 8
8
1 2 2 1 2 1 1 2
3
1 3 3
6
1 1 3 4 2 2

Output
2
3
4
1
2



-----Note-----

In the first test case of the example, we can reach the optimal answer for $s=6$. Then the first boat is used by participants $1$ and $5$ and the second boat is used by participants $2$ and $4$ (indices are the same as weights).

In the second test case of the example, we can reach the optimal answer for $s=12$. Then first $6$ participants can form $3$ pairs.

In the third test case of the example, we can reach the optimal answer for $s=3$. The answer is $4$ because we have $4$ participants with weight $1$ and $4$ participants with weight $2$.

In the fourth test case of the example, we can reach the optimal answer for $s=4$ or $s=6$.

In the fifth test case of the example, we can reach the optimal answer for $s=3$. Note that participant with weight $3$ can't use the boat because there is no suitable pair for him in the list.

Source: codeforces | Difficulty: EASY
Tags: Complete search

Amortized analysis

Greedy algorithms


Solutions:
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a = sorted(a)
	ans = 0
	for now in range(2 * n + 1):
		ta = 0
		i = 0
		j = n - 1
		while i < j:
			if a[i] + a[j] == now:
				ta += 1
				i += 1
				j -= 1
			elif a[i] + a[j] > now:
				j -= 1
			else:
				i += 1
		ans = max(ans, ta)
	print(ans)


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

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s)])

def invr():
	return map(int, input().split())
n = inp()
for _ in range(n):
	m = inp()
	l = inlt()
	l.sort()
	res = 0
	for t in range(m * 2 + 2):
		cnt = 0
		lp = 0
		rp = m - 1
		while lp < rp:
			if l[lp] + l[rp] < t:
				lp += 1
			elif l[lp] + l[rp] > t:
				rp -= 1
			else:
				cnt += 1
				lp += 1
				rp -= 1
		res = max(cnt, res)
	print(res)


from bisect import bisect_left as bl
from bisect import bisect_right as br
from heapq import heappush, heappop, heapify
import math
from collections import *
from functools import reduce, cmp_to_key
import sys
input = sys.stdin.readline
from itertools import accumulate
M = mod = 998244353

def factors(n):
	return sorted(set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0))))

def inv_mod(n):
	return pow(n, mod - 2, mod)

def li():
	return [int(i) for i in input().rstrip('\n').split()]

def st():
	return input().rstrip('\n')

def val():
	return int(input().rstrip('\n'))

def li2():
	return [i for i in input().rstrip('\n')]

def li3():
	return [int(i) for i in input().rstrip('\n')]
for _ in range(val()):
	n = val()
	l = li()
	ans = 0
	for j in range(1, 101):
		curr = 0
		m = Counter(l)
		for i in l:
			if j - i != i and m[j - i] and m[i]:
				m[j - i] -= 1
				m[i] -= 1
				curr += 1
			if j - i == i and m[i] > 1:
				m[i] -= 2
				curr += 1
		ans = max(ans, curr)
	print(ans)


for t in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a = sorted(a)
	if n == 1:
		ans = 0
	else:
		mini = a[0] + a[1]
		maxi = a[n - 2] + a[n - 1]
		ans = 0
		for k in range(mini, maxi + 1):
			count = 0
			i = 0
			j = n - 1
			while i < j:
				if a[i] + a[j] == k:
					count += 1
					i += 1
					j -= 1
				elif a[i] + a[j] > k:
					j -= 1
				else:
					i += 1
			ans = max(ans, count)
	print(ans)


from collections import *
for s in [*open(0)][2::2]:
	c = Counter(map(int, s.split()))
	r = [0] * 101
	for x in c:
		for y in c:
			r[x + y] += min(c[x], c[y])
	print(max(r) // 2)


import sys
from math import sqrt, gcd, ceil, log
from collections import defaultdict, Counter, deque
input = sys.stdin.readline
read = lambda : list(map(int, input().strip().split()))

def f(arr, n):
	dic = defaultdict(int)
	ans = 0
	for i in arr:
		if i < n:
			if dic[i] > 0:
				ans += 1
				dic[i] -= 1
			else:
				dic[n - i] += 1
	return ans

def main():
	ans_ = []
	for _ in range(int(input())):
		n = int(input())
		arr = read()
		ans = 0
		for i in range(1, 102):
			ans = max(ans, f(arr, i))
		ans_.append(str(ans))
	print('\n'.join(ans_))
main()


from collections import deque
from collections import OrderedDict
import math
import sys
import os
import threading
import bisect
import operator
import heapq
from atexit import register
from io import BytesIO
import io
input = lambda : sys.stdin.readline().rstrip('\r\n')

def binary_rep(n):
	l = []
	while n > 0:
		l.append(n % 2)
		n = n // 2
	return l
dM = 500
for _ in range(int(input())):
	n = int(input())
	ar = list(map(int, input().split()))
	dp = [0] * dM
	for i in range(n):
		dp[ar[i]] += 1
	dpAns = [0] * dM
	for i in range(dM):
		if dp[i] == 0:
			continue
		for j in range(i + 1, dM):
			if dp[j] == 0:
				continue
			dpAns[i + j] += min(dp[i], dp[j])
	for i in range(dM):
		if dp[i] != 0:
			dpAns[i * 2] += dp[i] // 2
	answer = max(dpAns)
	print(answer)


from collections import defaultdict
for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	if n == 1:
		print('0')
	else:
		l.sort()
		d = defaultdict(int)
		c = defaultdict(int)
		s = set()
		e = set()
		f = list()
		for i in range(n):
			c[l[i]] += 1
			e.add(l[i])
		for i in e:
			for j in e:
				if (i, j) in s or (j, i) in s:
					continue
				if i == j:
					d[i + j] += c[i] // 2
					s.add((i, j))
				else:
					d[i + j] += min(c[i], c[j])
					s.add((i, j))
					s.add((j, i))
		print(max(d.values()))


from collections import Counter
import io
import os
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline

def main():
	for t in range(int(input())):
		n = int(input())
		a = list(map(int, input().split()))
		ma = 0
		b = Counter()
		for i in range(n):
			b[a[i]] += 1
		for i in range(2, 2 * max(a) + 1):
			c = Counter()
			p = 0
			for j in range(n):
				if i - a[j] > 0:
					if i - a[j] != a[j]:
						if b[i - a[j]] > c[i - a[j]] and b[a[j]] > c[a[j]]:
							c[a[j]] += 1
							c[i - a[j]] += 1
							p += 1
					elif b[a[j]] - c[a[j]] >= 2:
						p += 1
						c[a[j]] += 2
			ma = max(ma, p)
		print(ma)
main()


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	mp = [0] * 102
	for i in a:
		mp[i] += 1
	ans = 0
	for i in range(1, 102):
		temp = 0
		for j in range(1, 51):
			temp += min(mp[j], mp[i - j])
		ans = max(ans, temp)
	print(ans // 2)


x = int(input())
for _ in range(x):
	n = int(input())
	eles = [int(num) for num in input().split(' ')]
	map_ = {}
	max_ = 0
	for i in range(len(eles) - 1):
		for j in range(i + 1, len(eles)):
			sum_ = eles[i] + eles[j]
			if sum_ in map_:
				if not i in map_[sum_]['index'] and (not j in map_[sum_]['index']):
					map_[sum_]['frequency'] += 1
					map_[sum_]['index'].append(i)
					map_[sum_]['index'].append(j)
					if map_[sum_]['frequency'] > max_:
						max_ = map_[sum_]['frequency']
			else:
				map_[sum_] = {'index': [i, j], 'frequency': 1}
				if map_[sum_]['frequency'] > max_:
					max_ = map_[sum_]['frequency']
	print(max_)


import copy

def f():
	n = int(input())
	ws = list(map(int, input().split()))
	mx = 0
	e = {}
	for i in range(n - 1):
		for j in range(i + 1, n):
			s = ws[i] + ws[j]
			if s not in e:
				e[s] = set([])
			e[s].add((i, j))
	for k in e:
		used = set([])
		t = 0
		for p in e[k]:
			if p[0] in used or p[1] in used:
				continue
			used.add(p[0])
			used.add(p[1])
			t += 1
		mx = max(mx, t)
	return mx
t = int(input())
for _ in range(t):
	print(f())


from sys import stdin, stdout
from math import gcd, sqrt
from collections import deque
input = stdin.readline
R = lambda : map(int, input().split())
I = lambda : int(input())
S = lambda : input().rstrip('\n')
L = lambda : list(R())
P = lambda x: stdout.write(x)
lcm = lambda x, y: x * y // gcd(x, y)
hg = lambda x, y: (y + x - 1) // x * x
pw = lambda x: 0 if x == 1 else 1 + pw(x // 2)
chk = lambda x: chk(x // 2) if not x % 2 else True if x == 1 else False
sm = lambda x: (x ** 2 + x) // 2
N = 10 ** 9 + 7
for _ in range(I()):
	n = I()
	a = L()
	if n == 1:
		print(0)
		continue
	v = [0] * 1000
	arr = [[] for i in range(n)]
	for i in range(n - 1):
		for j in range(i + 1, n):
			val = a[i] + a[j]
			if val not in arr[i] and val not in arr[j]:
				v[val] += 1
				arr[i] += (val,)
				arr[j] += (val,)
	print(max(v))


t = int(input())
for _ in range(t):
	n = int(input())
	li = [int(i) for i in input().split()]
	li1 = []
	ans = 0
	li.sort()
	for i in range(n):
		for j in range(i, n):
			li1.append(li[i] + li[j])
	for i in range(1, 2 * li1[-1] + 1):
		n1 = 0
		k = 0
		k1 = n - 1
		while k < k1:
			if li1[k] + li1[k1] == i:
				n1 += 1
				k += 1
				k1 -= 1
			elif li1[k] + li1[k1] >= i:
				k1 -= 1
			else:
				k += 1
		ans = max(ans, n1)
	print(ans)


from collections import Counter
for _ in range(int(input())):
	n = int(input())
	w = list(map(int, input().split()))
	cnt = Counter(w)
	ans = 0
	for s in range(2, 2 * n + 1):
		cur = 0
		for i in range(1, (s + 1) // 2):
			if s - i > n:
				continue
			cur += min(cnt[i], cnt[s - i])
		if s % 2 == 0:
			cur += cnt[s // 2] // 2
		ans = max(ans, cur)
	print(ans)


import sys
import io, os
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
for _ in range(int(input())):
	n = int(input())
	a = [int(i) for i in input().split() if i != '\n']
	freq = [0] * 101
	ok = False
	for i in a:
		freq[i] += 1
	maxa = 0
	for i in range(1, 101):
		copy = freq[:]
		ans = 0
		for j in a:
			if copy[j] > 0:
				copy[j] -= 1
				if i - j >= 0:
					if copy[i - j] > 0:
						copy[i - j] -= 1
						ans += 1
					else:
						copy[j] += 1
				else:
					copy[j] += 1
		maxa = max(ans, maxa)
	sys.stdout.write(str(maxa) + '\n')


from math import ceil
for ttt in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	res = [0] * (n + 1)
	for item in arr:
		res[item] += 1
	ans = 0
	for i in range(2, 2 * n + 1):
		cnt = 0
		for j in range(1, ceil(i / 2)):
			if i - j <= n:
				cnt += min(res[j], res[i - j])
		if i % 2 == 0:
			cnt += res[i // 2] // 2
		ans = max(ans, cnt)
	print(ans)


output = []
for _ in range(int(input())):
	n = int(input())
	arr = [int(i) for i in input().split()]
	a = [0] * (n + 1)
	for i in arr:
		a[i] += 1
	max_ = -1
	for s in range(2, 2 * n + 1):
		pairs = 0
		for i in range(1, (s + 1) // 2):
			if s - i > n:
				continue
			pairs += min(a[i], a[s - i])
		if s % 2 == 0:
			pairs += a[s // 2] // 2
		max_ = max(max_, pairs)
	output.append(max_)
for _ in output:
	print(_)


for _ in range(int(input())):
	n = int(input())
	lst = list(map(int, input().split()))
	ans = 0
	lst.sort()
	if len(lst) < 2:
		print(0)
		continue
	for i in range(lst[0] + lst[1], lst[-1] + lst[-2] + 1):
		temp = set([])
		count = 0
		for j in range(n):
			if j in temp:
				continue
			for k in range(j + 1, n):
				if lst[k] + lst[j] == i and k not in temp:
					count += 1
					temp.add(k)
					temp.add(j)
					break
		ans = max(ans, count)
	print(ans)


t = int(input())
for testcase in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	ans = 0
	cnt = [0] * (2 * n + 1)
	for a in arr:
		cnt[a] += 1
	for s in range(2, 2 * n + 1):
		curr = 0
		same = 0
		for i in range(1, (s + 1) // 2):
			curr += min(cnt[i], cnt[s - i])
		if s % 2 == 0:
			curr += cnt[s // 2] // 2
		ans = max(ans, curr)
	print(ans)


def pair(l1, n, sum):
	(l, r) = (0, n - 1)
	c = 0
	while l < r:
		s = l1[l] + l1[r]
		if s == sum:
			c += 1
			l += 1
			r -= 1
		elif s > sum:
			r -= 1
		elif s < sum:
			l += 1
	return c
t = int(input())
for _ in range(t):
	n = int(input())
	l1 = [int(i) for i in input().split()]
	l1.sort()
	ans = 0
	a = [0] * 101
	for i in range(2, 101):
		a[i] = pair(l1, n, i)
		ans = max(ans, a[i])
	print(ans)


def noOFTeams(w, s, n):
	res = 0
	i = 0
	j = n - 1
	while i < j:
		t = w[i] + w[j]
		if t == s:
			res += 1
			i += 1
			j -= 1
		elif t > s:
			j -= 1
		else:
			i += 1
	return res
for _ in range(int(input())):
	n = int(input())
	w = sorted(list(map(int, input().split())))
	if n < 2:
		print(0)
		continue
	ans = 0
	for s in range(2 * w[0], 2 * w[-1] + 1):
		t = noOFTeams(w, s, n)
		ans = max(ans, t)
	print(ans)


for _ in range(int(input())):
	n = int(input())
	ans = [set() for i in range(109)]
	s = list(map(int, input().split()))
	for i in range(n):
		for j in range(i + 1, n):
			w = s[i] + s[j]
			if i not in ans[w] and j not in ans[w]:
				ans[w].add(i)
				ans[w].add(j)
	print(max((len(i) for i in ans)) // 2)


from collections import defaultdict

def maxCountSameSUM(arr, n):
	M = defaultdict(lambda : 0)
	X = defaultdict(list)
	for i in range(0, n - 1):
		for j in range(i + 1, n):
			if i not in X[arr[i] + arr[j]] and j not in X[arr[i] + arr[j]]:
				M[arr[i] + arr[j]] += 1
				X[arr[i] + arr[j]].append(i)
				X[arr[i] + arr[j]].append(j)
	max_count = 0
	for ele in M:
		if max_count < M[ele]:
			max_count = M[ele]
	return max_count
t = int(input())
for i in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	print(maxCountSameSUM(arr, n))


t = int(input())
for _ in range(t):
	n = int(input())
	w = list(map(int, input().split()))
	m = min(w)
	M = max(w)
	ans = 0
	for i in range(m * 2, M * 2 + 1):
		d = dict()
		tmp = 0
		for x in w:
			if i - x in d and d[i - x] > 0:
				d[i - x] -= 1
				tmp += 1
			elif x in d:
				d[x] += 1
			else:
				d[x] = 1
		if ans < tmp:
			ans = tmp
	print(ans)


import math
for test in range(int(input())):
	n = int(input())
	w = [int(i) for i in input().split()]
	if n == 1:
		print(0)
		continue
	w.sort()
	bot_test = w[0] + w[1]
	top_test = w[n - 2] + w[n - 1]
	k = 0
	count_dict = {}
	for i in range(top_test + 1):
		count_dict[i] = w.count(i)
	for s in range(bot_test, top_test + 1):
		current_k = 0
		for i in range(math.floor(s / 2) + 1):
			if i == s / 2:
				current_k += math.floor(count_dict[i] / 2)
			else:
				current_k += min(count_dict[i], count_dict[s - i])
		if current_k > k:
			k = current_k
	print(k)


import sys
input = sys.stdin.readline

def ceil(x):
	if x != int(x):
		x = int(x) + 1
	return x

def swaparr(arr, a, b):
	temp = arr[a]
	arr[a] = arr[b]
	arr[b] = temp

def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)

def nCr(n, k):
	if k > n - k:
		k = n - k
	res = 1
	for i in range(k):
		res = res * (n - i)
		res = res / (i + 1)
	return int(res)

def upper_bound(a, x, lo=0, hi=None):
	if hi == None:
		hi = len(a)
	while lo < hi:
		mid = (lo + hi) // 2
		if a[mid] < x:
			lo = mid + 1
		else:
			hi = mid
	return lo

def primefs(n):
	primes = {}
	while n % 2 == 0 and n > 0:
		primes[2] = primes.get(2, 0) + 1
		n = n // 2
	for i in range(3, int(n ** 0.5) + 2, 2):
		while n % i == 0 and n > 0:
			primes[i] = primes.get(i, 0) + 1
			n = n // i
	if n > 2:
		primes[n] = primes.get(n, 0) + 1
	return primes

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def swap(a, b):
	temp = a
	a = b
	b = temp
	return (a, b)

def find(x, link):
	p = x
	while p != link[p]:
		p = link[p]
	while x != p:
		nex = link[x]
		link[x] = p
		x = nex
	return p

def union(x, y, link, size):
	x = find(x, link)
	y = find(y, link)
	if size[x] < size[y]:
		(x, y) = swap(x, y)
	if x != y:
		size[x] += size[y]
		link[y] = x

def sieve(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime
MAXN = int(100000.0 + 5)

def spf_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, ceil(MAXN ** 0.5), 2):
		if spf[i] == i:
			for j in range(i * i, MAXN, i):
				if spf[j] == j:
					spf[j] = i

def factoriazation(x):
	ret = {}
	while x != 1:
		ret[spf[x]] = ret.get(spf[x], 0) + 1
		x = x // spf[x]
	return ret

def int_array():
	return list(map(int, input().strip().split()))

def float_array():
	return list(map(float, input().strip().split()))

def str_array():
	return input().strip().split()
MOD = int(1000000000.0) + 7
CMOD = 998244353
INF = float('inf')
NINF = -float('inf')
for _ in range(int(input())):
	n = int(input())
	a = sorted(int_array())
	ans = 0
	for s in range(2, 2 * n + 1):
		i = 0
		j = n - 1
		cnt = 0
		while i < j:
			if a[i] + a[j] == s:
				cnt += 1
				j -= 1
				i += 1
			elif a[i] + a[j] < s:
				i += 1
			else:
				j -= 1
		ans = max(ans, cnt)
	print(ans)


def g(arr, n, sum):
	count = 0
	a = [False] * n
	for i in range(0, n):
		for j in range(i + 1, n):
			if arr[i] + arr[j] == sum and (not a[i]) and (not a[j]):
				count += 1
				a[i] = True
				a[j] = True
	return count
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	b = []
	for i in range(2 * n + 1):
		b.append(g(a, n, i))
	print(max(b))


import math
import sys
from collections import Counter
input = sys.stdin.readline

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

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return s[:len(s) - 1]

def invr():
	return map(int, input().split())

def fn(val, W):
	C = Counter(W)
	out = 0
	for i in range(len(W)):
		if C[W[i]] > 0:
			C[W[i]] -= 1
			if C[val - W[i]] > 0:
				out += 1
				C[val - W[i]] -= 1
	return out
T = inp()
for t in range(T):
	N = inp()
	W = inlt()
	out = 0
	for i in range(1, 2 * (max(W) + 1)):
		out = max(out, fn(i, W))
	print(out)


for i in range(int(input())):
	n = int(input())
	w = list(map(int, input().split()))
	counts = [0] * 52
	ans = 0
	for j in range(n):
		counts[w[j]] += 1
	for j in range(2, n * 2 + 1):
		c = 0
		for k in range(1, (j + 1) // 2):
			if j - k > n:
				continue
			c += min(counts[k], counts[j - k])
		ans = max(c, ans) if j % 2 != 0 else max(c + counts[j // 2] // 2, ans)
	print(ans)


import sys
from collections import Counter

def input():
	return sys.stdin.readline().strip()

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]

def list4d(a, b, c, d, e):
	return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]

def ceil(x, y=1):
	return int(-(-x // y))

def INT():
	return int(input())

def MAP():
	return map(int, input().split())

def LIST(N=None):
	return list(MAP()) if N is None else [INT() for i in range(N)]

def Yes():
	print('Yes')

def No():
	print('No')

def YES():
	print('YES')

def NO():
	print('NO')
INF = 10 ** 19
MOD = 10 ** 9 + 7
for _ in range(INT()):
	N = INT()
	A = LIST()
	ans = 0
	for i in range(1, N * 2 + 1):
		used = [0] * N
		C = Counter(A)
		cnt = 0
		for (j, a) in enumerate(A):
			if a == i - a:
				if C[a] >= 2:
					C[a] -= 2
					cnt += 1
			elif C[a] and C[i - a]:
				C[a] -= 1
				C[i - a] -= 1
				cnt += 1
		ans = max(ans, cnt)
	print(ans)


import sys
from math import floor
from collections import defaultdict

def main():
	T = int(sys.stdin.readline())
	while T:
		T -= 1
		N = int(sys.stdin.readline())
		W = sorted([int(i) for i in sys.stdin.readline().strip().split(' ')])
		WOC = defaultdict(lambda : 0)
		for w in W:
			WOC[w] += 1
		if N in (0, 1):
			print(0)
			continue
		if N == 2:
			print(1)
			continue
		ans = 0
		unique_w = list(WOC.keys())
		checked_weight = set()
		for i in range(len(unique_w)):
			for j in range(i, len(unique_w)):
				if i == j and WOC[unique_w[j]] < 2:
					continue
				s = unique_w[i] + unique_w[j]
				if s in checked_weight:
					continue
				checked_weight.add(s)
				ans = max(ans, comb_chk(s, WOC))
		print(ans)

def comb_chk(s, WOC):
	ret = 0
	W = list(WOC.keys())
	for w in W:
		if w > s / 2:
			continue
		cp = s - w
		if cp != w and WOC[cp] > 0:
			ret += min(WOC[w], WOC[cp])
		elif cp == w and WOC[cp] > 1:
			ret += floor(WOC[cp] / 2)
	return ret
main()


t = int(input())

def solve(a):
	n = len(a)
	if n == 1:
		return 0
	if n == 2 or n == 3:
		return 1
	m = a[0] + a[1]
	M = a[-1] + a[-2]
	ans = 0
	for curSum in range(m, M + 1):
		i = 0
		j = len(a) - 1
		tempAns = 0
		while i < j:
			if a[i] + a[j] == curSum:
				tempAns += 1
				i += 1
				j -= 1
			elif a[i] + a[j] > curSum:
				j -= 1
			else:
				i += 1
		ans = max(ans, tempAns)
	return ans
while t > 0:
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	print(solve(a))
	t -= 1


import math

def facts(n):
	ans = []
	for i in range(2, int(math.sqrt(n) + 1)):
		if n % i == 0:
			ans.append(i)
			ans.append(n // i)
	ans = sorted(ans)
	return ans
for _ in range(int(input())):
	n = int(input())
	ps = list(map(int, input().split()))
	check = [1 for i in range(n)]
	ans = 0
	dcheck = list(check)
	for i in range(2 * n + 1):
		tmp = 0
		for a in range(n):
			for b in range(a + 1, n):
				if dcheck[a] and dcheck[b]:
					if ps[a] + ps[b] == i:
						tmp += 1
						(dcheck[a], dcheck[b]) = (0, 0)
		dcheck = list(check)
		ans = max(tmp, ans)
	print(ans)


from collections import Counter
for _ in range(int(input())):
	n = int(input())
	w = list(map(int, input().split()))
	a = Counter(w)
	ans = [0 for i in range(2 * n + 1)]
	for i in a:
		for j in a:
			ans[i + j] += min(a[i], a[j])
	print(max(ans) // 2)


def c(arr, n):
	count = [0] * 101
	c = 0
	best = 0
	for i in arr:
		count[i] += 1
	for s in range(2, 2 * n + 1):
		c = 0
		for i in range(1, (s + 1) // 2):
			if s - i > n:
				continue
			c += min(count[i], count[s - i])
		if s % 2 == 0:
			c += count[s // 2] // 2
		best = max(best, c)
	return best
t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	print(c(arr, n))


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	team = dict([(i, 0) for i in range(2, 101)])
	for target in range(2, 101):
		(l, r) = (0, n - 1)
		while l < r:
			if arr[l] + arr[r] == target:
				team[target] += 1
				l += 1
				r -= 1
			elif arr[l] + arr[r] > target:
				r -= 1
			else:
				l += 1
	maxm = -10 ** 18
	for key in team:
		maxm = max(team[key], maxm)
	print(maxm)


import os
import sys
from math import *
from collections import *
from fractions import *
from bisect import *
from heapq import *
from io import BytesIO, IOBase

def vsInput():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
ALPHA = 'abcdefghijklmnopqrstuvwxyz'
M = 1000000007

def value():
	return tuple(map(int, input().split()))

def array():
	return [int(i) for i in input().split()]

def Int():
	return int(input())

def Str():
	return input()

def arrayS():
	return [i for i in input().split()]
for _ in range(Int()):
	n = Int()
	a = array()
	ans = 0
	for s in range(1, 101):
		C = Counter(a)
		Tans = 0
		for i in a:
			s1 = i
			s2 = s - i
			if s1 == s2 and C[s1] > 1:
				C[s1] -= 2
				Tans += 1
			if s1 != s2 and C[s2] > 0 and (C[s1] > 0):
				C[s2] -= 1
				C[s1] -= 1
				Tans += 1
		ans = max(Tans, ans)
		C.clear()
	print(ans)


for _ in range(int(input())):
	n = int(input())
	w = list(map(int, input().split()))
	cnt = [0] * (n + 1)
	for i in range(n):
		cnt[w[i]] += 1
	res = 0
	for s in range(2, 2 * n + 1):
		temp = 0
		for i in range(max(1, s - n), min(n, s) + 1):
			temp += min(cnt[i], cnt[s - i])
		res = max(res, temp)
	print(int(res / 2))


t = int(input())
while t > 0:
	n = int(input())
	w = list(map(int, input().split(' ')))
	m = {}
	for i in range(n):
		for j in range(i + 1, n):
			_sum = w[i] + w[j]
			if _sum in m and i not in m[_sum] and (j not in m[_sum]):
				m[_sum].add(i)
				m[_sum].add(j)
			elif _sum not in m:
				m[_sum] = set()
				m[_sum].add(i)
				m[_sum].add(j)
	best = 0
	for i in m:
		l = len(m[i]) // 2
		if l > best:
			best = l
	print(best)
	t -= 1


test = int(input())
while test > 0:
	n = int(input())
	wts = list(map(int, input().split()))
	mp = dict()
	for j in range(n):
		if wts[j] in mp:
			mp[wts[j]] += 1
		else:
			mp[wts[j]] = 1
	max_count = 0
	for i in range(1, 2 * n + 1, 1):
		count = 0
		for k in mp:
			if i == 2 * k:
				count += mp[k] // 2 * 2
			else:
				count += min((mp[k], mp[i - k] if i - k in mp else 0))
		max_count = max((max_count, count // 2))
	print(max_count)
	test -= 1


def merge_sort(arr, n):
	if n == 1:
		return [arr[0]]
	mid = int(n / 2)
	if n % 2 != 0:
		mid = mid + 1
	l_arr = []
	r_arr = []
	for i in range(n):
		if i < mid:
			l_arr.append(arr[i])
		else:
			r_arr.append(arr[i])
	lr = merge_sort(l_arr, len(l_arr))
	rr = merge_sort(r_arr, len(r_arr))
	arr_sorted = merger(lr, rr, len(lr), len(rr))
	return arr_sorted

def merger(lr, rr, len_l, len_r):
	sorted_temp = []
	i = 0
	j = 0
	while i < len_l and j < len_r:
		if lr[i] < rr[j]:
			sorted_temp.append(lr[i])
			i = i + 1
		else:
			sorted_temp.append(rr[j])
			j = j + 1
	if len_l - i > 0:
		for itr1 in range(len_l - i):
			sorted_temp.append(lr[itr1 + i])
	elif len_r - j > 0:
		for itr1 in range(len_r - j):
			sorted_temp.append(rr[itr1 + j])
	return sorted_temp
t = int(input())
for i in range(t):
	n = int(input())
	input_string = input()
	input_data = input_string.split(' ')
	arr = [int(x) for x in input_data]
	sort_arr = merge_sort(arr, len(arr))
	i = 0
	j = len(sort_arr) - 1
	max_teams = 0
	temp_num_teams = 0
	temp_sum = sort_arr[i] + sort_arr[j]
	new_sum = temp_sum
	for s in range(2, 2 * len(sort_arr) + 1):
		i = 0
		j = len(sort_arr) - 1
		temp_num_teams = 0
		while i < j:
			temp_sum = sort_arr[i] + sort_arr[j]
			if temp_sum < s:
				i = i + 1
			elif temp_sum > s:
				j = j - 1
			else:
				temp_num_teams = temp_num_teams + 1
				i = i + 1
				j = j - 1
		if max_teams < temp_num_teams:
			max_teams = temp_num_teams
	print(max_teams)


for _ in range(int(input())):
	n = int(input())
	wt = list(map(int, input().split()))
	count = {}
	for x in wt:
		if x not in count:
			count[x] = 0
		count[x] += 1
	k = 0
	for s in range(101):
		temp = 0
		temp2 = 0
		for x in count:
			if s - x in count:
				if s - x == x:
					temp2 += count[x] // 2
				else:
					temp += min(count[x], count[s - x])
		k = max(k, temp // 2 + temp2)
	print(k)


t = int(input())
while t != 0:
	n = int(input())
	list1 = list(map(int, input().split()))
	d = {}
	list1.sort()
	for i in range(n):
		for j in range(i + 1, n):
			if list1[i] + list1[j] in d.keys():
				if i not in d[list1[i] + list1[j]]:
					if j not in d[list1[i] + list1[j]]:
						d[list1[i] + list1[j]].append(i)
						d[list1[i] + list1[j]].append(j)
			else:
				d[list1[i] + list1[j]] = [i, j]
	maxi = 0
	for i in d.keys():
		maxi = max(maxi, len(d[i]) // 2)
	print(maxi)
	t -= 1


from collections import defaultdict
t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	g = defaultdict(set)
	for i in range(n):
		for j in range(i + 1, n):
			x = arr[i] + arr[j]
			if i not in g[x] and j not in g[x]:
				g[x].add(i)
				g[x].add(j)
	maxy = 0
	for i in g:
		if len(g[i]) > maxy:
			maxy = len(g[i])
	print(maxy // 2)


def freqCount(arr, n, Sum):
	i = 0
	j = n - 1
	count = 0
	while j > i:
		x = arr[i] + arr[j]
		if x == Sum:
			count += 1
			i += 1
			j -= 1
		elif x < Sum:
			i += 1
		else:
			j -= 1
	return count
t = int(input())
for k in range(t):
	n = int(input())
	arr = [int(x) for x in input().split()]
	arr.sort()
	freq_arr = [0] * 101
	for j in range(2, 101):
		freq_arr[j] = freqCount(arr, n, j)
	print(max(freq_arr))


from collections import defaultdict
for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	d = defaultdict(set)
	z = [0 for i in range(20)]
	ans = 0
	for i in range(n):
		for j in range(i + 1, n):
			k = l[i] + l[j]
			if i not in d[k] and j not in d[k]:
				d[k].add(i)
				d[k].add(j)
				ans = max(ans, len(d[k]))
	print(ans // 2)


import itertools as it
from collections import defaultdict
for i in range(int(input())):
	n = int(input())
	ar = list(map(int, input().split()))
	d = defaultdict(list)
	for j in range(1, n):
		if len(d[ar[0] + ar[j]]) == 0:
			d[ar[0] + ar[j]] += [0]
			d[ar[0] + ar[j]] += [j]
		elif 0 and j not in d[ar[0] + ar[j]]:
			d[ar[0] + ar[j]] += [0]
			d[ar[0] + ar[j]] += [j]
	for i in range(1, n):
		for j in range(i + 1, n):
			if i not in d[ar[i] + ar[j]] and j not in d[ar[i] + ar[j]]:
				d[ar[i] + ar[j]] += [i]
				d[ar[i] + ar[j]] += [j]
	m = 0
	for i in d.values():
		m = max(len(i) // 2, m)
	print(m)


import collections

def key_with_max_value(d1):
	return [k for (k, v) in d1.items() if v == max(d1.values())][0]
t = int(input())
for _ in range(t):
	n = int(input())
	w = list(map(int, input().split()))
	cnt = collections.Counter(w)
	ans = 0
	for s in range(2, 2 * n + 1):
		teams = 0
		for i in range(1, (s + 1) // 2):
			if s - i > n:
				continue
			teams += min(cnt[i], cnt[s - i])
		if s % 2 == 0:
			teams += cnt[s // 2] // 2
		ans = max(teams, ans)
	print(ans)


import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	n = int(input())
	w = list(map(int, input().split()))
	res = 0
	for s in range(1, 101):
		freq = [0 for i in range(51)]
		for i in range(n):
			freq[w[i]] += 1
		ans = 0
		for i in range(n):
			if w[i] >= s or s - w[i] > 50 or freq[s - w[i]] == 0 or (freq[w[i]] == 0):
				continue
			if w[i] == s - w[i] and freq[w[i]] == 1:
				continue
			ans += 1
			freq[s - w[i]] -= 1
			freq[w[i]] -= 1
		res = max(res, ans)
	print(res)


for ip in [*open(0)][2::2]:
	a = list(map(int, ip.split()))
	n = len(a)
	ans = 0
	c = [0] * (n + 1)
	for x in a:
		c[x] += 1
	for s in range(2, 2 * n + 1):
		temp = 0
		for i in range(1, s + 1 >> 1):
			if s - i > n:
				continue
			temp += min(c[i], c[s - i])
		if not s & 1:
			temp += c[s >> 1] >> 1
		ans = max(ans, temp)
	print(ans)


t = int(input())
for i in range(t):
	n = int(input())
	w = list(map(int, input().split()))
	w.sort()
	m = dict()
	for x in w:
		if m.get(x) is None:
			m[x] = 1
		else:
			m[x] += 1
	max = 0
	for s in range(101):
		k = 0
		for key in m:
			if m.get(key) is not None and m.get(s - key) is not None and (s > 2 * key):
				k += min(m[key], m[s - key])
			if s == 2 * key:
				k += m[key] // 2
		if k > max:
			max = k
	print(max)


nt = int(input())

def helper(arr):
	if len(arr) < 2:
		return 0
	out = 1
	t = arr[0] + arr[-1]
	(i, j) = (1, len(arr) - 2)
	while i < j:
		if arr[i] + arr[j] == t:
			(out, i, j) = (out + 1, i + 1, j - 1)
		elif arr[i] + arr[j] > t:
			j = j - 1
		else:
			i = i + 1
	return out
for test in range(nt):
	n = int(input())
	w = list(map(int, input().strip().split()))
	w.sort()
	ans = 0
	ts = set()
	for i in range(len(w)):
		for j in range(len(w), i, -1):
			if w[i] + w[j - 1] not in ts:
				ans = max(ans, helper(w[i:j]))
				ts.add(w[i] + w[j - 1])
	print(ans)


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	d1 = {}
	for i in a:
		if i in d1:
			d1[i] += 1
		else:
			d1[i] = 1
	ans = 0
	ss = {}
	for s in range(min(a) * 2, max(a) * 2 + 1):
		no_teams = 0
		d = dict(d1)
		for j in a:
			if j < s:
				if d[j] > 0 and (s - j == j and d[j] >= 2 or (s - j != j and s - j in d and (d[s - j] > 0))):
					if j == s - j:
						w = d[j] // 2
					else:
						w = min(d[j], d[s - j])
					no_teams += w
					d[j] -= w
					d[s - j] -= w
		ans = max(ans, no_teams)
	print(ans)


t = int(input())
for _ in range(t):
	n = int(input())
	arr = [int(i) for i in input().split()]
	arr.sort()
	dic = {}
	for i in range(1, 101):
		dic[i] = 0
	for s in dic:
		i = 0
		j = n - 1
		while i < j:
			if arr[i] + arr[j] < s:
				i += 1
			elif arr[i] + arr[j] > s:
				j -= 1
			else:
				dic[s] += 1
				i += 1
				j -= 1
	ans = 0
	for i in dic:
		if dic[i] > ans:
			ans = dic[i]
	print(ans)


from collections import defaultdict
for _ in range(int(input())):
	n = int(input())
	a = [int(i) for i in input().split()]
	a.sort()
	if len(a) == 1:
		print(0)
	else:
		mi = a[0] + a[1]
		ma = a[n - 1] + a[n - 2]
		ans = 0
		for i in range(mi, ma + 1):
			s = 0
			e = n - 1
			count = 0
			while s < e:
				if a[s] + a[e] == i:
					s += 1
					e -= 1
					count += 1
				elif a[s] + a[e] < i:
					s += 1
				else:
					e -= 1
			ans = max(ans, count)
		print(ans)


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	m = {}
	for i in arr:
		if i in m:
			m[i] += 1
		else:
			m[i] = 1
	maxi = 0
	for s in range(2, 2 * max(arr) + 1):
		tot = 0
		equals = 0
		for i in m.keys():
			first = i
			second = s - i
			if second > 0 and second in m:
				if first == second:
					equals = m[first] // 2
				else:
					tot += min(m[first], m[second])
		tot = equals + tot // 2
		maxi = max(maxi, tot)
	print(maxi)


import sys

def parse_array(array_str, n):
	array_str = array_str.split(sep=' ')
	arr = {}
	max_num = 0
	max_num2 = 0
	min_num = sys.maxsize
	min_num2 = sys.maxsize
	for i in range(0, n):
		num = int(array_str[i])
		if num in arr:
			arr[num] = arr[num] + 1
		else:
			arr[num] = 1
		if num > max_num:
			if max_num > max_num2:
				max_num2 = max_num
			max_num = num
		elif num > max_num2:
			max_num2 = num
		if num < min_num:
			if min_num < min_num2:
				min_num2 = min_num
			min_num = num
		elif num < min_num2:
			min_num2 = num
	if n < 2:
		maxw = 0
		minw = 0
	elif n == 2:
		maxw = int(array_str[0]) + int(array_str[1])
		minw = int(array_str[0]) + int(array_str[1])
	else:
		maxw = max_num + max_num2
		minw = min_num + min_num2
	return (maxw, minw, arr)

def get_max_teams(maxw, minw, arr):
	weight_range = range(minw, maxw + 1)
	optimal_s = 0
	optimal_teams = 0
	for s in weight_range:
		teams_count = 0
		visited = {}
		for i in arr.keys():
			if not s - i in arr.keys():
				continue
			if s - i in visited:
				continue
			if s - i == i:
				new_teams = int(arr[i] / 2)
			else:
				new_teams = min(arr[i], arr[s - i])
			visited[i] = True
			visited[s - i] = True
			teams_count = teams_count + new_teams
		if teams_count > optimal_teams:
			optimal_teams = teams_count
			optimal_s = s
	return (optimal_s, optimal_teams)
test_cases = int(input(''))
for a in range(0, test_cases):
	n = int(input(''))
	array_str = input('')
	(maxw, minw, arr) = parse_array(array_str, n)
	(s, k) = get_max_teams(maxw, minw, arr)
	print(k)


from collections import defaultdict

def count(k):
	ans = 0
	l = 0
	r = len(arr) - 1
	while l < r:
		if arr[l] + arr[r] > k:
			r -= 1
		elif arr[l] + arr[r] < k:
			l += 1
		else:
			ans += 1
			l += 1
			r -= 1
	return ans
for i in range(int(input())):
	n = int(input())
	arr = [int(i) for i in input().split()]
	arr.sort()
	dp = [0] * 101
	for i in range(1, 101):
		dp[i] = count(i)
	print(max(dp))


t = int(input())
for t_c in range(t):
	n = int(input())
	w = [int(i) for i in input().split(' ')]
	counts = [0 for i in range(101)]
	for cw in w:
		counts[cw] += 1
	poss = [0 for i in range(101)]
	for i in range(1, len(poss)):
		for j in range(1, i // 2 + 1):
			if 2 * j != i:
				poss[i] += min([counts[j], counts[i - j]])
			else:
				poss[i] += counts[j] // 2
	c_max = 0
	max_pos = 0
	for i in range(1, len(poss)):
		if poss[i] > c_max:
			max_pos = i
			c_max = poss[i]
	print(c_max)


from collections import defaultdict, Counter
for i in range(int(input())):
	n = int(input())
	a = input()
	a = a.split()
	a = list(map(int, a))
	C = Counter(a)
	sum = defaultdict(int)
	for p in C:
		for q in C:
			if p <= q:
				sum[p + q] += min(C[p], C[q]) if p != q else C[p] // 2
	print(max(sum.values()))


import math
from collections import deque
from sys import stdin, stdout
from string import ascii_letters
input = stdin.readline
letters = ascii_letters[:26]

def check(arr, s):
	n = len(arr)
	taken = [0] * n
	res = 0
	for i in range(n):
		for g in range(i + 1, n):
			if i != g and (not taken[i]) and (not taken[g]) and (arr[i] + arr[g] == s):
				taken[i] = 1
				taken[g] = 1
				res += 1
	return res
for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	res = dict()
	for i in range(n):
		for g in range(i + 1, n):
			need = arr[i] + arr[g]
			if need not in res:
				res[need] = 0
			res[need] += 1
	ans = 0
	if len(res):
		need = max(res.values())
		for (key, val) in res.items():
			ans = max(ans, check(arr, key))
	print(ans)


for s in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	short = [0 for i in range(51)]
	long = [0 for i in range(101)]
	for i in range(n):
		short[a[i]] += 1
	I = 1
	J = 50
	while I <= J:
		i = I
		j = J
		while i <= j:
			if i == j:
				long[i + j] += short[i] // 2
			else:
				long[i + j] += min(short[i], short[j])
			j -= 1
		I += 1
	maxi = 0
	for i in long:
		maxi = max(maxi, i)
	print(maxi)


import sys
import math
import heapq
import collections

def inputnum():
	return int(input())

def inputnums():
	return map(int, input().split())

def inputlist():
	return list(map(int, input().split()))

def inputstring():
	return [x for x in input()]

def inputmatrixchar(rows):
	arr2d = [[j for j in input().strip()] for i in range(rows)]
	return arr2d

def inputmatrixint(rows):
	arr2d = []
	for _ in range(rows):
		arr2d.append([int(i) for i in input().split()])
	return arr2d
t = int(input())
for q in range(t):
	n = inputnum()
	w = inputlist()
	w.sort()
	ans = 0
	for i in range(2, 101):
		cur = 0
		start = 0
		end = n - 1
		while start < end:
			if w[start] + w[end] == i:
				cur += 1
				start += 1
				end -= 1
			elif w[start] + w[end] > i:
				end -= 1
			else:
				start += 1
		ans = max(cur, ans)
	print(ans)


for _ in range(int(input())):
	n = int(input())
	w = [int(x) for x in input().split()]
	d = {}
	if n == 1:
		print(0)
	else:
		v = []
		for i in w:
			if i not in d:
				d[i] = 1
				v.append(i)
			else:
				d[i] += 1
		sums = {}
		for i in range(len(v)):
			if d[v[i]] != 1:
				if v[i] * 2 not in sums:
					sums[2 * v[i]] = d[v[i]] // 2
				else:
					sums[2 * v[i]] += d[v[i]] // 2
			for j in range(i + 1, len(v)):
				if i == j:
					continue
				t = v[i] + v[j]
				if t not in sums:
					sums[t] = min(d[v[i]], d[v[j]])
				else:
					sums[t] += min(d[v[i]], d[v[j]])
		print(max(sums.values()))


def getPairsCount(arr, n, sum):
	dic = {}
	for i in arr:
		if i in dic:
			dic[i] += 1
		else:
			dic[i] = 1
	ans = 0
	for i in dic:
		temp = sum - i
		if temp in dic:
			if i == temp:
				ans += dic[i] // 2
				dic[i] = 0
			else:
				ans += min(dic[i], dic[temp])
				dic[i] = 0
				dic[temp] = 0
	return ans

def func(arr1, n):
	arr1.sort()
	minSum = arr1[0] + arr1[1]
	maxSum = arr1[-1] + arr1[-2]
	ans = 0
	for i in range(minSum, maxSum + 1):
		ans = max(ans, getPairsCount(arr1, n, i))
	return ans

def main():
	for tc in range(int(input())):
		n = int(input())
		arr1 = [int(i) for i in input().split()]
		if n == 1:
			print(0)
		elif n <= 3:
			print(1)
		else:
			print(func(arr1, n))
main()


import sys
from collections import Counter
input = sys.stdin.buffer.readline

def I():
	return list(map(int, input().split()))

def sieve(n):
	a = [1] * n
	for i in range(2, n):
		if a[i]:
			for j in range(i * i, n, i):
				a[j] = 0
	return a
for __ in range(int(input())):
	n = int(input())
	arr = I()
	c = Counter(arr)
	ans = 0
	for s in range(1, 101):
		curr = 0
		c = Counter(arr)
		for i in range(n):
			if c[arr[i]] <= 0:
				continue
			if s == arr[i] * 2:
				if c[arr[i]] >= 2:
					curr += 1
					c[arr[i]] -= 2
					continue
			elif c[s - arr[i]] > 0:
				curr += 1
				c[s - arr[i]] -= 1
				c[arr[i]] -= 1
		ans = max(ans, curr)
	print(ans)


t = int(input())
for i in range(t):
	n = int(input())
	wl = list(map(int, input().split()))
	wl.sort()
	if n == 1:
		print(0)
		continue
	elif n == 2:
		print(1)
		continue
	maxx = wl[-1] + wl[-2]
	minn = wl[0] + wl[1]
	rans = -1
	for test in range(minn, maxx + 1):
		i = 0
		j = n - 1
		ans = 0
		while i < j:
			if wl[j] + wl[i] == test:
				ans += 1
				i += 1
				j -= 1
			elif wl[j] + wl[i] < test:
				i += 1
			else:
				j -= 1
		rans = max(ans, rans)
	print(rans)


import sys
from functools import lru_cache
from collections import defaultdict

def num(arr, target):
	m = defaultdict(int)
	c = 0
	for (e, n) in enumerate(arr):
		if m[target - n] > 0:
			c += 1
			m[target - n] -= 1
		else:
			m[n] += 1
	return c

def solve(arr):
	if len(arr) == 1:
		return 0
	arr.sort()
	l = arr[0] + arr[1]
	h = arr[-1] + arr[-1]
	max_teams = 1
	max_s = l
	for ss in range(l, h + 1):
		count = num(arr, ss)
		if count > max_teams:
			max_s = ss
			max_teams = count
	return max_teams

def main(mat):
	for arr in mat:
		print(solve(arr))
mat = []
for (e, line) in enumerate(sys.stdin.readlines()):
	if e == 0:
		continue
	elif e % 2 == 0:
		mat.append(list(map(int, line.strip().split())))
main(mat)


for _ in range(int(input())):
	n = int(input())
	w = list(map(int, input().split()))
	data = [0 for i in range(101)]
	for a in w:
		data[a] += 1
	ans = 0
	for s in range(1, 101):
		test = 0
		for j in range(1, s // 2 + 1):
			if 2 * j != s:
				test += min(data[j], data[s - j])
			else:
				test += data[j] // 2
		ans = max(ans, test)
	print(ans)


from collections import defaultdict, Counter
T = int(input())
for _ in range(T):
	N = int(input())
	W = list(map(int, input().split()))
	C = Counter(W)
	W = list(set(W))
	W.sort()
	D = defaultdict(lambda : set())
	N = len(W)
	for i in range(N):
		for j in range(i, N):
			s = W[i] + W[j]
			D[s].add((W[i], W[j]))
	ans = 0
	for (k, v) in D.items():
		v_list = list(v)
		ans_i = 0
		for l in v_list:
			if l[0] == l[1]:
				ans_l = C[l[0]] // 2
			else:
				ans_l = min(C[l[0]], C[l[1]])
			ans_i += ans_l
		ans = max(ans_i, ans)
	print(ans)


import sys

def minp():
	return sys.stdin.readline().strip()

def mint():
	return int(minp())

def mints():
	return map(int, minp().split())

def solve():
	n = mint()
	cnt = [0] * (n + 1)
	for i in mints():
		cnt[i] += 1
	best = 0
	for s in range(2, n + n + 1):
		c = 0
		for i in range(1, n + 1):
			j = s - i
			if j < i:
				break
			if j <= n:
				if j == i:
					c += cnt[i] // 2
				else:
					c += min(cnt[i], cnt[j])
		best = max(best, c)
	print(best)
for i in range(mint()):
	solve()


from collections import defaultdict

def ii():
	return int(input())

def si():
	return input()

def li():
	return list(map(int, input().split()))

def mi():
	return map(int, input().split())
t = ii()
for _ in range(t):
	n = ii()
	l = li()
	cnt = 0
	for sm in range(1, 2 * n + 1):
		d = {}
		tempcnt = 0
		for i in range(1, 2 * n + 1):
			d[i] = 0
		for i in l:
			d[i] = d[i] + 1
		for i in l:
			if d[i] > 0 and sm - i > 0 and (d[sm - i] > 0):
				if i == sm - i and d[i] < 2:
					continue
				else:
					d[i] = d[i] - 1
					d[sm - i] = d[sm - i] - 1
					tempcnt = tempcnt + 1
		cnt = max(cnt, tempcnt)
	print(cnt)


from collections import Counter

def binary_search(l, r, target):
	while l <= r:
		mid = (l + r) // 2
		if keys[mid] == target:
			return mid
		elif keys[mid] > target:
			r = mid - 1
		elif keys[mid] < target:
			l = mid + 1
	return -1
t = int(input())
for _ in range(t):
	n = int(input())
	arr = [int(i) for i in input().split()]
	ans = 0
	m = max(arr)
	count = Counter(arr)
	keys = list(count.keys())
	keys.sort()
	n1 = len(keys)
	for i in range(2, 2 * m + 1):
		c1 = 0
		for j in range(n1):
			x = binary_search(j, n1 - 1, i - keys[j])
			if x != -1:
				if keys[j] != i - keys[j]:
					c1 += min(count[keys[j]], count[keys[x]])
				else:
					c1 += count[keys[j]] // 2
		ans = max(ans, c1)
	print(ans)


for _ in range(int(input())):
	n = int(input())
	a = sorted(list(map(int, input().split())))
	fin = []
	for i in range(len(a)):
		for j in range(i + 1, len(a)):
			fin.append(a[i] + a[j])
	ma = 0
	for i in fin:
		l = 0
		h = n - 1
		k = i
		c = 0
		while l < h:
			if a[l] + a[h] == k:
				l += 1
				h -= 1
				c += 1
			elif a[l] + a[h] < k:
				l += 1
			else:
				h -= 1
		ma = max(ma, c)
	print(ma)


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	n = int(input())
	l = sorted(list(map(int, input().split())))
	d = {}
	for i in range(n):
		if l[i] not in d:
			d[l[i]] = 1
		else:
			d[l[i]] += 1
	ans = 0
	for w in range(2, 103):
		c = 0
		t = d.copy()
		for i in range(n):
			x = l[i]
			y = w - x
			if y in t and t[y] > 0:
				c += 1
				t[y] -= 1
		ans = max(ans, c // 2)
	print(ans)


from collections import Counter
tst = int(input())
t = 1
while t <= tst:
	n = int(input())
	ls = [0] * 60
	arr = list(map(int, input().split()))
	cnt = 0
	i = 2
	mx = -1
	while i <= 100:
		j = 0
		cnt = 0
		while j < n - 1:
			k = j + 1
			while k < n:
				if arr[j] + arr[k] == i and (ls[j] == 0 and ls[k] == 0):
					cnt += 1
					ls[j] = 1
					ls[k] = 1
				k += 1
			j += 1
		mx = max(mx, cnt)
		ls = [0] * 60
		i += 1
	print(mx)
	t += 1


def cal(n, dic):
	ans = 0
	for i in list(dic.keys()):
		if dic[i] and dic[n - i]:
			if 2 * i == n:
				ans += dic[i] // 2
			else:
				ans += min(dic[n - i], dic[i])
			dic[i] = 0
			dic[n - i] = 0
	return ans
from collections import Counter
import math
t = int(input())
for j in range(t):
	n = int(input())
	arr = [int(i) for i in input().strip().split()]
	cnt = Counter(arr)
	ans = 0
	mn = min(arr)
	mx = max(arr)
	for i in range(mn, 2 * mx + 1):
		ans = max(cal(i, cnt.copy()), ans)
	print(ans)


def lstinput():
	lst = input()
	lst = lst.split(' ')
	lst = [int(x) for x in lst]
	return lst
t = int(input())
for i in range(t):
	n = int(input())
	ar = lstinput()
	ans = 0
	cnt = {}
	for j in range(n + n + 1):
		cnt[j] = 0
	for v in ar:
		cnt[v] += 1
	for s in range(n + n + 1):
		cc = 0
		for x in ar:
			if cnt[x] > 0:
				y = s - x
				if y < 0:
					continue
				cnt[x] -= 1
				if cnt[y] > 0:
					cc += 1
					cnt[y] -= 1
				else:
					cnt[x] += 1
		ans = max(ans, cc)
		for j in range(n + n + 1):
			cnt[j] = 0
		for v in ar:
			cnt[v] += 1
	print(ans)


t = int(input())
for tt in range(t):
	n = int(input())
	w = list(map(int, input().split()))
	w.sort()
	ans = 0
	for s in range(2, 2 * n + 1):
		l = 0
		r = n - 1
		cur = 0
		while l < r:
			if w[l] + w[r] == s:
				cur += 1
				l += 1
				r -= 1
			if w[l] + w[r] < s:
				l += 1
			if w[l] + w[r] > s:
				r -= 1
		ans = max(ans, cur)
	print(ans)


t = int(input())
for _ in range(t):
	n = int(input())
	cnt = [0] * (n + 1)
	ws = list(map(int, input().split()))
	for w in ws:
		cnt[w] += 1
	result = 0
	for s in range(2, 2 * n + 1):
		ans = 0
		for ind in range(1, n + 1):
			if s - ind > n:
				continue
			if 2 * ind > s:
				break
			tmp = min(cnt[ind], cnt[s - ind])
			if s - ind == ind:
				ans += (tmp - 1) // 2 if tmp % 2 else tmp // 2
			else:
				ans += tmp
		result = max(ans, result)
	print(result)


from collections import Counter

def main():
	for _ in range(int(input())):
		(_, ab, l) = (input(), Counter(), [])
		for (a, x) in Counter(map(int, input().split())).items():
			ab[a * 2] += x // 2
			for (b, y) in l:
				ab[a + b] += min(x, y)
			l.append((a, x))
		print(ab.most_common(1)[0][1])
main()


from functools import reduce
from operator import add

def solve():
	n = int(input())
	arr = list(map(int, input().split()))
	pairs = 0
	ans = 0
	for i in range(2, 101):
		pairs = 0
		counts = {i: 0 for i in range(0, 101)}
		for j in arr:
			if i > j and counts[i - j] != 0:
				counts[i - j] -= 1
				pairs += 1
			else:
				counts[j] += 1
		ans = max(ans, pairs)
	print(ans)
t = int(input())
for i in range(t):
	solve()


import sys
import math
import bisect
from sys import stdin, stdout
from math import gcd, floor, sqrt, log
from collections import defaultdict as dd
from bisect import bisect_left as bl, bisect_right as br
from collections import Counter
inp = lambda : int(input())
strng = lambda : input().strip()
jn = lambda x, l: x.join(map(str, l))
strl = lambda : list(input().strip())
mul = lambda : map(int, input().strip().split())
mulf = lambda : map(float, input().strip().split())
seq = lambda : list(map(int, input().strip().split()))
ceil = lambda x: int(x) if x == int(x) else int(x) + 1
ceildiv = lambda x, d: x // d if x % d == 0 else x // d + 1
flush = lambda : stdout.flush()
stdstr = lambda : stdin.readline()
stdint = lambda : int(stdin.readline())
stdpr = lambda x: stdout.write(str(x))
stdarr = lambda : map(int, stdstr().split())
mod = 1000000007
for _ in range(stdint()):
	n = stdint()
	arr = list(stdarr())
	ad = Counter(arr)
	ai = Counter()
	for i in range(n):
		ai[i] = arr[i]
	t = -1
	for i in range(2 * n + 1):
		s = i
		done = Counter()
		freq = ad.copy()
		r = 0
		for j in range(n):
			if freq[arr[j]] <= 0:
				continue
			else:
				rem = s - arr[j]
				if arr[j] == rem and freq[rem] == 1:
					continue
				if freq[rem] <= 0:
					continue
				else:
					r += 1
					freq[rem] -= 1
					freq[arr[j]] -= 1
		t = max(t, r)
	print(t)


def distinct(arr, n):
	temp = arr[0]
	for i in range(n):
		if arr[i] != temp:
			return 0
	return 1
t = int(input())
while t:
	n = int(input())
	arr = list(map(int, input().split()))
	weights = dict()
	keys = set()
	for i in range(n - 1):
		for j in range(i + 1, n):
			tmp = arr[i] + arr[j]
			if tmp in keys:
				if i not in weights[tmp] and j not in weights[tmp]:
					weights[tmp].add(i)
					weights[tmp].add(j)
			else:
				weights[tmp] = {i}
				weights[tmp].add(j)
				keys.add(tmp)
	ans = 0
	for x in weights.values():
		ans = max(ans, len(x))
	print(ans // 2)
	t -= 1


from collections import Counter
import math
import sys
from bisect import bisect, bisect_left, bisect_right

def input():
	return sys.stdin.readline().strip()

def INT():
	return int(input())

def MAP():
	return map(int, input().split())

def LIST(N=None):
	return list(MAP()) if N is None else [INT() for i in range(N)]

def mod():
	return 10 ** 9 + 7

def findPairs(arr, size):
	Map = {}
	for i in range(0, size - 1):
		for j in range(i + 1, size):
			Sum = arr[i] + arr[j]
			if Sum in Map:
				for pair in Map[Sum]:
					(m, n) = pair
					if (m != i and m != j) and (n != i and n != j):
						print('Pair First ({}, {})'.format(arr[i], arr[j]))
						print('Pair Second ({}, {})'.format(arr[m], arr[n]))
						return
			if Sum not in Map:
				Map[Sum] = []
			Map[Sum].append((i, j))
	return []
for i in range(INT()):
	n = INT()
	a = LIST()
	a.sort()
	if n == 1:
		print(0)
	else:
		x = a[0] + a[1]
		y = a[n - 1] + a[n - 2]
		visited = [0] * n
		ans = 0
		for i in range(x, y + 1):
			visited = [0] * n
			count = 0
			for j in range(n):
				val = i - a[j]
				if visited[j] == 0:
					visited[j] = 1
					for k in range(j + 1, n):
						if val == a[k] and visited[k] == 0:
							count += 1
							visited[k] = 1
							break
			ans = max(ans, count)
		print(ans)


from sys import stdin, stdout, setrecursionlimit
from collections import deque, defaultdict, Counter
from heapq import heappush, heappop
from functools import lru_cache
from copy import deepcopy
import math
rl = lambda : stdin.readline()
rll = lambda : stdin.readline().split()
rli = lambda : map(int, stdin.readline().split())
rlf = lambda : map(float, stdin.readline().split())
(INF, NINF) = (float('inf'), float('-inf'))
MOD = 10 ** 9 + 7

def main():
	T = int(rl())
	for _ in range(T):
		n = int(rl())
		W = []
		WD = defaultdict(lambda : 0)
		choices = set()
		for (i, a) in enumerate(rli()):
			WD[a] += 1
			W.append(a)
		ans = 0
		seenchoice = set()
		ws = list(WD.keys())
		for i in range(n):
			for j in range(i + 1, n):
				target = W[i] + W[j]
				if target in seenchoice:
					continue
				seenchoice.add(target)
				seen = set()
				cnt = 0
				for w in ws:
					if w in seen:
						continue
					need = target - w
					if need == w:
						cnt += WD[w] // 2
						seen.add(w)
					else:
						cnt += min(WD[w], WD[need])
						seen.add(w)
						seen.add(need)
				ans = max(ans, cnt)
		print(ans)
	stdout.close()
main()


import sys, math
from collections import deque, defaultdict
import operator as op
from functools import reduce
I = sys.stdin.readline

def ii():
	return int(I().strip())

def li():
	return list(map(int, I().strip().split()))

def mi():
	return map(int, I().strip().split())

def ncr(n, r):
	r = min(r, n - r)
	numer = reduce(op.mul, range(n, n - r, -1), 1)
	denom = reduce(op.mul, range(1, r + 1), 1)
	return numer // denom

def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def main():
	ans = ''
	for _ in range(ii()):
		n = ii()
		a = sorted(li())
		d = defaultdict(int)
		for j in a:
			d[j] += 1
		if n == 1:
			ans += '0\n'
		else:
			cnt = 0
			for s in range(a[0] + a[1], a[-1] + a[-2] + 1):
				x = 0
				flag = 0
				for i in a:
					if i != flag and d[s - i] > 0 and (s - i >= i):
						if i == s - i:
							x += d[i] // 2
						else:
							tmp = min(d[i], d[s - i])
							x += tmp
					flag = i
				cnt = max(cnt, x)
			ans += str(cnt) + '\n'
	print(ans)
main()


t = int(input())
for _ in range(t):
	n = int(input())
	cnt = [0] * (n + 1)
	for i in map(int, input().split()):
		cnt[i] += 1
	ans = 0
	for s in range(2, 2 * n + 1):
		c = 0
		for i in range(1, s // 2 + 1):
			if s - i > n:
				continue
			if 2 * i == s:
				c += cnt[i] // 2
			else:
				c += min(cnt[i], cnt[s - i])
		ans = max(ans, c)
	print(ans)


import sys
input = sys.stdin.readline
from collections import Counter
t = int(input())
for tests in range(t):
	n = int(input())
	W = list(map(int, input().split()))
	C = Counter(W)
	ANS = 0
	for i in range(n):
		for j in range(i + 1, n):
			B = W[i] + W[j]
			A = 0
			for c in C:
				if c * 2 == B:
					A += C[c] // 2
				elif c * 2 < B:
					A += min(C[c], C[B - c])
			ANS = max(ANS, A)
	print(ANS)


t = int(input())
for _ in range(t):
	n = int(input())
	w = [*map(int, input().split())]
	w_index = [w.count(_) for _ in range(51)]
	max_teams = 0
	for opt_weight in range(2, 101):
		teams = 0
		w_index_cpy = w_index.copy()
		for i in range(n):
			if opt_weight <= w[i]:
				continue
			elif opt_weight > w[i] + 50:
				continue
			else:
				other = opt_weight - w[i]
				if w_index_cpy[other] > 0:
					teams += 1
					w_index_cpy[other] -= 1
		max_teams = max(max_teams, teams)
	print(max_teams // 2)


from collections import Counter
for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	dic = Counter(arr)
	res = 0
	for s in range(2, 2 * n + 1):
		total = 0
		for j in dic:
			if j > s // 2:
				pass
			elif j == s / 2:
				total += dic[j] // 2
			else:
				total += min(dic[j], dic[s - j])
		res = max(res, total)
	print(res)


for t in range(int(input())):
	c = 0
	x = int(input())
	team = list(map(int, input().split()))
	teams = sorted(team)
	arr = []
	e = max(teams)

	def GetCount(teams, i):
		c = 0
		j = 0
		k = x - 1
		while j < k:
			l = teams[j] + teams[k]
			if l == i:
				c += 1
				j += 1
				k -= 1
			elif l < i:
				j += 1
			elif l > i:
				k -= 1
		return c
	for i in range(1, 2 * e + 1):
		r = GetCount(teams, i)
		arr.append(r)
	print(max(arr))


from collections import defaultdict
for tt in range(int(input())):
	n = int(input())
	c = 0
	a = [int(f) for f in input().split()]
	m = {}
	for i in range(0, n - 1):
		for j in range(i + 1, n):
			if a[i] + a[j] not in m:
				m[a[i] + a[j]] = []
			if i not in m[a[i] + a[j]] and j not in m[a[i] + a[j]]:
				m[a[i] + a[j]].append(i)
				m[a[i] + a[j]].append(j)
	mm = 0
	for v in m:
		if mm < len(m[v]):
			mm = len(m[v])
	print(mm // 2)


from sys import stdin, stdout
input = stdin.readline
print = stdout.write
from collections import defaultdict, Counter
for _ in range(int(input())):
	n = int(input())
	w = list(map(int, input().split()))
	w.sort()
	d = defaultdict(int, Counter(w))
	maxi = 0
	for s in range(2, 101):
		st = set()
		t = d.copy()
		pairs = 0
		for (i, w1) in enumerate(w):
			if w1 == s - w1:
				if t[w1] > 1:
					pairs += 1
					t[w1] -= 2
			elif t[w1] and t[s - w1]:
				pairs += 1
				t[w1] -= 1
				t[s - w1] -= 1
		maxi = max(pairs, maxi)
	print(str(maxi) + '\n')


import sys
from collections import defaultdict
t = 1
t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, sys.stdin.readline().strip().split()))
	dd = defaultdict(int)
	for j in a:
		dd[j] += 1
	op = 0
	xx = set(a)
	for j in range(2, 2 * n + 1):
		x = 0
		d = dd.copy()
		for k in xx:
			if k >= j:
				continue
			if k == j - k:
				xxx = d[k] // 2
			else:
				xxx = min(d[k], d[j - k])
			d[k] -= xxx
			d[j - k] -= xxx
			x += xxx
		op = max(op, x)
	print(op)


t = int(input())
for _ in range(t):
	n = int(input())
	l = [int(x) for x in input().split()]
	d = {}
	p = {}
	for i in range(n):
		for j in range(i + 1, n):
			if l[i] + l[j] not in d:
				d[l[i] + l[j]] = 0
			d[l[i] + l[j]] = 1
		if l[i] not in p:
			p[l[i]] = 0
		p[l[i]] += 1
	maxm = 0
	prev = 0
	for x in d:
		maxm = 0
		for k in p:
			if x - k in p:
				if k == x - k:
					maxm += float(p[k] // 2)
				else:
					maxm += float(min(p[k], p[x - k]) / 2)
			else:
				maxm += 0
		prev = max(prev, int(maxm))
	print(prev)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	d = {}
	for i in range(n):
		for j in range(i + 1, n):
			cs = a[i] + a[j]
			d[cs] = d.get(cs, set())
			if i in d[cs] or j in d[cs]:
				continue
			d[cs].add(i)
			d[cs].add(j)
	if d:
		print(max((len(d[i]) for i in d)) // 2)
	else:
		print(0)


from collections import Counter

def howmany(target, nums, freqs):
	onDemand = dict()
	total_pairs = 0
	for (ind, num) in enumerate(nums):
		if num > target:
			break
		if onDemand.get(num, None) == 'over':
			continue
		if num in onDemand:
			if num != target - num:
				total_pairs += min(freqs[num], freqs[target - num])
			elif num == target - num:
				total_pairs += freqs[num] // 2
			onDemand[num] = onDemand[target - num] = 'over'
		else:
			onDemand[target - num] = ind
	return total_pairs

def pairs(nums, n):
	if len(nums) == 1:
		return 0
	nums.sort()
	freqs = Counter(nums)
	srange = range(nums[0] * 2, nums[-1] + nums[-2] + 1)
	maxx_pairs = -1
	for target in srange:
		maxx_pairs = max(howmany(target, nums, freqs), maxx_pairs)
	return maxx_pairs
t = int(input())
for _ in range(t):
	n = int(input())
	weits = list(map(int, input().split()))
	print(pairs(weits, n))


from collections import defaultdict
from collections import Counter
t = int(input())
for q in range(0, t):
	n = int(input())
	a = [int(i) for i in input().split()]
	d = defaultdict(lambda : 0)
	d2 = defaultdict(lambda : [])
	ans = [0] * n
	a.sort()
	for i in range(0, n):
		for j in range(i + 1, n):
			sum = a[i] + a[j]
			if d2[i] == sum or d2[j] == sum:
				abc = 123
			else:
				d[a[i] + a[j]] += 1
				d2[i] = sum
				d2[j] = sum
	maxans = 0
	for i in d:
		if d[i] > maxans:
			maxans = d[i]
	print(maxans)


def solution(N, weights):
	count = 0
	fills = [0] * (2 * N)
	for w in weights:
		fills[w] += 1
	for S in range(2, 2 * N + 1):
		current = 0
		for i in range(1, (S + 1) // 2):
			if S - i > N:
				continue
			current += min(fills[i], fills[S - i])
		if not S % 2:
			current += fills[S // 2] // 2
		count = max(count, current)
	return count
tests = int(input())
for _ in range(tests):
	n = int(input().strip())
	weights = list(map(int, input().strip().split()))
	print(solution(n, weights))


import collections
t = int(input())
for tt in range(t):
	n = int(input())
	w = [int(x) for x in input().split()]
	m = collections.defaultdict(int)
	m = collections.defaultdict(int)
	for i in range(n):
		m[w[i]] += 1
	sums = collections.defaultdict(int)
	for e in m:
		sums[e * 2] += m[e] // 2
		for f in m:
			if f > e:
				sums[f + e] += min(m[e], m[f])
	res = 0
	for e in sums:
		res = max(res, sums[e])
	print(res)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	ans = 0
	a.sort()
	for s in range(2, 101):
		i = 0
		j = n - 1
		c = 0
		while i < j:
			y = a[i] + a[j]
			if y > s:
				j -= 1
			elif y == s:
				i += 1
				j -= 1
				c += 1
			else:
				i += 1
		ans = max(ans, c)
	print(ans)


def solve(n, ar):
	ar.sort()
	track = [0] * 102
	for w in range(2, 102):
		x = 0
		y = n - 1
		cnt = 0
		while x < y:
			if ar[x] + ar[y] == w:
				cnt += 1
				x += 1
				y -= 1
			elif ar[x] + ar[y] < w:
				x += 1
			elif ar[x] + ar[y] > w:
				y -= 1
		track[w] += cnt
	print(max(track))
t = int(input())
for _ in range(t):
	n = int(input())
	ar = list(map(int, input().split()))
	solve(n, ar)


def pairs(d, i):
	(s, p) = (0, {})
	for j in d:
		p[j] = d[j]
	for e in p:
		if i - e in p and p[i - e] > 0:
			if e == i - e:
				s += p[e] // 2
				p[e] %= 2
			else:
				a = min(p[e], p[i - e])
				p[e] -= a
				p[i - e] -= a
				s += a
	return s
t = int(input())
for _ in range(t):
	(n, p) = (int(input()), list(map(int, input().split())))
	(d, m) = ({}, 0)
	for i in range(1, n + 1):
		d[i] = 0
	for i in range(n):
		d[p[i]] += 1
	for i in range(1, 2 * n + 1):
		m = max(m, pairs(d, i))
	print(m)


from math import *
from collections import *
from random import *
from decimal import Decimal
from heapq import *
from bisect import *
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 5)

def lis():
	return list(map(int, input().split()))

def ma():
	return map(int, input().split())

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

def st():
	return input().rstrip('\n')
t = inp()
while t:
	t -= 1
	n = inp()
	a = lis()
	d = [0] * (n + 1)
	for i in a:
		d[i] += 1
	r = 0
	for i in range(2, n + n + 1):
		v = 0
		for j in range(1, n + 1):
			if 2 * j != i:
				z = i - j
				if z > 0 and z <= n:
					v += min(d[j], d[z])
			else:
				v += d[j]
		r = max(r, v // 2)
	print(r)


for _ in range(int(input())):
	n = int(input())
	vec = list(map(int, input().split()))
	vec.sort()
	ans = 0
	for i in range(n):
		for j in range(i + 1, n):
			l = i + 1
			r = j - 1
			cur = 1
			s = vec[i] + vec[j]
			while l < r:
				if vec[l] + vec[r] == s:
					cur += 1
					l += 1
					r -= 1
				elif vec[l] + vec[r] < s:
					l += 1
				else:
					r -= 1
			ans = max(ans, cur)
	print(ans)


def sort_find_lower_and_upper(s):
	s.sort()
	return (s, s[0] + s[1], s[-1] + s[-2])

def two_pointer(s, n, k):
	i = 0
	j = n - 1
	num = 0
	while i < j:
		if s[i] + s[j] == k:
			num += 1
			i += 1
			j -= 1
		elif s[i] + s[j] > k:
			j -= 1
		else:
			i += 1
	return num

def find_ans(s, lower, upper):
	o = -10
	for i in range(lower, upper + 1):
		p = two_pointer(s, n, i)
		if p > o:
			o = p
	return o
for _ in range(int(input())):
	n = int(input())
	s = list(map(int, input().split()))
	if n == 1:
		print(0)
		continue
	(s, lower, upper) = sort_find_lower_and_upper(s)
	print(find_ans(s, lower, upper))


from collections import Counter
t = int(input())
for _ in range(t):
	n = int(input())
	dict = Counter(map(int, input().split()))
	ans = [0] * 101
	for i in range(51):
		for j in range(51):
			ans[i + j] += min(dict[i], dict[j])
	print(max(ans) // 2)


for test in range(int(input())):
	n = int(input())
	A = list(map(int, input('').split()))
	A.sort()

	def check(req):
		ans = 0
		start = 0
		end = n - 1
		while start < end:
			if A[start] + A[end] == req:
				ans += 1
				start += 1
				end -= 1
			elif A[start] + A[end] < req:
				start += 1
			else:
				end -= 1
		return ans
	ans = 0
	for i in range(2, max(A) * 2 + 1):
		ans = max(ans, check(i))
	print(ans)


for _ in range(int(input())):
	n = int(input())
	d = dict()
	ar = list(map(int, input().split()))
	for i in ar:
		if i in d:
			d[i] += 1
		else:
			d[i] = 1
	ans = 0
	for s in range(101):
		dc = d.copy()
		c = 0
		for x in ar:
			if s - x in d and dc[s - x] > 0 and (dc[x] > 0):
				if x == s - x and dc[x] >= 2:
					dc[s - x] -= 1
					dc[x] -= 1
					c += 1
				elif x != s - x:
					dc[s - x] -= 1
					dc[x] -= 1
					c += 1
		ans = max(ans, c)
	print(ans)


t = int(input())
while t > 0:
	n = int(input())
	a = list(map(int, input().split(' ')))
	cnt = [0] * 51
	for i in a:
		cnt[i] += 1
	count = [0] * 101
	for i in a:
		count[i * 2] = cnt[i] // 2
	for i in range(1, 50):
		for j in range(i + 1, 51):
			if cnt[i] != 0 and cnt[j] != 0:
				count[i + j] += min(cnt[i], cnt[j])
	print(max(count))
	t = t - 1


for _ in range(int(input())):
	n = int(input())
	lis = list(map(int, input().split()))
	val = [0 for i in range(101)]
	lis.sort()
	if n < 2:
		print(0)
	elif n == 2 or n == 3:
		print(1)
	else:
		lis.sort()
		mi = lis[0] + lis[1]
		ma = lis[-1] + lis[-2]
		co = 0
		for i in range(mi, ma + 1):
			su = 0
			vi = [0 for ii in range(n)]
			for j in range(n):
				for k in range(n):
					if lis[j] + lis[k] == i and vi[j] == 0 and (vi[k] == 0) and (k != j):
						su += 1
						vi[j] = 1
						vi[k] = 1
			if su > co:
				co = su
		print(co)


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	l1 = []
	l2 = []
	for i in l:
		if i not in l1:
			l1.append(i)
			l2.append(l.count(i))
	d = {}
	for i in range(len(l1)):
		for j in range(i, len(l1)):
			if j == i:
				su = 2 * l1[j]
				c = l2[j] // 2
			else:
				su = l1[i] + l1[j]
				c = min(l2[i], l2[j])
			if su in d:
				d[su] += c
			else:
				d[su] = c
	print(max(d.values()))


from collections import defaultdict as dd
for _ in range(int(input())):
	a = int(input())
	d = dd(lambda : 0)
	b = list(map(int, input().split()))
	for i in b:
		d[i] += 1
	ans = 0
	for i in range(1, 101):
		q = 0
		for j in range(1, i // 2 + 1):
			if j == i / 2:
				q += d[j] // 2
				continue
			q += min(d[j], d[i - j])
		ans = max(ans, q)
	print(ans)


import copy
t = int(input())

def find(a, dic, s):
	ans = 0
	for i in range(len(a)):
		if a[i] == s / 2 and dic[a[i]] > 1:
			dic[a[i]] -= 2
			ans += 1
		elif dic[a[i]] > 0 and (s - a[i] in dic.keys() and dic[s - a[i]] > 0) and (a[i] != s / 2):
			dic[a[i]] -= 1
			dic[s - a[i]] -= 1
			ans += 1
	return ans
while t:
	n = int(input())
	a = list(map(lambda x: int(x), input().split()))
	dic = {}
	a.sort()
	for i in range(n):
		if a[i] in dic.keys():
			dic[a[i]] += 1
		else:
			dic[a[i]] = 1
	ans = 0
	for i in range(a[0], a[n - 2] + a[n - 1] + 1):
		dic1 = copy.deepcopy(dic)
		req = find(a, dic1, i)
		ans = max(ans, req)
	print(ans)
	t -= 1


t = 1
t = int(input())
while t:
	t -= 1
	n = int(input())
	a = list(map(int, input().split()))
	wCount = {}
	for i in range(1, n):
		for j in range(i):
			w = a[i] + a[j]
			if w in wCount:
				if i not in wCount[w] and j not in wCount[w]:
					wCount[w].add(i)
					wCount[w].add(j)
			else:
				wCount[w] = set([i, j])
	b = wCount.values()
	if n == 1:
		print(0)
	elif b:
		c = max(b, key=len)
		print(len(c) // 2)
	else:
		print(0)


from sys import stdin

def inp():
	return stdin.buffer.readline().rstrip().decode('utf8')

def itg():
	return int(stdin.buffer.readline())

def mpint():
	return map(int, stdin.buffer.readline().split())
from collections import Counter
for case in range(1, itg() + 1):
	n = itg()
	c = Counter(mpint())
	keys = sorted(c.keys())
	st = set(c.keys())
	ans = 0
	for w in range(2, keys[-1] * 2 + 1):
		count = 0
		for k in keys:
			if k * 2 > w:
				break
			if k * 2 == w:
				count += c[k] >> 1
			elif w - k in st:
				count += min(c[k], c[w - k])
		ans = max(ans, count)
	print(ans)


from collections import Counter
for x in range(int(input())):
	n = int(input())
	m = list(map(int, input().split()))
	d = Counter(m)
	s = [0] * 105
	for i in d:
		s[2 * i] += d[i] // 2
	a = []
	for i in d:
		a.append((i, d[i]))
	for i in range(len(a) - 1):
		for j in range(i + 1, len(a)):
			k = a[i][0] + a[j][0]
			s[k] += min(a[i][1], a[j][1])
	print(max(s))


import math
import time
from collections import defaultdict, deque, Counter
from sys import stdin, stdout
from bisect import bisect_left, bisect_right
from queue import PriorityQueue
import sys
t = int(input())
for _ in range(t):
	n = int(stdin.readline())
	a = list(map(int, stdin.readline().split()))
	count = Counter(a)
	ans = 0
	for s in range(2, 101):
		temp = 0
		for i in count:
			if s & 1 == 0 and i == s // 2:
				temp += count[i]
			else:
				temp += min(count[i], count[s - i])
		ans = max(ans, temp)
	print(ans // 2)


from collections import defaultdict as dd
for _ in range(int(input())):
	n = int(input())
	w = list(map(int, input().split()))
	t = [0] * (2 * n + 1)
	for el in w:
		t[el] += 1
	ans = 0
	for i in range(2, 2 * n + 1):
		(t1, temp) = (t.copy(), 0)
		for el in w:
			if i - el > 0 and t1[el]:
				t1[el] -= 1
				if t1[i - el]:
					t1[i - el] -= 1
					temp += 1
				else:
					t1[el] += 1
		ans = max(ans, temp)
	print(ans)


def go(n, w):
	w.sort()
	smr = [2 * min(w), 2 * max(w)]
	ctmx = -1
	for sm in range(smr[0], smr[1] + 1):
		ct = 0
		p1 = 0
		p2 = n - 1
		while p1 < p2:
			if w[p1] + w[p2] == sm:
				ct += 1
				p1 += 1
				p2 -= 1
			elif w[p1] + w[p2] > sm:
				p2 -= 1
			else:
				p1 += 1
		ctmx = max(ctmx, ct)
	print(' ' * 20, ctmx)
for i in range(int(input())):
	n = int(input())
	w = list(map(int, input().split()))
	go(n, w)


from collections import Counter

def read_int():
	return int(input())

def read_int_list():
	return list(map(int, input().split(' ')))

def resolve():
	for _ in range(read_int()):
		_ = read_int()
		participants_weight_list = sorted(read_int_list(), reverse=False)
		result = [0] * 101
		frequency = Counter(participants_weight_list)
		for index1 in frequency:
			for index2 in frequency:
				result[index1 + index2] += min(frequency[index1], frequency[index2])
		print(max(result) // 2)
resolve()


from collections import defaultdict
T = int(input())
for t in range(T):
	n = int(input())
	A = [int(i) for i in input().split()]
	d = defaultdict(int)
	for i in A:
		d[i] += 1
	ans = 0
	for target in range(2, 101):
		target_score = 0
		for i in d:
			if i == target - i:
				target_score += d[i] // 2
			elif target - i in d and i < target - i:
				target_score += min(d[i], d[target - i])
		ans = max(ans, target_score)
	print(ans)


for _ in range(int(input())):
	input()
	weights = [int(s) for s in input().split()]
	dicto = dict()
	for weight in weights:
		if weight in dicto:
			dicto[weight] += 1
		else:
			dicto[weight] = 1
	best = 0
	for s in range(max(weights) * 2 + 1):
		teams = 0
		for (key, value) in dicto.items():
			j = s - key
			if key == j:
				teams += value // 2
			elif key < j:
				teams += min(value, dicto.get(j, 0))
		best = max(best, teams)
	print(best)


import math
num_cases = int(input())
for _ in range(num_cases):
	n = int(input())
	weights = list(map(int, input().strip().split()))
	weights.sort()
	max_sum = weights[n - 2] + weights[n - 1]
	ans = 0
	for sumi in range(max_sum + 1):
		count = 0
		left = 0
		right = n - 1
		while left < right:
			if weights[left] + weights[right] == sumi:
				count += 1
				left += 1
				right -= 1
			elif weights[left] + weights[right] < sumi:
				left += 1
			else:
				right -= 1
		ans = max(ans, count)
	print(ans)


for i in range(int(input())):
	n = int(input())
	v = [int(x) for x in input().split()]
	v.sort()
	m = 0
	for j in range(1, 101):
		z = 0
		a = v[::-1]
		for p in range(n):
			for q in range(p + 1, n):
				if a[p] + a[q] == j:
					z += 1
					a[q] = 101
					break
		m = max(z, m)
	print(m)


from sys import stdin, stdout
from collections import Counter
from itertools import permutations
import bisect
import math
I = lambda : map(int, stdin.readline().split())
I1 = lambda : stdin.readline()

def count_grp(a, n, s):
	(i, j, c) = (0, n - 1, 0)
	while i < j:
		if a[i] + a[j] == s:
			c += 1
			i += 1
			j -= 1
		elif a[i] + a[j] < s:
			i += 1
		else:
			j -= 1
	return c
for _ in range(int(I1())):
	n = int(I1())
	a = list(I())
	a.sort()
	f = [0] * 101
	for i in range(101):
		f[i] += count_grp(a, n, i)
	print(max(f))


def freq(w, s, n):
	f = 0
	i = 0
	j = n - 1
	while i < j:
		t = w[i] + w[j]
		if t == s:
			f += 1
			i += 1
			j -= 1
		elif t > s:
			j -= 1
		else:
			i += 1
	return f
tc = int(input())
for _ in range(tc):
	n = int(input())
	w = list(map(int, input().split()))
	w.sort()
	ans = 0
	for s in range(2, 2 * n + 1):
		f = freq(w, s, n)
		ans = max(ans, f)
	print(ans)


t = int(input())
for _ in range(t):
	n = int(input())
	arr = [int(x) for x in input().split()]
	sum1 = sum(arr)
	dp = [0] * (sum1 + 1)
	che = []
	for i in range(len(dp)):
		che.append(set())
	for i in range(len(arr)):
		for j in range(i + 1, len(arr)):
			if j not in che[arr[i] + arr[j]] and i not in che[arr[i] + arr[j]]:
				dp[arr[i] + arr[j]] += 1
				che[arr[i] + arr[j]].add(j)
				che[arr[i] + arr[j]].add(i)
	maxa = 0
	for i in dp:
		if i > maxa:
			maxa = i
	print(maxa)


t = int(input())
for i in range(t):
	n = int(input())
	w = list(map(int, input().split()))
	l = [0] * 101
	l1 = [0] * 101
	for j in range(n):
		l1[w[j]] += 1
	w.sort()
	for j in range(1, 101):
		w1 = w.copy()
		for k in range(n):
			for x in range(n):
				if w1[k] + w1[x] == j and min(w1[k], w1[x]) != 0 and (x != k):
					w1[k] = 0
					w1[x] = 0
					l[j] += 1
	print(max(l))


from math import *
from copy import *
from string import *
from random import *
from sys import stdin, stdout
from sys import maxsize
from operator import *
from itertools import *
from collections import Counter
import math
import math
import time
from queue import Queue

def seive(n):
	l = [True]
	l = l * (n + 1)
	for i in range(2, int(sqrt(n)) + 1):
		if l[i] == True:
			val = i * i
			while val < len(l):
				l[val] = False
				val += i
	prime = []
	for i in range(2, len(l)):
		if l[i] == True:
			prime.append(i)
	return prime

def dp(l, i, n, val, ans):
	if i >= n or val < 0:
		return 1000000
	elif val == 0:
		return 0
	else:
		if ans[i] == 1000000:
			ans[i] = min(min(1 + dp(l, i + 1, n, val - l[i], ans), 1 + dp(l, i, n, val - l[i], ans)), dp(l, i + 1, n, val, ans))
		return ans[i]
from queue import Queue

def factors(n):
	l = []
	for i in range(1, int(sqrt(n)) + 1):
		if n % i == 0:
			if n // i == i:
				l.append(i)
			else:
				l.append(i)
				l.append(n // i)
	return l

def check1(s, v, x):
	while True:
		if v not in s:
			return v
		else:
			v -= 1

def check2(s, v, x):
	while True:
		if v not in s:
			return v
		else:
			v += 1

def up(n):
	j = n - 1
	while j > 0:
		if n % j == 0:
			break
		j -= 1
	return j

def fac(n):
	c = 1
	i = 1
	while i <= n:
		c *= i
		i += 1
	return c

def check_happy(n):
	ss = set()
	print(n)
	while n != 1:
		val = n
		s = 0
		print(val)
		while val != 0:
			s += (val % 10) ** 2
			val = val // 10
		print(val)
		print('hi')
		if val in ss:
			return False
		else:
			n = val
			ss.add(n)
	return True

def update(a, b):
	c = 1
	val = a
	while a < b:
		print(c, a)
		c += c
		a += a
	print(1)
	while a > b:
		print()
		a -= val
		c -= 1
	return c
import random as rand

def gcd(a, b):
	if a == 0:
		return b
	return gcd(b % a, a)
from itertools import permutations

def insertion_sort(arr):
	for i in range(len(arr)):
		j = i
		while j > 0:
			if arr[j] < arr[j - 1]:
				temp = arr[j]
				arr[j] = arr[j - 1]
				arr[j - 1] = temp
			j -= 1
	return arr

def quick_sort(arr, low, high):
	i = low
	j = high
	while i < j:
		if arr[i] > arr[low] and arr[j] < arr[low]:
			temp = arr[i]
			arr[i] = arr[j]
			arr[j] = arr[i]
			i += 1
			j -= 1
		elif arr[i] <= arr[low]:
			i += 1
		elif arr[j] >= arr[low]:
			j -= 1
	print(i, j)
	toto = arr[j]
	arr[j] = arr[low]
	arr[low] = toto
	return j

def dodo(arr, low, high):
	if low < high:
		val = quick_sort(arr, low, high)
		dodo(arr, low, val - 1)
		dodo(arr, val + 1, high)

def dp(arr, c, n, k, z, ans):
	if k == 0:
		return ans
	elif c == 0:
		return dp(arr, c + 1, n, k - 1, z, ans + arr[c + 1])
	elif c == n - 1:
		if z == 0:
			return 0
		else:
			return dp(arr, c - 1, n, k - 1, z - 1, ans + arr[c - 1])
	elif z == 0:
		return dp(arr, c + 1, n, k - 1, z, ans + arr[c + 1])
	else:
		return max(dp(arr, c + 1, n, k - 1, z, ans + arr[c + 1]), dp(arr, c - 1, n, k - 1, z - 1, ans + arr[c - 1]))

def check(arr, val):
	dic = dict()
	for i in arr:
		if i in dic:
			dic[i] += 1
		else:
			dic[i] = 1
	ans = 0
	for i in arr:
		v = val - i
		if dic[i] > 0 and v in dic:
			if i == v:
				if dic[v] > 1:
					ans += 1
					dic[v] -= 2
			elif dic[v] > 0:
				ans += 1
				dic[v] -= 1
				dic[i] -= 1
	return ans
t = int(stdin.readline())
for i in range(t):
	s = set()
	n = int(stdin.readline())
	l = list(map(int, stdin.readline().split(' ')))
	for j in range(n):
		for k in range(j + 1, n):
			s.add(l[j] + l[k])
	maxa = 0
	value = -1
	for j in s:
		maxa = max(maxa, check(l, j))
	print(maxa)


from math import log2

def readGenerator():
	while True:
		tokens = input().split(' ')
		for t in tokens:
			yield t
reader = readGenerator()

def readWord():
	return next(reader)

def readInt():
	return int(next(reader))

def readFloat():
	return float(next(reader))

def readLine():
	return input()

def solve(n):
	return n
t = readInt()
for _ in range(0, t):
	n = readInt()
	w = sorted([readInt() for _ in range(0, n)])
	res = 0
	for i in range(0, n):
		for j in range(i + 1, n):
			p1 = 0
			p2 = n - 1
			s = w[i] + w[j]
			pairs = 0
			while p1 < p2:
				if w[p1] + w[p2] == s:
					pairs += 1
					p1 += 1
					p2 -= 1
					continue
				if w[p1] + w[p2] > s:
					p2 -= 1
					continue
				p1 += 1
			res = max(res, pairs)
	print(res)


t = int(input())
for i in range(t):
	n = int(input())
	lst = input().split()
	lst1 = [0] * (n + 1)
	for i in range(n):
		lst1[int(lst[i])] += 1
	lst2 = [0] * (2 * n + 1)
	for j in range(1, n + 1):
		for k in range(j + 1, n + 1):
			lst2[j + k] += min(lst1[j], lst1[k])
	for j in range(n + 1):
		lst2[j * 2] += int(lst1[j] / 2)
	print(max(lst2))


from itertools import combinations
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	m = 0
	sums = set()
	for i in range(n):
		for j in range(i + 1, n):
			sums.add(a[i] + a[j])
	sums = list(sums)
	for s in sums:
		c = 0
		b = a.copy()
		while len(b) > 1:
			i = b[0]
			p = 1
			for j in b[1:]:
				if i + j == s:
					c += 1
					b.remove(i)
					b.remove(j)
					p = 0
					break
			if p:
				b.remove(i)
		m = max(c, m)
	print(m)


def solve():
	for _ in range(ii()):
		n = ii()
		w = li()
		cnt = [0] * (n + 1)
		for i in range(n):
			cnt[w[i]] += 1
		ans = 0
		for s in range(2, 2 * n + 1):
			cur = 0
			s_cap = (s + 1) // 2
			for i in range(1, s_cap):
				if s - i > n:
					continue
				cur += min(cnt[i], cnt[s - i])
			if s % 2 == 0:
				cur += cnt[s // 2] // 2
			ans = max(cur, ans)
		print(ans)
ii = lambda : int(input())
mi = lambda : map(int, input().split())
li = lambda : list(mi())
solve()


from collections import defaultdict

def solve():
	n = int(input())
	p = list(map(int, input().split()))
	m = set(p)
	extra = defaultdict(int)
	for i in p:
		extra[i] += 1
	extra_2 = defaultdict(int)
	max_index = 0
	extra_2[0] = 0
	for a in m:
		for b in m:
			if a != b:
				extra_2[a + b] += min(extra[a], extra[b])
			else:
				extra_2[a + b] += extra[a]
			if extra_2[a + b] > extra_2[max_index]:
				max_index = a + b
	print(extra_2[max_index] // 2)
t = int(input())
for test in range(t):
	solve()


import sys
input = sys.stdin.readline
t = int(input())
while t != 0:
	t -= 1
	n = int(input())
	l = list(map(int, input().split()))
	if n == 1:
		print(0)
		continue
	su = {0}
	for i in range(n):
		for j in range(i + 1, n):
			su.add(l[i] + l[j])
	mx = 1
	for i in su:
		num = 0
		don = []
		for j in range(n):
			don.append(0)
		for j in range(n):
			if don[j] == 1:
				continue
			don[j] = 1
			for k in range(j + 1, n):
				if l[k] + l[j] == i and don[k] == 0:
					don[k] = 1
					num += 1
					break
		mx = max(num, mx)
	print(mx)


def check(arr, s):
	count = 0
	i = 0
	j = n - 1
	while i < j:
		if arr[i] + arr[j] == s:
			count += 1
			i += 1
			j -= 1
		elif arr[i] + arr[j] < s:
			i += 1
		else:
			j -= 1
	return count
for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	ans = []
	for i in range(2, 2 * n + 1):
		ans.append(check(arr, i))
	print(max(ans))


import bisect
import copy
import fractions
import heapq
import math
import random
import sys
T = int(input())
for t in range(T):
	N = int(input())
	W = list(map(int, input().split()))
	W.sort()
	cnts = {w: 0 for w in range(N + 1)}
	for w in W:
		cnts[w] += 1
	max_teams = 0
	for s in range(min(W) * 2, max(W) * 2 + 1):
		teams = 0
		for w in set(W):
			if w > s // 2 or s - w not in cnts:
				continue
			if w == s - w:
				teams += min(cnts[w], cnts[s - w]) // 2
			else:
				teams += min(cnts[w], cnts[s - w])
		max_teams = max(max_teams, teams)
		if max_teams == N // 2:
			break
	print(max_teams)


for _ in range(int(input())):
	amr = dict()
	x = int(input())
	myList = list(map(int, input().split()))
	ans = 0
	for i in range(2, 101):
		counts = [0] * 101
		pairs = 0
		for item in myList:
			if i > item and counts[i - item] != 0:
				counts[i - item] -= 1
				pairs += 1
			else:
				counts[item] += 1
		ans = max(pairs, ans)
	print(ans)


from collections import Counter
for _ in range(int(input())):
	n = int(input())
	lst = list(map(int, input().split()))
	if n == 1:
		print(0)
		continue
	dct = Counter(lst)
	lst1 = list(dct.keys())
	l = len(lst1)
	dct2 = {}
	for i in range(l):
		for j in range(i, l, 1):
			sm = lst1[i] + lst1[j]
			if sm in dct2.keys():
				if i == j:
					dct2[sm] += dct[lst1[i]] // 2
				else:
					dct2[sm] += min(dct[lst1[i]], dct[lst1[j]])
			elif i == j:
				dct2[sm] = dct[lst1[i]] // 2
			else:
				dct2[sm] = min(dct[lst1[i]], dct[lst1[j]])
	print(max(dct2.values()))


import os
import sys
from io import BytesIO, IOBase

def getPairs(W, target):
	seen = dict()
	pairs = 0
	for w in W:
		if target - w in seen:
			pairs += 1
			seen[target - w] -= 1
			if seen[target - w] == 0:
				seen.pop(target - w)
		else:
			seen[w] = seen.get(w, 0) + 1
	return pairs

def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		W = list(map(int, input().split()))
		possible = set()
		for i in range(n):
			for j in range(i + 1, n):
				possible.add(W[i] + W[j])
		ans = 0
		for s in possible:
			ans = max(ans, getPairs(W, s))
		print(ans)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = lambda s: self.buffer.write(s.encode()) if self.writable else None

	def read(self):
		if self.buffer.tell():
			return self.buffer.read().decode('ascii')
		return os.read(self._fd, os.fstat(self._fd).st_size).decode('ascii')

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline().decode('ascii')

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

def print(*args, sep=' ', end='\n', file=sys.stdout, flush=False):
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(end)
	if flush:
		file.flush()
(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
sys.setrecursionlimit(10000)
main()


def soln():
	n = int(input())
	wt = list(map(int, input().split()))
	mapy = [0] * (n + 1)
	for i in wt:
		mapy[i] += 1
	maxy = 0
	wt = list(set(wt))
	for i in range(2, 2 * n + 1):
		temp = mapy.copy()
		count = 0
		for j in range(1, (i + 1) // 2):
			if i - j > n:
				continue
			else:
				count += min(temp[j], temp[i - j])
		if i % 2 == 0:
			count += max(0, temp[i // 2] // 2)
		maxy = max(maxy, count)
	return maxy
for i in range(int(input())):
	print(soln())


import math
import heapq, bisect
import sys
from collections import deque, defaultdict
from fractions import Fraction
import sys
mod = 10 ** 9 + 7
mod1 = 998244353
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

class TreeNode:

	def __init__(self, k, v):
		self.key = k
		self.value = v
		self.left = None
		self.right = None
		self.parent = None
		self.height = 1
		self.num_left = 1
		self.num_total = 1

class AvlTree:

	def __init__(self):
		self._tree = None

	def add(self, k, v):
		if not self._tree:
			self._tree = TreeNode(k, v)
			return
		node = self._add(k, v)
		if node:
			self._rebalance(node)

	def _add(self, k, v):
		node = self._tree
		while node:
			if k < node.key:
				if node.left:
					node = node.left
				else:
					node.left = TreeNode(k, v)
					node.left.parent = node
					return node.left
			elif node.key < k:
				if node.right:
					node = node.right
				else:
					node.right = TreeNode(k, v)
					node.right.parent = node
					return node.right
			else:
				node.value = v
				return

	@staticmethod
	def get_height(x):
		return x.height if x else 0

	@staticmethod
	def get_num_total(x):
		return x.num_total if x else 0

	def _rebalance(self, node):
		n = node
		while n:
			lh = self.get_height(n.left)
			rh = self.get_height(n.right)
			n.height = max(lh, rh) + 1
			balance_factor = lh - rh
			n.num_total = 1 + self.get_num_total(n.left) + self.get_num_total(n.right)
			n.num_left = 1 + self.get_num_total(n.left)
			if balance_factor > 1:
				if self.get_height(n.left.left) < self.get_height(n.left.right):
					self._rotate_left(n.left)
				self._rotate_right(n)
			elif balance_factor < -1:
				if self.get_height(n.right.right) < self.get_height(n.right.left):
					self._rotate_right(n.right)
				self._rotate_left(n)
			else:
				n = n.parent

	def _remove_one(self, node):
		replacement = node.left or node.right
		if node.parent:
			if AvlTree._is_left(node):
				node.parent.left = replacement
			else:
				node.parent.right = replacement
			replacement.parent = node.parent
			node.parent = None
		else:
			self._tree = replacement
			replacement.parent = None
		node.left = None
		node.right = None
		node.parent = None
		self._rebalance(replacement)

	def _remove_leaf(self, node):
		if node.parent:
			if AvlTree._is_left(node):
				node.parent.left = None
			else:
				node.parent.right = None
			self._rebalance(node.parent)
		else:
			self._tree = None
		node.parent = None
		node.left = None
		node.right = None

	def remove(self, k):
		node = self._get_node(k)
		if not node:
			return
		if AvlTree._is_leaf(node):
			self._remove_leaf(node)
			return
		if node.left and node.right:
			nxt = AvlTree._get_next(node)
			node.key = nxt.key
			node.value = nxt.value
			if self._is_leaf(nxt):
				self._remove_leaf(nxt)
			else:
				self._remove_one(nxt)
			self._rebalance(node)
		else:
			self._remove_one(node)

	def get(self, k):
		node = self._get_node(k)
		return node.value if node else -1

	def _get_node(self, k):
		if not self._tree:
			return None
		node = self._tree
		while node:
			if k < node.key:
				node = node.left
			elif node.key < k:
				node = node.right
			else:
				return node
		return None

	def get_at(self, pos):
		x = pos + 1
		node = self._tree
		while node:
			if x < node.num_left:
				node = node.left
			elif node.num_left < x:
				x -= node.num_left
				node = node.right
			else:
				return (node.key, node.value)
		raise IndexError('Out of ranges')

	@staticmethod
	def _is_left(node):
		return node.parent.left and node.parent.left == node

	@staticmethod
	def _is_leaf(node):
		return node.left is None and node.right is None

	def _rotate_right(self, node):
		if not node.parent:
			self._tree = node.left
			node.left.parent = None
		elif AvlTree._is_left(node):
			node.parent.left = node.left
			node.left.parent = node.parent
		else:
			node.parent.right = node.left
			node.left.parent = node.parent
		bk = node.left.right
		node.left.right = node
		node.parent = node.left
		node.left = bk
		if bk:
			bk.parent = node
		node.height = max(self.get_height(node.left), self.get_height(node.right)) + 1
		node.num_total = 1 + self.get_num_total(node.left) + self.get_num_total(node.right)
		node.num_left = 1 + self.get_num_total(node.left)

	def _rotate_left(self, node):
		if not node.parent:
			self._tree = node.right
			node.right.parent = None
		elif AvlTree._is_left(node):
			node.parent.left = node.right
			node.right.parent = node.parent
		else:
			node.parent.right = node.right
			node.right.parent = node.parent
		bk = node.right.left
		node.right.left = node
		node.parent = node.right
		node.right = bk
		if bk:
			bk.parent = node
		node.height = max(self.get_height(node.left), self.get_height(node.right)) + 1
		node.num_total = 1 + self.get_num_total(node.left) + self.get_num_total(node.right)
		node.num_left = 1 + self.get_num_total(node.left)

	@staticmethod
	def _get_next(node):
		if not node.right:
			return node.parent
		n = node.right
		while n.left:
			n = n.left
		return n

class SegmentTree1:

	def __init__(self, data, default=0, func=lambda a, b: max(a, b)):
		self._default = default
		self._func = func
		self._len = len(data)
		self._size = _size = 1 << (self._len - 1).bit_length()
		self.data = [default] * (2 * _size)
		self.data[_size:_size + self._len] = data
		for i in reversed(range(_size)):
			self.data[i] = func(self.data[i + i], self.data[i + i + 1])

	def __delitem__(self, idx):
		self[idx] = self._default

	def __getitem__(self, idx):
		return self.data[idx + self._size]

	def __setitem__(self, idx, value):
		idx += self._size
		self.data[idx] = value
		idx >>= 1
		while idx:
			self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
			idx >>= 1

	def __len__(self):
		return self._len

	def query(self, start, stop):
		if start == stop:
			return self.__getitem__(start)
		stop += 1
		start += self._size
		stop += self._size
		res = self._default
		while start < stop:
			if start & 1:
				res = self._func(res, self.data[start])
				start += 1
			if stop & 1:
				stop -= 1
				res = self._func(res, self.data[stop])
			start >>= 1
			stop >>= 1
		return res

	def __repr__(self):
		return 'SegmentTree({0})'.format(self.data)

class SegmentTree:

	def __init__(self, data, default=0, func=lambda a, b: a + b):
		self._default = default
		self._func = func
		self._len = len(data)
		self._size = _size = 1 << (self._len - 1).bit_length()
		self.data = [default] * (2 * _size)
		self.data[_size:_size + self._len] = data
		for i in reversed(range(_size)):
			self.data[i] = func(self.data[i + i], self.data[i + i + 1])

	def __delitem__(self, idx):
		self[idx] = self._default

	def __getitem__(self, idx):
		return self.data[idx + self._size]

	def __setitem__(self, idx, value):
		idx += self._size
		self.data[idx] = value
		idx >>= 1
		while idx:
			self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
			idx >>= 1

	def __len__(self):
		return self._len

	def query(self, start, stop):
		if start == stop:
			return self.__getitem__(start)
		stop += 1
		start += self._size
		stop += self._size
		res = self._default
		while start < stop:
			if start & 1:
				res = self._func(res, self.data[start])
				start += 1
			if stop & 1:
				stop -= 1
				res = self._func(res, self.data[stop])
			start >>= 1
			stop >>= 1
		return res

	def __repr__(self):
		return 'SegmentTree({0})'.format(self.data)

class Factorial:

	def __init__(self, MOD):
		self.MOD = MOD
		self.factorials = [1, 1]
		self.invModulos = [0, 1]
		self.invFactorial_ = [1, 1]

	def calc(self, n):
		if n <= -1:
			print('Invalid argument to calculate n!')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		if n < len(self.factorials):
			return self.factorials[n]
		nextArr = [0] * (n + 1 - len(self.factorials))
		initialI = len(self.factorials)
		prev = self.factorials[-1]
		m = self.MOD
		for i in range(initialI, n + 1):
			prev = nextArr[i - initialI] = prev * i % m
		self.factorials += nextArr
		return self.factorials[n]

	def inv(self, n):
		if n <= -1:
			print('Invalid argument to calculate n^(-1)')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		p = self.MOD
		pi = n % p
		if pi < len(self.invModulos):
			return self.invModulos[pi]
		nextArr = [0] * (n + 1 - len(self.invModulos))
		initialI = len(self.invModulos)
		for i in range(initialI, min(p, n + 1)):
			next = -self.invModulos[p % i] * (p // i) % p
			self.invModulos.append(next)
		return self.invModulos[pi]

	def invFactorial(self, n):
		if n <= -1:
			print('Invalid argument to calculate (n^(-1))!')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		if n < len(self.invFactorial_):
			return self.invFactorial_[n]
		self.inv(n)
		nextArr = [0] * (n + 1 - len(self.invFactorial_))
		initialI = len(self.invFactorial_)
		prev = self.invFactorial_[-1]
		p = self.MOD
		for i in range(initialI, n + 1):
			prev = nextArr[i - initialI] = prev * self.invModulos[i % p] % p
		self.invFactorial_ += nextArr
		return self.invFactorial_[n]

class Combination:

	def __init__(self, MOD):
		self.MOD = MOD
		self.factorial = Factorial(MOD)

	def ncr(self, n, k):
		if k < 0 or n < k:
			return 0
		k = min(k, n - k)
		f = self.factorial
		return f.calc(n) * f.invFactorial(max(n - k, k)) * f.invFactorial(min(k, n - k)) % self.MOD

def powm(a, n, m):
	if a == 1 or n == 0:
		return 1
	if n % 2 == 0:
		s = powm(a, n // 2, m)
		return s * s % m
	else:
		return a * powm(a, n - 1, m) % m

def sort_list(list1, list2):
	zipped_pairs = zip(list2, list1)
	z = [x for (_, x) in sorted(zipped_pairs)]
	return z

def product(l):
	por = 1
	for i in range(len(l)):
		por *= l[i]
	return por

def binarySearchCount(arr, n, key):
	left = 0
	right = n - 1
	count = 0
	while left <= right:
		mid = int((right + left) / 2)
		if arr[mid] < key:
			count = mid + 1
			left = mid + 1
		else:
			right = mid - 1
	return count

def countdig(n):
	c = 0
	while n > 0:
		n //= 10
		c += 1
	return c

def binary(x, length):
	y = bin(x)[2:]
	return y if len(y) >= length else '0' * (length - len(y)) + y

def countGreater(arr, n, k):
	l = 0
	r = n - 1
	leftGreater = n
	while l <= r:
		m = int(l + (r - l) / 2)
		if arr[m] >= k:
			leftGreater = m
			r = m - 1
		else:
			l = m + 1
	return n - leftGreater
for ik in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	if n == 1:
		print(0)
		continue
	a.sort()
	d = defaultdict(int)
	cou = defaultdict(int)
	s = set()
	e = set()
	for i in range(n):
		cou[a[i]] += 1
		e.add(a[i])
	for i in e:
		for j in e:
			if (i, j) in s or (j, i) in s:
				continue
			if i == j:
				d[i + j] += cou[i] // 2
				s.add((i, j))
			else:
				d[i + j] += min(cou[i], cou[j])
				s.add((i, j))
				s.add((j, i))
	print(max(d.values()))


import sys
import math
from collections import Counter
import heapq
try:
	for _ in range(int(input())):
		n = int(input())
		a = [int(i) for i in input().split()]
		a.sort()
		p = max(a)
		ans = 0
		for i in range(2 * p + 1):
			sm = i
			cnt = 0
			vis = [False] * n
			for k in range(n):
				for j in range(k + 1, n):
					if not vis[k] and (not vis[j]) and (a[k] + a[j] == sm):
						cnt += 1
						vis[k] = True
						vis[j] = True
			ans = max(ans, cnt)
		print(ans)
except EOFError as e:
	print(e)


from math import ceil, gcd
from bisect import bisect_left as bl
from bisect import bisect_right as br
from array import array
from collections import Counter as ctr

def li():
	return list(map(int, input().split()))

def arr(a):
	return array('i', a)

def solve():
	for _ in range(int(input())):
		n = int(input())
		w = ctr(li())
		ans = [0] * 101
		for i in w:
			for j in w:
				if i != j:
					ans[i + j] += min(w[i], w[j]) / 2
				else:
					ans[2 * i] += w[i] // 2
		print(int(max(ans)))
solve()


from collections import defaultdict, deque
from bisect import bisect_left as lower
import sys

def put():
	return map(int, input().split())

def count(w):
	(i, j, c) = (0, n - 1, 0)
	while i < j:
		curr = l[i] + l[j]
		if curr == w:
			i += 1
			j -= 1
			c += 1
		elif curr < w:
			i += 1
		else:
			j -= 1
	return c
t = int(input())
for _ in range(t):
	n = int(input())
	l = list(put())
	l.sort()
	ans = 0
	for i in range(2, 101):
		ans = max(ans, count(i))
	print(ans)


t = int(input())
for o in range(t):
	n = int(input())
	weights = list(map(int, input().strip().split()))
	weights.sort()
	possibleSums = {}
	for i in range(n):
		for j in range(i):
			sm = weights[i] + weights[j]
			possibleSums[sm] = 0
	ans = 0
	for sm in possibleSums.keys():
		for i in range(n - 1):
			if weights[i] + weights[i + 1] >= sm:
				j = i + 1
				if weights[i] == weights[i + 1]:
					while j < n and weights[j] == weights[i]:
						j += 1
					j -= 1
				lower = (i + j) // 2
				upper = lower + 1
				while lower >= 0 and upper <= n - 1:
					if weights[lower] + weights[upper] == sm:
						possibleSums[sm] = possibleSums[sm] + 1
						lower -= 1
						upper += 1
					elif weights[lower] + weights[upper] < sm:
						upper += 1
					else:
						lower -= 1
				break
		ans = max(ans, possibleSums[sm])
	print(ans)


import sys
from collections import defaultdict
t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, sys.stdin.readline().split()))
	dict1 = defaultdict(int)
	for i in range(n):
		for j in range(i + 1, n):
			dict1[arr[i] + arr[j]] += 1
	val = list(dict1.keys())
	ans = 0
	for x in val:
		s = defaultdict(int)
		temp = 0
		for y in arr:
			if s[x - y] > 0:
				temp += 1
				s[x - y] -= 1
			else:
				s[y] += 1
		ans = max(ans, temp)
	print(ans)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	d = {}
	for i in a:
		d[i] = d.get(i, 0) + 1
	s = 0
	for i in range(2, 101):
		ans = 0
		for j in d:
			if j * 2 != i:
				ans += min(d.get(j, 0), d.get(i - j, 0))
			else:
				ans += d.get(j, 0) // 2 * 2
		ans //= 2
		s = max(ans, s)
	print(s)


import math
from itertools import combinations
t = int(input())
for case in range(t):
	n = int(input())
	w = [int(i) for i in input().split()]
	(dic, nums) = ({}, [])
	for i in range(n):
		if w[i] not in dic:
			dic[w[i]] = 1
			nums.append(w[i])
		else:
			dic[w[i]] += 1
	comb = list(combinations(nums, 2))
	sumc = {}
	for i in comb:
		tot = sum(i)
		if tot not in sumc:
			minc = min(dic[i[0]], dic[i[1]])
			sumc[tot] = minc
		else:
			minc = min(dic[i[0]], dic[i[1]])
			sumc[tot] += minc
	for i in nums:
		tot = 2 * i
		if tot not in sumc:
			sumc[tot] = dic[i] // 2
		else:
			sumc[tot] += dic[i] // 2
	res = 0
	for i in sumc:
		res = max(res, sumc[i])
	print(res)


import sys
input = lambda : sys.stdin.readline().rstrip()
for _ in range(int(input())):
	n = int(input())
	a = [int(i) for i in input().split()]
	a.sort()
	ans = []
	for i in range(2, 101):
		c = a[:]
		cur = 0
		for j in range(n):
			s = c[j]
			if s == -101:
				continue
			for k in range(j + 1, n):
				if c[k] + s == i:
					c[k] = -101
					cur += 1
					break
		ans.append(cur)
	print(max(ans))


for _ in range(int(input())):
	n = int(input())
	w = list(map(int, input().split()))
	w.sort()
	maxx = -1
	for k in range(1, 101):
		i = 0
		j = n - 1
		count = 0
		while i < j:
			if w[i] + w[j] > k:
				j -= 1
			elif w[i] + w[j] < k:
				i += 1
			else:
				i += 1
				j -= 1
				count += 1
		if count > maxx:
			maxx = count
	print(maxx)


from sys import stdin
from collections import Counter
from itertools import combinations

def main():
	l = stdin.read().splitlines()[2::2]
	for (i, s) in enumerate(l):
		cnt = Counter(map(int, s.split()))
		ab = Counter({a * 2: x // 2 for (a, x) in cnt.items()})
		for ((a, x), (b, y)) in combinations(cnt.items(), 2):
			ab[a + b] += x if x < y else y
		l[i] = str(ab.most_common(1)[0][1])
	print('\n'.join(l))
main()


for _ in range(int(input())):
	n = int(input())
	w = [int(x) for x in input().strip().split()]
	w.sort()
	if n == 1:
		print(0)
		continue
	minn = w[0] + w[1]
	maxx = w[-1] + w[-2]
	maxpairs = 0
	for s in range(minn, maxx + 1):
		i = 0
		j = n - 1
		pairs = 0
		while i < j:
			if w[i] + w[j] == s:
				pairs += 1
				i += 1
				j -= 1
			elif w[i] + w[j] < s:
				i += 1
			elif w[i] + w[j] > s:
				j -= 1
		maxpairs = max(pairs, maxpairs)
	print(maxpairs)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	from collections import Counter
	b = Counter(a)
	k = sorted(list(b.keys()))
	s = set()
	for i in range(len(k) - 1):
		for j in range(i + 1, len(k)):
			s.add(k[i] + k[j])
	gm = 0
	for i in s:
		tm = 0
		for j in k:
			for p in k:
				if p + j == i:
					tm += min(b[j], b[i - j])
		gm = max(gm, tm // 2)
	print(max(gm, b.most_common(1)[0][1] // 2))


for _ in range(int(input())):
	n = int(input())
	w = list(sorted(map(int, input().split())))
	ma = 0
	for s in range(2, 2 * w[-1] + 1):
		l = 0
		r = n - 1
		cnt = 0
		while l < r:
			cs = w[l] + w[r]
			if cs == s:
				cnt += 1
				l += 1
				r -= 1
			elif cs < s:
				l += 1
			else:
				r -= 1
		ma = max(ma, cnt)
	print(ma)


from sys import stdin
g = lambda : stdin.readline().strip()
gl = lambda : g().split()
gil = lambda : [int(var) for var in gl()]
gcl = lambda : list(g())
gbs = lambda : [int(var) for var in g()]
from collections import deque
(t,) = gil()
for _ in range(t):
	(n,) = gil()
	a = gil()
	weights = set()
	a.sort()
	for i in range(n):
		for j in range(i + 1, n):
			weights.add(a[i] + a[j])
	ans = 0
	for s in weights:
		(l, r, k) = (0, n - 1, 0)
		while l < r:
			sum_ = a[l] + a[r]
			if sum_ > s:
				r -= 1
			elif sum_ < s:
				l += 1
			else:
				l += 1
				r -= 1
				k += 1
		ans = max(k, ans)
	print(ans)


from collections import defaultdict

def boats_competition():
	t = int(input())
	for _ in range(t):
		n = int(input())
		a = [int(x) for x in input().split()]
		a = sorted(a)
		max_count = 0
		for i in range(1, 101):
			mp = defaultdict(int)
			mp[a[0]] = 1
			count = 0
			for j in range(1, n):
				if i - a[j] in mp:
					mp[i - a[j]] -= 1
					if mp[i - a[j]] <= 0:
						del mp[i - a[j]]
					count += 1
				else:
					mp[a[j]] += 1
			max_count = max(max_count, count)
		print(max_count)
boats_competition()


for _ in range(int(input())):
	n = int(input())
	lst = list(map(int, input().split()))
	lk = []
	for i in range(n - 1):
		for j in range(i + 1, n):
			if lst[i] + lst[j] not in lk:
				lk.append(lst[i] + lst[j])
	mx = 0
	for sm in lk:
		lt = [x for x in lst]
		cnt = 0
		for j in range(n - 1):
			if lt[j] != 'X':
				for k in range(j + 1, n):
					if lt[k] != 'X':
						if lt[k] == sm - lt[j]:
							lt[k] = 'X'
							cnt += 1
							break
		if cnt > mx:
			mx = cnt
	print(mx)


import sys
input = sys.stdin.buffer.readline
from collections import deque as que, defaultdict as vector
from bisect import bisect as bsearch
from heapq import *
inin = lambda : int(input())
inar = lambda : list(map(int, input().split()))
INF = float('inf')
testcase = inin()
for Case in range(testcase):
	n = inin()
	w = inar()
	sums = set()
	for i in range(n):
		for j in range(n):
			if i != j:
				sums.add(w[i] + w[j])
	mpp = vector(int)
	for i in w:
		mpp[i] += 1
	ans = 0
	for i in sums:
		temp = 0
		mp = mpp.copy()
		for j in w:
			if mp[i - j] and mp[j] and (i - j != j):
				mp[i - j] -= 1
				mp[j] -= 1
				temp += 1
			if mp[j] >= 2 and i - j == j:
				mp[i - j] -= 1
				mp[j] -= 1
				temp += 1
		ans = max(ans, temp)
	print(ans)


import collections

def teams(A, w):
	count = 0
	hash = collections.Counter(A)
	for i in range(len(A)):
		if hash[A[i]] == 0:
			continue
		hash[A[i]] -= 1
		if w - A[i] in hash and hash[w - A[i]] != 0:
			count += 1
			hash[w - A[i]] -= 1
	return count

def boats(A):
	A.sort()
	ans = 0
	for i in range(1, 101):
		z = teams(A, i)
		ans = max(ans, z)
	print(ans)
t = int(input())
for i in range(t):
	n = int(input())
	A = [int(i) for i in input().split()][:n]
	boats(A)


from collections import Counter

def score(cN, target):
	ret1 = 0
	ret2 = 0
	for k in cN:
		if 2 * k == target:
			ret1 += cN[k] // 2
		else:
			l = target - k
			ret2 += min(cN[k], cN[l])
	return ret1 + ret2 // 2

def ans(N):
	N = sorted(N)
	cN = Counter(N)
	return max((score(cN, target) for target in range(2, 101)))
T = int(input())
for t in range(T):
	input()
	N = list(map(int, input().split()))
	print(ans(N))


import sys
fast_reader = sys.stdin.readline
fast_writer = sys.stdout.write

def input():
	return fast_reader().strip()

def print(*argv):
	fast_writer(' '.join((str(i) for i in argv)))
	fast_writer('\n')
for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	if n == 1:
		print(0)
		continue
	l.sort()
	ans = 0
	m1 = min(l)
	m2 = max(l)
	if m1 == m2:
		print(n // 2)
		continue
	for k in range(m1, 2 * m2 + 1):
		v = set()
		temp = 0
		for i in range(n):
			if i in v or l[i] > k:
				continue
			else:
				for j in range(i + 1, n):
					if j in v:
						continue
					if l[j] > k:
						break
					pp = l[i] + l[j]
					if pp > k:
						break
					if pp == k:
						v.add(i)
						v.add(j)
						temp += 1
						break
		ans = max(ans, temp)
	print(ans)


def findCount(arr, n):
	ct = 0
	vis = {}
	for i in arr:
		if n - i in vis:
			if vis[n - i]:
				vis[n - i] -= 1
				ct += 1
			else:
				if i not in vis:
					vis[i] = 0
				vis[i] += 1
		else:
			if i not in vis:
				vis[i] = 0
			vis[i] += 1
	return ct
for t in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	ans = 0
	for i in range(2, 101):
		temp = findCount(arr, i)
		ans = max(ans, temp)
	print(ans)


import sys, math, heapq, copy
from collections import defaultdict, deque
from bisect import bisect_left, bisect_right

def fun(l, lb, ub, k):
	cnt = 0
	while lb < ub:
		x = l[lb] + l[ub]
		if x == k:
			lb += 1
			ub -= 1
			cnt += 1
		elif x < k:
			lb += 1
		else:
			ub -= 1
	return cnt
t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	start = 0
	end = n - 1
	ans = 1
	while start <= n - 4:
		key = l[start] + l[end]
		cnt = 1 + fun(l, start + 1, end - 1, key)
		ans = max(ans, cnt)
		if end - start == 3:
			start += 1
			end = n - 1
		elif end - start > 3:
			end -= 1
	if n < 2:
		ans = 0
	print(ans)


for t in range(int(input())):
	n = int(input())
	w = list(map(int, input().split()))
	d = {}
	for r in w:
		d[r] = d.get(r, 0) + 1
	team = {}
	mem = list(d.keys())
	for i in range(len(mem)):
		key = mem[i]
		k = 2 * key
		val = d[key] // 2
		team[k] = team.get(k, 0) + val
		for j in range(i + 1, len(mem)):
			(k1, k2) = (mem[i], mem[j])
			t = min(d[k1], d[k2])
			k = k1 + k2
			team[k] = team.get(k, 0) + t
	team = max(list(team.values()))
	print(team)


for t in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	maxm = 0
	for ele in range(1, 101):
		i = 0
		j = n - 1
		c = 0
		while i < j:
			if arr[j] + arr[i] == ele:
				c += 1
				i += 1
				j -= 1
			elif arr[j] + arr[i] > ele:
				j -= 1
			else:
				i += 1
		maxm = max(maxm, c)
	print(maxm)


from sys import stdin, stdout
fullans = ''
for _ in range(int(stdin.readline())):
	n = int(stdin.readline())
	ls = sorted(list(map(int, stdin.readline().split())))
	mx = 0
	for s in range(1, 101):
		cnt = 0
		i = 0
		j = n - 1
		while i < j:
			if ls[i] + ls[j] == s:
				cnt += 1
				i += 1
				j -= 1
			elif ls[i] + ls[j] > s:
				j -= 1
			else:
				i += 1
		mx = max(mx, cnt)
	fullans += f'{mx}\n'
stdout.write(fullans)


t = int(input())

def countpairs(s):
	w = ws.copy()
	pairs = 0
	while len(w) > 1:
		a = w[0]
		target = s - w[0]
		w.remove(a)
		if target in w:
			pairs += 1
			w.remove(target)
	return pairs
for t_ in range(t):
	n = int(input())
	ws = [int(i) for i in input().split()]
	s_max = max(ws) * 2
	max_pairs = 0
	for s in range(s_max + 1):
		p = countpairs(s)
		if p > max_pairs:
			max_pairs = p
		if max_pairs == int(n / 2):
			break
	print(max_pairs)


from fractions import Fraction
from collections import defaultdict
import math
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))

def input():
	return sys.stdin.readline().rstrip('\r\n')
for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	if n == 1:
		print('0')
	else:
		d = defaultdict(int)
		c = defaultdict(int)
		s = set()
		e = set(l)
		f = list()
		for i in range(n):
			c[l[i]] += 1
		for i in e:
			for j in e:
				if (i, j) in s or (j, i) in s:
					continue
				if i == j:
					d[i + j] += c[i] // 2
					s.add((i, j))
				else:
					d[i + j] += min(c[i], c[j])
					s.add((i, j))
					s.add((j, i))
		ans = list(d.values())
		print(max(ans))


T = int(input())
for t in range(T):
	n = int(input())
	s = input()
	a = s.split()
	for i in range(n):
		a[i] = int(a[i])
	d = {}
	for k in a:
		if k in d:
			d[k] += 1
		else:
			d[k] = 1
	b = set(a)
	b = list(b)
	dic = {}
	for i in range(len(b)):
		for j in range(i + 1, len(b)):
			mn = min(d[b[i]], d[b[j]])
			if b[i] + b[j] in dic:
				dic[b[i] + b[j]] += mn
			else:
				dic[b[i] + b[j]] = mn
		if b[i] + b[i] in dic:
			dic[b[i] + b[i]] += d[b[i]] // 2
		else:
			dic[b[i] + b[i]] = d[b[i]] // 2
	print(max(list(dic.values())))


from collections import defaultdict, Counter

def maximum_teams(weights):
	weights.sort()
	c = Counter(weights)
	summation = defaultdict(int)
	for i in c:
		for j in c:
			if i <= j:
				if i != j:
					summation[i + j] += min(c[i], c[j])
				else:
					summation[i + j] += c[i] // 2
	return max(summation.values())
t = int(input())
for _ in range(t):
	n = int(input())
	weights = list(map(int, input().split()))
	print(maximum_teams(weights))


t = int(input())
for _ in range(t):
	n = int(input())
	sums = [set() for i in range(101)]
	x = list(map(int, input().split()))
	for i in range(len(x)):
		for j in range(i + 1, len(x)):
			w = x[i] + x[j]
			if i not in sums[w] and j not in sums[w]:
				sums[w].add(i)
				sums[w].add(j)
	print(max((len(i) for i in sums)) // 2)


import os
TEST_DIR = './tests/'

def main():
	if __file__ == 'run.py':
		tests()
	else:
		submit()

def tests():
	for test_case in os.listdir(TEST_DIR):
		if '.swp' in test_case:
			continue
		tests = []
		expectations = []
		with open(TEST_DIR + test_case, 'r') as f:
			t = int(f.readline())
			for _ in range(t):
				n = int(f.readline())
				tests.append(list(map(int, f.readline().split(' '))))
			for _ in range(t):
				expectations.append(int(f.readline().strip()))
		sub_test = 0
		for ix in range(len(tests)):
			result = solution(tests[ix])
			if result == expectations[ix]:
				print(f'{test_case}.{str(sub_test)} passed')
			else:
				print(f'{test_case}.{str(sub_test)} failed')
				print(f'\tResult: {str(result)}')
				print(f'\tExpected: {str(expectations[ix])}\n')
			sub_test += 1

def submit():
	tests = []
	t = int(input())
	for _ in range(t):
		n = int(input())
		tests.append(list(map(int, input().split(' '))))
	for test in tests:
		print(solution(test))

def solution(w):
	weights = {}
	for weight in w:
		if weight not in weights:
			weights[weight] = 0
		weights[weight] += 1
	pairs = {}
	for target in range(2 * len(w) + 1):
		pairs[target] = 0
		for weight in weights:
			complement = target - weight
			if complement not in weights:
				continue
			pairs[target] += min(weights[weight], weights[complement])
	r = 0
	for pair in pairs:
		r = max(r, pairs[pair])
	return r // 2
main()


for _ in range(int(input())):
	n = int(input())
	arr = [int(f) for f in input().split()]
	d = {}
	maxi = -1
	arr.sort()
	ans = 0
	for k in range(2, 101):
		i = 0
		j = n - 1
		count = 0
		while i < j:
			if arr[i] + arr[j] == k:
				count += 1
				i += 1
				j -= 1
			elif arr[i] + arr[j] < k:
				i += 1
			else:
				j -= 1
		if count > ans:
			ans = count
	print(ans)


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	if n == 1:
		print(0)
	else:
		arr.sort()

		def func(m):
			p = 0
			q = n - 1
			cnt = 0
			while p < q:
				if arr[p] + arr[q] == m:
					cnt += 1
					p += 1
					q -= 1
				elif arr[p] + arr[q] < m:
					p += 1
				else:
					q -= 1
			return cnt
		ans = []
		for i in range(n):
			for j in range(i + 1, n):
				ans.append(func(arr[i] + arr[j]))
		print(max(ans))


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	i = 0
	d = {}
	o = {}
	while i < len(l):
		j = i + 1
		while j < len(l):
			x = l[i] + l[j]
			if x not in d:
				d[x] = [0] * len(l)
				u = d[x]
				u[i] = 1
				u[j] = 1
				d[x] = u
				if x in o:
					o[x] = o[x] + 1
				else:
					o[x] = 1
			else:
				u = d[x]
				if u[i] == 0 and u[j] == 0:
					u[i] = 1
					u[j] = 1
					d[x] = u
					if x in o:
						o[x] = o[x] + 1
					else:
						o[x] = 1
			j = j + 1
		i = i + 1
	m = 0
	for i in o:
		if o[i] > m:
			m = o[i]
	print(m)


from sys import stdin, stdout
import bisect
import math
from collections import deque, Counter
mod = 10 ** 9 + 7

def st():
	return list(stdin.readline().strip())

def inp():
	return int(stdin.readline())

def li():
	return list(map(int, stdin.readline().split()))

def mp():
	return map(int, stdin.readline().split())

def pr(n):
	stdout.write(str(n) + '\n')

def DFS(dictionary, vertex, visited):
	visited[vertex] = True
	stack = [vertex]
	print(vertex)
	while stack:
		a = stack.pop()
		for i in dictionary[a]:
			if not visited[i]:
				print(i)
				visited[i] = True
				stack.append(i)

def BFS(dictionary, vertex, visited):
	visited[vertex] = True
	q = deque()
	q.append(vertex)
	while q:
		a = q.popleft()
		for i in dictionary[a]:
			if not visited[i]:
				visited[i] = True
				q.append(i)
				print(i)

def soe(limit):
	l = [1] * (limit + 1)
	l[0] = 0
	l[1] = 0
	prime = []
	for i in range(2, limit + 1):
		if l[i]:
			for j in range(i * i, limit + 1, i):
				l[j] = 0
	for i in range(2, limit + 1):
		if l[i]:
			prime.append(i)
	return prime

def segsoe(low, high):
	limit = int(high ** 0.5) + 1
	prime = soe(limit)
	n = high - low + 1
	l = [0] * (n + 1)
	for i in range(len(prime)):
		lowlimit = low // prime[i] * prime[i]
		if lowlimit < low:
			lowlimit += prime[i]
		if lowlimit == prime[i]:
			lowlimit += prime[i]
		for j in range(lowlimit, high + 1, prime[i]):
			l[j - low] = 1
	for i in range(low, high + 1):
		if not l[i - low]:
			if i != 1:
				print(i)

def gcd(a, b):
	while b:
		a = a % b
		(b, a) = (a, b)
	return a

def power(a, n):
	r = 1
	while n:
		if n & 1:
			r = r * a
		a *= a
		n = n >> 1
	return r

def issum(l, x):
	c = 0
	i = 0
	j = len(l) - 1
	while i < j:
		a = l[i] + l[j]
		if a > x:
			j -= 1
		elif a < x:
			i += 1
		else:
			c += 1
			i += 1
			j -= 1
	return c

def solve():
	n = inp()
	l = li()
	ans = 0
	l.sort()
	for i in range(2, 101):
		ans = max(ans, issum(l, i))
	pr(ans)
for _ in range(inp()):
	solve()


from collections import defaultdict as dd
for _ in range(int(input())):
	n = int(input())
	ar = list(map(int, input().split()))
	ans = 0
	freq = dd(int)
	for i in ar:
		freq[i] += 1
	s = set(ar)
	for i in range(1, 2 * n + 1):
		an = 0
		for j in s:
			if freq[j] > 0 and freq[i - j] > 0:
				if j == i - j:
					an += (freq[j] + freq[i - j]) // 2
				else:
					an += min(freq[j], freq[i - j])
		ans = max(ans, an)
	print(ans // 2)


from collections import defaultdict
con = 10 ** 9 + 7
INF = float('inf')

def getlist():
	return list(map(int, input().split()))

def main():
	T = int(input())
	for _ in range(T):
		N = int(input())
		W = getlist()
		ans = 0
		D = defaultdict(int)
		for i in range(N):
			D[W[i]] += 1
		for i in range(2, 2 * N + 1):
			s = i
			val = 0
			for j in range(1, 2 * N + 1):
				a = j
				b = s - j
				if a > b:
					break
				if a == b:
					val += int(D[a] // 2)
				else:
					val += min(D[a], D[b])
			ans = max(ans, val)
		print(ans)
main()


import os
import sys
from io import BytesIO, IOBase

def solve():
	n = int(input())
	a = list(map(int, input().split()))
	d = []
	for i in range(n):
		for j in range(i + 1, len(a)):
			d.append(a[i] + a[j])
	l = 0
	r = n - 1
	d = set(d)
	a.sort()
	maxx = 0
	for i in d:
		l = 0
		r = n - 1
		cnt = 0
		while l < r:
			if a[l] + a[r] == i:
				cnt = cnt + 1
				l = l + 1
				r = r - 1
			elif a[l] + a[r] > i:
				r = r - 1
			elif a[l] + a[r] < i:
				l = l + 1
		if cnt > maxx:
			maxx = cnt
	print(maxx)

def main():
	pass
	for _ in range(int(input())):
		solve()
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


t = int(input())
for _ in range(t):
	n = int(input())
	arr = [int(x) for x in input().split()]
	dic = {}
	for i in range(n):
		for j in range(i + 1, n):
			currSum = arr[i] + arr[j]
			if dic.get(currSum):
				if i in dic[currSum] or j in dic[currSum]:
					continue
			else:
				dic[currSum] = set()
			dic[currSum].add(i)
			dic[currSum].add(j)
	maxTeams = 0
	for i in dic.keys():
		maxTeams = max(maxTeams, len(dic[i]) // 2)
	print(maxTeams)


for test in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	targ = 2 * n
	a = {}
	for i in arr:
		if i in a:
			a[i] += 1
		else:
			a[i] = 1
	ma = 0
	for i in range(2, targ + 1):
		temp = 0
		for j in a:
			if j * 2 == i:
				temp += a[j] // 2
			elif i - j in a:
				temp += min(a[j], a[i - j]) / 2
		ma = max(ma, temp)
	print(int(ma))


t = int(input())
for _ in range(t):
	n = int(input())
	w = list(map(int, input().split()))
	w = sorted(w)
	if n >= 2:
		maxCount = 0
		for total in range(w[-2] + w[-1], w[0] + w[1] - 1, -1):
			count = 0
			front = 0
			back = len(w) - 1
			while front < back:
				if w[front] + w[back] == total:
					front += 1
					back -= 1
					count += 1
				elif w[front] + w[back] < total:
					front += 1
				else:
					back -= 1
				if (back - front + 1) // 2 + count < maxCount:
					break
			if count > maxCount:
				maxCount = count
		print(maxCount)
	else:
		print(0)


import sys
input = sys.stdin.buffer.readline
import os
from math import *
t = int(input())
while t:
	t -= 1
	n = int(input())
	arr = list(map(int, input().split()))
	if n < 2:
		print('0')
	elif n < 4 and n > 1:
		print('1')
	else:
		check = -1
		arr.sort()
		val = arr[-1] + arr[-2]
		val2 = arr[0] + arr[1]
		ans = 0
		for i in range(val, val2 - 1, -1):
			j = 0
			k = n - 1
			temp = 0
			while j < k:
				s = arr[j] + arr[k]
				if s == i:
					temp += 1
					j += 1
					k -= 1
				elif s < i:
					j += 1
				else:
					k -= 1
			if ans < temp:
				ans = temp
				check = i
		print(ans)


from math import ceil
from collections import Counter
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def calculate(lst, target):
	temp = lst
	i = 0
	j = len(temp) - 1
	cnt = 0
	while i < j:
		if temp[i] + temp[j] == target:
			cnt += 1
			i += 1
			j -= 1
		elif temp[i] + temp[j] > target:
			j -= 1
		else:
			i += 1
	return cnt

def prog_name():
	n = int(input())
	final = 0
	l = list(map(int, input().split()))
	l.sort()
	for x in range(2, 2 * (n + 1)):
		initial = calculate(l, x)
		final = max(final, initial)
	print(final)

def main():
	T = int(input())
	for unique in range(T):
		prog_name()
main()


from collections import defaultdict
t = int(input())
for _ in range(t):
	n = int(input())
	w = list(map(int, input().split()))
	d = defaultdict(int)
	for i in range(n):
		d[w[i]] += 1
	best = 0
	for i in range(2, 2 * n + 1):
		score = 0
		for j in range(i // 2 + 1):
			if i - j == j:
				score += d[j] // 2
			else:
				score += min(d[j], d[i - j])
		if score > best:
			best = score
	print(best)


for _ in range(int(input())):
	n = int(input())
	a = sorted(list(map(int, input().split())))
	ans = 0
	for w in range(2, 106):
		for x in range(n):
			i = x
			j = n - 1
			cnt = 0
			while i <= j:
				if a[i] + a[j] == w and i != j:
					cnt += 1
					i += 1
					j -= 1
				elif a[i] + a[j] < w:
					i += 1
				else:
					j -= 1
			ans = max(ans, cnt)
	print(ans)


for l in [*open(0)][2::2]:
	c = __import__('collections').Counter(map(int, l.split()))
	print(max((sum((min(c[x], c[s - x]) for x in range(51))) for s in range(101))) // 2)


import collections
import math

def sums(l, n, k):
	l1 = [0] * n
	count = 0
	for i in range(n - 1):
		for j in range(i + 1, n):
			if l[i] + l[j] == k and l1[i] != 1 and (l1[j] != 1):
				count += 1
				l1[i] = 1
				l1[j] = 1
	return count
t = int(input())
for w in range(t):
	n = int(input())
	l = [int(i) for i in input().split()]
	if n == 1:
		print(0)
	elif n == 2:
		print(1)
	else:
		s = set()
		for i in range(n - 1):
			for j in range(i + 1, n):
				s.add(l[i] + l[j])
		m = 0
		for i in s:
			m = max(m, sums(l, n, i))
		print(m)


import sys
input = sys.stdin.readline

def find(x):
	start = 0
	end = n - 1
	cnt = 0
	while start < end:
		cur = l[start] + l[end]
		if cur == x:
			cnt += 1
			start += 1
			end -= 1
		elif cur > x:
			end -= 1
		else:
			start += 1
	return cnt
for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	ans = 0
	for i in range(2, 101):
		ans = max(ans, find(i))
	print(ans)


import math
for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	freq = [0] * 101
	for i in range(n):
		freq[arr[i]] += 1
	mx = 0
	temp = 0
	for i in range(2, 101):
		temp = 0
		for j in range(1, i // 2 + 1):
			if j == math.ceil(i / 2):
				temp += freq[j] // 2
			else:
				temp += min(freq[j], freq[i - j])
		mx = max(temp, mx)
	print(mx)


from collections import Counter
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	l = []
	a = sorted(a)
	for i in range(n):
		for j in range(i + 1, n):
			if a[i] + a[j] not in l:
				l.append(a[i] + a[j])
	if n == 1:
		print(0)
	else:
		pi = []
		for q in l:
			p = 0
			i = 0
			j = n - 1
			while i < j:
				if a[i] + a[j] == q:
					i = i + 1
					j = j - 1
					p = p + 1
				elif a[i] + a[j] < q:
					i = i + 1
				else:
					j = j - 1
			pi.append(p)
		print(max(pi))


import math
t = int(input())
while t != 0:
	n = int(input())
	arrW = sorted(list(map(int, input().split())))
	s = 0
	weight = [0] * 101
	singleWeight = [0] * 51
	for i in range(n):
		singleWeight[arrW[i]] += 1
	for i in range(len(singleWeight)):
		if singleWeight[i] > 1:
			weight[i * 2] += math.floor(singleWeight[i] / 2)
	i = 0
	j = 0
	arrGap = []
	arrGap.append(0)
	for i in range(n - 1):
		if arrW[i] != arrW[i + 1]:
			arrGap.append(i + 1)
	for i in range(len(arrGap) - 1):
		for j in range(i + 1, len(arrGap)):
			weight[arrW[arrGap[i]] + arrW[arrGap[j]]] += min(singleWeight[arrW[arrGap[i]]], singleWeight[arrW[arrGap[j]]])
	s = max(max(weight), s)
	print(s)
	t -= 1


import sys, math
t = int(sys.stdin.readline())
for _ in range(t):
	n = int(sys.stdin.readline())
	a = list(map(int, sys.stdin.readline().split()))
	a.sort()
	maxi = 0
	for s in range(2, 101):
		used = [False] * n
		total = 0
		for i2 in range(n):
			if not used[i2]:
				for i3 in range(i2 + 1, n, 1):
					if not used[i3] and a[i2] + a[i3] == s:
						(used[i2], used[i3]) = (True, True)
						total += 1
						break
		maxi = max(maxi, total)
	print(maxi)


import sys
INP = lambda : sys.stdin.readline().strip()
INT = lambda : int(INP())
MAP = lambda : map(int, INP().split())
ARR = lambda : [int(i) for i in INP().split()]

def JOIN(arr, x=' '):
	return x.join([str(i) for i in arr])

def EXIT(x='NO'):
	print(x)
	exit()
for _ in range(INT()):
	n = INT()
	arr = ARR()
	ans = 0
	for w in range(1, 2 * n + 1):
		a = 0
		vis = [False] * n
		for i in range(n):
			if not vis[i]:
				for j in range(i + 1, n):
					if not vis[j]:
						if arr[i] + arr[j] == w:
							(vis[i], vis[j]) = (True, True)
							a += 1
							break
		ans = max(ans, a)
	print(ans)


for __ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	ans = 0
	c = 0
	for i in range(2, 2 * n + 1):
		start = 0
		end = n - 1
		ans = 0
		while start < end:
			if a[start] + a[end] == i:
				ans += 1
				start += 1
				end -= 1
			elif a[start] + a[end] > i:
				end -= 1
			else:
				start += 1
		c = max(c, ans)
	print(c)


t = int(input())
for _ in range(t):
	n = int(input())
	arr = [0 for _ in range(101)]
	nums = list(map(int, input().split(' ')))
	for i in nums:
		arr[i] += 1
	nums = sorted(set(nums))
	ret = 0
	for i in range(100, 1, -1):
		buffer = arr[:]
		cur = 0
		for c in nums:
			if c + c > i:
				break
			match = min(buffer[c], buffer[i - c]) if c != i - c else buffer[c] // 2
			buffer[c] -= match
			buffer[i - c] -= match
			cur += match
		ret = max(cur, ret)
	print(ret)


for t in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	d = {}
	for i in range(n - 1):
		for j in range(i + 1, n):
			x = arr[i] + arr[j]
			if x not in d.keys():
				d[x] = [i, j]
			elif i not in d[x] and j not in d[x]:
				d[x].append(i)
				d[x].append(j)
	c = 0
	for i in d:
		c = max(c, len(d[i]))
	print(c // 2)


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	b = [0] * (n + 1)
	for i in a:
		b[i] += 1
	ans = 0
	for k in range(2, 2 * n + 1):
		count = 0
		for i in range(1, (k + 1) // 2):
			if k - i > n:
				continue
			count += min(b[i], b[k - i])
		if k % 2 == 0:
			count += b[k // 2] // 2
		ans = max(ans, count)
	print(ans)


for _ in range(int(input())):
	n = int(input())
	ar = list(map(int, input().split()))
	a = {}
	p = {}
	for i in range(n):
		if ar[i] not in a:
			a[ar[i]] = 1
		else:
			a[ar[i]] += 1
	a[0] = 0
	fs = [0] * (2 * max(ar) + 1)
	for s in range(2, max(ar) * 2 + 1):
		m = {}
		p = a.copy()
		for i in range(n):
			if s - ar[i] in m:
				if p[ar[i]] > 0 and p[s - ar[i]] > 0 and (ar[i] != s - ar[i]):
					fs[s] += 1
					p[s - ar[i]] -= 1
					p[ar[i]] -= 1
				elif ar[i] == s - ar[i] and p[ar[i]] > 1:
					p[ar[i]] -= 2
					fs[s] += 1
			else:
				m[ar[i]] = i
	print(max(fs))


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	flag = True
	dp = [[None] * n for i in range(n)]
	count = [0] * 101
	for i in l:
		count[i] += 1
	ans = 0
	for i in range(2, 2 * n + 1):
		temp = 0
		for j in range(1, i + 1):
			temp += min(count[j], count[i - j])
		temp = temp // 2
		ans = max(ans, temp)
	print(ans)


import random

def func():
	n = int(input())
	w = list(map(int, input().split()))
	global_max = 0
	w.sort()
	for sum_pair in range(2, 2 * max(w) + 1):
		W = list(w)
		temp_max = 0
		for i in range(len(W)):
			reqd_partner = sum_pair - W[i]
			if reqd_partner in W:
				j = W.index(reqd_partner)
				if j != i:
					W[i] = random.uniform(1, 2)
					W[j] = random.uniform(1, 2)
					temp_max += 1
		global_max = max(global_max, temp_max)
	print(global_max)
t = int(input())
for _ in range(t):
	func()


from sys import stdin, stdout
for query in range(int(stdin.readline())):
	n = int(stdin.readline())
	w = sorted([int(x) for x in stdin.readline().split()])
	mylist = [0] * 100
	for x in w:
		mylist[x] += 1
	best = 0
	for x in range(2, 101):
		count = 0
		newlist = mylist[:]
		for y in w:
			if newlist[x - y] > 0:
				count += 1
				newlist[x - y] -= 1
		best = max(best, count // 2)
	stdout.write(str(best) + '\n')


from collections import Counter
cases = int(input())
for i in range(cases):
	input()
	counts = Counter((int(i) for i in input().split(' ')))
	counters = Counter()
	numbers = list(counts.keys())
	for (idx, val) in enumerate(numbers):
		for val2 in numbers[idx:]:
			sum_num = val + val2
			if val == val2:
				if counts[val] > 1:
					counters.update({sum_num: counts[val] // 2})
			else:
				counters.update({sum_num: min(counts[val], counts[val2])})
	most_common = counters.most_common(1)
	print(most_common[0][1] if most_common else 0)


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	n = int(input())
	ar = list(map(int, input().split()))
	dic = {}
	for i in range(n):
		if ar[i] in dic:
			dic[ar[i]] += 1
		else:
			dic[ar[i]] = 1
	tem = 0
	for s in range(2, 2 * n + 1):
		num = 0
		for i in range(1, s // 2 + 1):
			xx = dic.get(i, 0)
			yy = dic.get(s - i, 0)
			if i == s - i:
				num += xx // 2
			else:
				num += min(xx, yy)
		tem = max(tem, num)
	print(tem)


import sys
import collections

def iinp():
	return int(input())

def inp():
	return input()

def mp():
	return map(int, inp().split())

def lmp():
	return list(mp())

def solve():
	n = iinp()
	a = collections.Counter(mp())
	ans = [0] * 400
	for i in a:
		for j in a:
			ans[i + j] += min(a[i], a[j])
	print(max(ans) // 2)
tt = 1
multi = True
if multi:
	tt = iinp()
for i in range(tt):
	solve()


import sys, io, os, time
from collections import defaultdict
from collections import OrderedDict
from collections import deque
from itertools import combinations
from itertools import permutations
import bisect, math, heapq
alphabet = 'abcdefghijklmnopqrstuvwxyz'
input = sys.stdin.readline
for ii in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	ans = 0
	arr.sort()
	for s in range(2, 101):
		done = [False] * n
		temp = 0
		for i in range(n):
			if not done[i]:
				check = s - arr[i]
				done[i] = True
				if check < 0:
					break
				for j in range(i + 1, n):
					f = 0
					if not done[j] and arr[j] == check:
						done[j] = True
						temp += 1
						break
		ans = max(ans, temp)
	print(ans)


for i in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	d = dict()
	for i in range(n):
		if l[i] in d:
			d[l[i]] += 1
		else:
			d[l[i]] = 1
	if n == 1:
		print(0)
	else:
		min1 = l[0] + l[1]
		max1 = l[n - 1] + l[n - 2]
		trim = 0
		for i in range(max1, min1 - 1, -1):
			dummy = d.copy()
			pairs = 0
			for j in range(n):
				if i - l[j] in dummy and l[j] in dummy:
					if i - l[j] == l[j] and dummy[l[j]] >= 2 or i - l[j] != l[j]:
						pairs += 1
						dummy[l[j]] = dummy[l[j]] - 1
						dummy[i - l[j]] = dummy[i - l[j]] - 1
						if dummy[l[j]] == 0:
							del dummy[l[j]]
						if i - l[j] in dummy and dummy[i - l[j]] == 0:
							del dummy[i - l[j]]
			trim = max(trim, pairs)
		print(trim)


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
from math import gcd, ceil

def pre(s):
	n = len(s)
	pi = [0] * n
	for i in range(1, n):
		j = pi[i - 1]
		while j and s[i] != s[j]:
			j = pi[j - 1]
		if s[i] == s[j]:
			j += 1
		pi[i] = j
	return pi

def prod(a):
	ans = 1
	for each in a:
		ans = ans * each
	return ans

def lcm(a, b):
	return a * b // gcd(a, b)

def binary(x, length=16):
	y = bin(x)[2:]
	return y if len(y) >= length else '0' * (length - len(y)) + y
for _ in range(int(input()) if True else 1):
	n = int(input())
	a = list(map(int, input().split()))
	di = {}
	for each in a:
		di[each] = 1 if each not in di else di[each] + 1
	ans = 0
	for i in range(1, 101):
		anss = 0
		for each in di:
			if i - each in di:
				anss += min(di[each], di[i - each])
		anss = anss // 2
		ans = max(ans, anss)
	print(ans)


from sys import stdin, gettrace
from collections import Counter
if gettrace():
	inputi = input
else:

	def input():
		return next(stdin)[:-1]

	def inputi():
		return stdin.buffer.readline()

def solve():
	n = int(inputi())
	ww = [int(a) for a in inputi().split()]
	wc = list(sorted(Counter(ww).items()))
	bc = Counter()
	for (i, ci) in wc:
		for (j, cj) in wc:
			if i == j:
				bc[i + j] += ci - ci % 2
			else:
				bc[i + j] += min(ci, cj)
	print(bc.most_common(1)[0][1] // 2)

def main():
	t = int(inputi())
	for _ in range(t):
		solve()
main()


import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	n = int(input())
	a = [int(item) for item in input().split()]
	cnt = [0] * 101
	for item in a:
		cnt[item] += 1
	ans = 0
	for s in range(2, 101):
		tmp = cnt[:]
		ret = 0
		for item in a:
			if s - item > 0 and tmp[item] > 0 and (tmp[s - item] > 0):
				if s - item == item:
					if tmp[item] < 2:
						continue
					tmp[item] -= 2
					ret += 1
				else:
					tmp[item] -= 1
					tmp[s - item] -= 1
					ret += 1
		ans = max(ans, ret)
	print(ans)


import sys, os
if os.path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
input = lambda : sys.stdin.readline().strip()
li = lambda : list(map(int, input().split()))
I = lambda : int(input())
for _ in range(I()):
	n = I()
	a = li()
	if n < 2:
		print(0)
		continue
	a.sort()
	high = a[-1] + a[-2]
	l = 0
	r = n - 1
	ans = 1
	for total in range(2, high + 1):
		count = 0
		l = 0
		r = n - 1
		while l < r:
			if a[l] + a[r] < total:
				l += 1
			elif a[l] + a[r] > total:
				r -= 1
			else:
				count += 1
				l += 1
				r -= 1
		ans = max(ans, count)
	print(ans)


import math

def main():
	t = int(input())
	while t > 0:
		t = t - 1
		n = int(input())
		a = list(map(int, input().strip().split()))
		a.sort()
		maxsum = a[n - 1] + a[n - 2]
		dict1 = {}
		for i in range(maxsum + 1):
			dict1[i] = 0
		for i in range(n):
			dict1[a[i]] += 1
		list1 = [0 for i in range(maxsum + 1)]
		k = maxsum
		for i in range(2, k + 1):
			for j in range(1, i // 2 + 1):
				if j == i - j:
					list1[i] = list1[i] + dict1[j] // 2
				else:
					list1[i] = list1[i] + min(dict1[j], dict1[abs(i - j)])
		print(max(list1))
main()


import math
from decimal import Decimal
import heapq
import copy
import heapq
from collections import deque
from collections import defaultdict

def na():
	n = int(input())
	b = [int(x) for x in input().split()]
	return (n, b)

def nab():
	n = int(input())
	b = [int(x) for x in input().split()]
	c = [int(x) for x in input().split()]
	return (n, b, c)

def dv():
	(n, m) = map(int, input().split())
	return (n, m)

def da():
	(n, m) = map(int, input().split())
	a = list(map(int, input().split()))
	return (n, m, a)

def dva():
	(n, m) = map(int, input().split())
	a = [int(x) for x in input().split()]
	b = [int(x) for x in input().split()]
	return (n, m, b)

def eratosthenes(n):
	sieve = list(range(n + 1))
	for i in sieve:
		if i > 1:
			for j in range(i + i, len(sieve), i):
				sieve[j] = 0
	return sorted(set(sieve))

def lol(lst, k):
	k = k % len(lst)
	ret = [0] * len(lst)
	for i in range(len(lst)):
		if i + k < len(lst) and i + k >= 0:
			ret[i] = lst[i + k]
		if i + k >= len(lst):
			ret[i] = lst[i + k - len(lst)]
		if i + k < 0:
			ret[i] = lst[i + k + len(lst)]
	return ret

def nm():
	n = int(input())
	b = [int(x) for x in input().split()]
	m = int(input())
	c = [int(x) for x in input().split()]
	return (n, b, m, c)

def dvs():
	n = int(input())
	m = int(input())
	return (n, m)

def fact(n):
	tc = []
	ans = {}
	d = 2
	while d * d <= n:
		if n % d == 0:
			tc.append(d)
			n //= d
		else:
			d += 1
	if n > 1:
		tc.append(n)
	for i in tc:
		ans[i] = ans.get(i, 0) + 1
	return ans

def to_zero(n, s):
	lst = s[0]
	ans = []
	for i in range(n):
		if lst == s[i]:
			continue
		elif lst == '0':
			lst = '1'
			ans.append(i)
		else:
			lst = '0'
			ans.append(i)
	if lst == '1':
		ans.append(n)
	return ans
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a = sorted(a)
	d = {}
	for i in a:
		d[i] = d.get(i, 0) + 1
	mx = 0
	c = sorted(set(a))
	d1 = defaultdict(int)
	n = len(c)
	for i in range(n):
		tc = 0
		for j in range(i, n):
			k = c[i] + c[j]
			if i != j:
				d1[k] += min(d[c[i]], d[c[j]])
			else:
				d1[k] += d[c[i]] // 2
	for i in d1:
		mx = max(mx, d1[i])
	print(mx)


n = int(input())
for i in range(0, n):
	o = int(input())
	maxi = -10000000000
	p = input().rstrip().split(' ')
	L = [0] * 100
	for j in range(0, len(p)):
		L[int(p[j])] += 1
	for j in range(1, 101):
		C = list(L)
		ans = 0
		for k in range(0, len(p)):
			A = int(p[k])
			if A > j or C[A] == 0:
				continue
			else:
				C[A] -= 1
				B = j - A
				if C[B] > 0:
					ans += 1
					C[B] -= 1
		if ans > maxi:
			maxi = ans
			V = j
	print(maxi)


t = int(input())
for _ in range(t):
	n = int(input())
	freq = [0] * (2 * n + 1)
	arr = list(map(int, input().split()))
	for i in range(n):
		freq[arr[i]] += 1
	ans = 0
	for weight in range(2, 2 * n + 1):
		pairs = 0
		for ele in range(1, weight // 2 + 1):
			if 2 * ele == weight:
				pairs += freq[ele] // 2
			else:
				pairs += min(freq[ele], freq[weight - ele])
		ans = max(pairs, ans)
	print(ans)


import io, os
R = lambda : map(int, input().split())
for _ in range(int(input())):
	n = int(input())
	a = list(R())
	a.sort()
	ans = 0
	for i in range(1, a[-1] + a[-1] + 1):
		cnt = 0
		(l, r) = (0, n - 1)
		while r > l:
			if a[l] + a[r] == i:
				cnt += 1
				l += 1
				r -= 1
			elif a[l] + a[r] < i:
				l += 1
			else:
				r -= 1
		ans = max(ans, cnt)
	print(ans)


t = int(input())
for i in range(0, t):
	n = int(input())
	L = list(map(int, input().split()))
	L.sort()
	dic = {}
	for i in range(0, n):
		for j in range(i + 1, n):
			if L[i] + L[j] in dic.keys():
				dic[L[i] + L[j]] += 1
			else:
				dic[L[i] + L[j]] = 1
	M = []
	for e in dic.keys():
		M.append(e)
	j = 0
	ans = 0
	while j < len(M):
		p = 0
		q = n - 1
		s = M[j]
		t = 0
		while p < q and p < n:
			if L[p] + L[q] == s:
				p += 1
				q -= 1
				t += 1
			elif L[p] + L[q] < s:
				p += 1
			else:
				q -= 1
		ans = max(t, ans)
		j += 1
	print(ans)


def get_max_commands_count_with_weight(s_weight, weights):
	necessary_weights = list(map(s_weight.__sub__, weights))[::-1]
	success_counter = 0
	i_necessary_weight = 0
	for w in weights:
		while i_necessary_weight < len(necessary_weights) and necessary_weights[i_necessary_weight] < w:
			i_necessary_weight += 1
		if i_necessary_weight >= len(necessary_weights):
			break
		if necessary_weights[i_necessary_weight] == w:
			success_counter += 1
			i_necessary_weight += 1
	return success_counter // 2

def get_answer(weights):
	weights = sorted(weights)
	if len(weights) < 2:
		return 0
	possible_s = range(2 * len(weights) + 1)
	return max((get_max_commands_count_with_weight(s, weights) for s in possible_s))

def main():
	t = int(input())
	for i in range(t):
		n = int(input())
		weights = map(int, input().split())
		max_commands = get_answer(weights)
		print(max_commands)
main()


import copy
for t in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	freq = [0] * 51
	for i in a:
		freq[i] += 1
	a1 = list(set(a))
	ans = 0
	for w in range(2, 101):
		freq1 = copy.deepcopy(freq)
		curr = 0
		for i in a1:
			if w - i > 0 and w - i in a1:
				if i == w - i:
					curr += freq1[i] // 2
				else:
					x = min(freq1[i], freq1[w - i])
					curr += x
					freq1[i] -= x
					freq1[w - i] -= x
		ans = max(ans, curr)
	print(ans)


T = int(input())
for t in range(T):
	n = int(input())
	a = list(map(int, input().split()))
	d = {}
	for i in a:
		if i not in d:
			d[i] = 1
		else:
			d[i] += 1
	ans = 0
	for i in range(2, 2 * n + 1):
		cd = d.copy()
		tans = 0
		for j in a:
			cd[j] -= 1
			if cd[j] >= 0 and i - j in cd and (cd[i - j] > 0):
				cd[i - j] -= 1
				tans += 1
		ans = max(ans, tans)
	print(ans)


def count(lis, n, summ):
	c = 0
	i = 0
	j = n - 1
	while i < j:
		if summ == lis[i] + lis[j]:
			i += 1
			j -= 1
			c += 1
		elif summ < lis[i] + lis[j]:
			j -= 1
		else:
			i += 1
	return c
t = int(input())
h = 1
while h <= t:
	maxi = 0
	n = int(input())
	lis = list(map(int, input().split()))
	lis.sort()
	for i in range(2, 101):
		if n != 1:
			cost = count(lis, n, i)
			if cost > maxi:
				maxi = cost
		else:
			break
	print(maxi)
	h += 1


t = int(input())
for i in range(t):
	n = int(input())
	a = [int(i) for i in input().split()]
	a.sort()
	mx = 0
	for s in range(a[n - 2] + a[n - 1] + 1):
		ans = 0
		p1 = 0
		p2 = n - 1
		while p1 < p2:
			if a[p1] + a[p2] == s:
				p1 += 1
				p2 -= 1
				ans += 1
			elif a[p1] + a[p2] > s:
				p2 -= 1
			else:
				p1 += 1
		mx = max(mx, ans)
	print(mx)


from collections import *
for u in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	c = 0
	d = defaultdict(list)
	for i in range(n - 1):
		for j in range(i + 1, n):
			s = l[i] + l[j]
			if d[s] == []:
				d[s].append(i)
				d[s].append(j)
			elif i not in d[s] and j not in d[s]:
				d[s].append(i)
				d[s].append(j)
	m = 0
	for i in d:
		m = max(len(d[i]) // 2, m)
	print(m)


def sol(s):
	hash = {}
	for i in s:
		if i not in hash:
			hash[i] = 1
			continue
		hash[i] += 1
	ans = 0
	for i in range(2, 2 * len(s) + 1):
		total = 0
		for j in hash:
			if i - j in hash and hash[i - j] >= 1:
				total += min(hash[j], hash[i - j])
		total //= 2
		ans = max(ans, total)
	print(ans)
k = int(input())
for i in range(k):
	input()
	lis = list(map(int, input().split(' ')))
	sol(lis)


t = int(input())
for i in range(t):
	n = int(input())
	w = list(map(int, input().split()))
	ans = 0
	for i in range(2, 2 * n + 1):
		cnts = [0] * 101
		cur = 0
		for x in w:
			if i > x and cnts[i - x] != 0:
				cnts[i - x] -= 1
				cur += 1
			else:
				cnts[x] += 1
		ans = max(ans, cur)
	print(ans)


from sys import stdin, exit, setrecursionlimit
from collections import deque
input = stdin.readline
lmi = lambda : list(map(int, input().split()))
mi = lambda : map(int, input().split())
si = lambda : input().strip('\n')
ssi = lambda : input().strip('\n').split()
for _ in range(int(input())):
	n = int(input())
	arr = lmi()
	tmp = [0 for i in range(101)]
	for i in arr:
		tmp[i] += 1
	ans = 0
	for s in range(2, 101):
		tot = 0
		for i in range(1, s // 2 + 1):
			if s - i <= 0:
				break
			if s - i == i:
				tot += tmp[i] // 2
			else:
				tot += min(tmp[s - i], tmp[i])
		ans = max(tot, ans)
	print(ans)


from sys import stdin, stdout

def INPUT():
	return list((int(i) for i in stdin.readline().split()))

def inp():
	return stdin.readline()

def out(x):
	return stdout.write(x)
import math
for _ in range(int(input())):
	n = int(input())
	A = INPUT()
	ans = 0
	F = [0] * 101
	for i in range(n):
		F[A[i]] += 1
	S = [0] * 101
	for sm in range(2, 101):
		for i in range(1, sm // 2 + 1):
			j = sm - i
			if i != j:
				S[sm] += min(F[i], F[j])
			else:
				S[sm] += F[i] // 2
	print(max(S))


from collections import Counter
t = int(input())
for _ in range(t):
	n = int(input())
	w = list(map(int, input().split()))
	c = Counter(w)
	s = list(c.keys())
	ans = 0
	for x in range(2, 2 * n + 1):
		dp = set()
		tm = 0
		for d in c:
			if (d, x - d) in dp or (x - d, d) in dp:
				continue
			else:
				dp.add((d, x - d))
				dp.add((x - d, d))
				if x - d == d:
					tm += c[d] // 2
				else:
					tm += min(c[x - d], c[d])
		dp.clear()
		ans = max(ans, tm)
	print(ans)


from collections import *
t = int(input())
for _ in range(t):
	n = int(input())
	a = Counter(map(int, input().strip().split()))
	r = [0] * 101
	for x in a:
		for y in a:
			r[x + y] += min(a[x], a[y])
	print(max(r) // 2)


import bisect
from collections import Counter
for _ in range(int(input())):
	n = int(input())
	w = list(map(int, input().split()))
	maxx = -1
	for i in range(1, 2 * max(w) + 1):
		cnt = 0
		count = Counter(w)
		for j in w:
			if j >= i:
				continue
			else:
				diff = i - j
				if i == diff and count[diff] > 1:
					count[diff] -= 1
					cnt += 1
				elif count[diff]:
					count[diff] -= 1
					cnt += 1
		maxx = max(maxx, cnt)
	print(maxx // 2)


t = int(input())
while t != 0:
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	if n == 1:
		print(0)
		t -= 1
		continue
	s1 = a[-1] + a[-2]
	ans = 0
	while s1 > 0:
		m = [0] * n
		c = 0
		for i in range(n):
			for j in range(i + 1, n):
				if a[i] + a[j] == s1 and m[i] != 1 and (m[j] != 1):
					m[i] = 1
					m[j] = 1
					c += 1
					break
		ans = max(c, ans)
		s1 = s1 - 1
	print(ans)
	t -= 1


for _ in range(int(input())):
	n = int(input())
	w = list(map(int, input().split()))
	w.sort()
	ans = 0
	for Sum in range(2, 2 * n + 1):
		(i, j, curans) = (0, n - 1, 0)
		p = [0] * (n + 1)
		for x in w:
			p[x] += 1
		while i < j:
			if Sum - w[i] < 1 or Sum - w[i] > n or p[Sum - w[i]] == 0:
				p[w[i]] -= 1
				i += 1
				continue
			if w[i] + w[j] == Sum:
				curans += 1
				p[w[i]] -= 1
				i += 1
			p[w[j]] -= 1
			j -= 1
		ans = max(ans, curans)
	print(ans)


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	cnt = [0] * (100 + 1)
	ans = 0
	for i in range(n):
		cnt[a[i]] += 1
	for i in range(1, 101):
		ind = 0
		for j in range(1, i + 1):
			ind += min(cnt[i - j], cnt[j])
		ans = max(ans, ind)
	print(ans // 2)


n = int(input())
for t in range(n):
	num = int(input())
	weights = list(map(int, input().split()))
	weights.sort()
	ma = 0
	for w in range(0, 101):
		i = 0
		j = num - 1
		c = 0
		while i < j:
			if weights[i] + weights[j] == w:
				i += 1
				j -= 1
				c += 1
			elif weights[i] + weights[j] > w:
				j -= 1
			else:
				i += 1
		ma = max(ma, c)
	print(ma)


def solve():
	n = int(input())
	arr = [int(i) for i in input().split()]
	freq = {}
	for i in arr:
		freq[i] = freq.setdefault(i, 0) + 1
	ans = 0
	for sum in range(2, 2 * n + 1):
		cnt = 0
		for a in range(1, (sum + 1) // 2):
			cnt += min(freq.get(a, 0), freq.get(sum - a, 0))
		if sum % 2 == 0:
			cnt += freq.get(sum // 2, 0) // 2
		ans = max(ans, cnt)
	print(ans)
for _ in range(int(input())):
	solve()


from collections import Counter
for _ in range(int(input())):
	n = int(input())
	v = list(map(int, input().split()))
	m = Counter(v)
	l = []
	for i in m:
		l.append((i, m[i]))
	d = {}
	for i in m:
		if m[i] >= 2:
			d[i * 2] = m[i] // 2
	for i in range(len(l)):
		for j in range(i + 1, len(l)):
			if l[i][0] + l[j][0] in d:
				d[l[i][0] + l[j][0]] += min(l[i][1], l[j][1])
			else:
				d[l[i][0] + l[j][0]] = min(l[i][1], l[j][1])
	mx = 0
	for i in d:
		mx = max(mx, d[i])
	print(int(mx))


try:
	t = int(input())
	for i in range(t):
		n = int(input())
		a = list(map(int, input().split()))
		b = [[] for i in range(2 * n + 1)]
		counts = [0 for i in range(2 * n + 1)]
		for i in range(n):
			for j in range(i + 1, n):
				if i not in b[a[i] + a[j]] and j not in b[a[i] + a[j]]:
					b[a[i] + a[j]].append(i)
					b[a[i] + a[j]].append(j)
					counts[a[i] + a[j]] += 2
		print(max(counts) // 2)
except:
	pass


for _ in range(int(input())):
	n = int(input())
	ar = [0 for i in range(n + 1)]
	arr = list(map(int, input().split()))
	for i in arr:
		ar[i] += 1
	ans = 0
	for i in range(2, 2 * n + 1):
		p = 0
		for j in range(1, (i + 1) // 2):
			if i - j > n:
				continue
			else:
				p += min(ar[j], ar[i - j])
		if i % 2 == 0:
			p += ar[i // 2] // 2
		ans = max(ans, p)
	print(ans)


import itertools
t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	ans = [set() for j in range(101)]
	for f in range(n):
		for s in range(f + 1, n):
			if f == s:
				continue
			wa = a[f] + a[s]
			if f not in ans[wa] and s not in ans[wa]:
				ans[wa].add(f)
				ans[wa].add(s)
	k = 0
	for xxx in ans:
		k = max(k, len(xxx))
	print(k // 2)


t = int(input())
for cases in range(t):
	n = int(input())
	ls = list(map(int, input().split()))
	if n > 1:
		ls.sort()
		co = {}
		for i in ls:
			if i in co:
				co[i] += 1
			else:
				co[i] = 1
		smin = ls[0] + ls[1]
		smax = ls[-1] + ls[-2]
		ans = 0
		for s in range(smin, smax + 1):
			coa = dict(co)
			sans = 0
			for i in co.keys():
				if s - i in coa:
					if s - i == i:
						sans += coa[i] // 2
					else:
						sans += min(coa[i], coa[s - i])
					del coa[i]
			if sans > ans:
				ans = sans
		print(ans)
	else:
		print(0)


t = int(input())
for i in range(t):
	n = int(input())
	w = list(map(int, input().split()))
	d = {}
	for j in range(n):
		for k in range(j + 1, n):
			t = w[j] + w[k]
			if t in d:
				d[t].append([j, k])
			else:
				d[t] = [[j, k]]
	maxx = 0
	for j in d:
		temp = set()
		t = 0
		for a in d[j]:
			if a[0] not in temp and a[1] not in temp:
				temp.add(a[0])
				temp.add(a[1])
				t += 1
		if t > maxx:
			maxx = t
		t = 0
	print(maxx)


from sys import stdin, stdout
import math
cin = stdin.readline
cout = stdout.write
mp = lambda : list(map(int, cin().split()))

def chars():
	s = cin()
	return list(s[:len(s) - 1])

def pl(a):
	for val in a:
		cout(str(val) + ' ')
	cout('\n')
(t,) = mp()
for _ in range(t):
	(n,) = mp()
	a = mp()
	ans = 0
	for s in range(2, 101):
		temp = 0
		l = list(a)
		for i in range(n - 1):
			for j in range(i + 1, n):
				if l[i] + l[j] == s and l[i] + l[j] > 1:
					l[i] = -1000
					l[j] = -1000
					temp += 1
					break
		ans = max(temp, ans)
	cout(str(ans) + '\n')


import collections
from collections import defaultdict
for _ in range(int(input())):
	n = int(input())
	w = [int(x) for x in input().split()]
	d = defaultdict(lambda : 0)
	for x in w:
		d[x] += 1
	ans = 0
	for s in range(2, 2 * n + 1):
		count = 0
		for i in range(1, (s + 1) // 2):
			if s - i > n:
				continue
			count += min(d[i], d[s - i])
		if s % 2 == 0:
			count += d[s // 2] // 2
		ans = max(ans, count)
	print(ans)


from sys import stdin, stdout

def input():
	return stdin.readline().strip()

def solve():
	n = int(input())
	w = list(map(int, input().split()))
	freq = [0] * 51
	for i in w:
		freq[i] += 1
	count = 0
	ans = -float('inf')
	for i in range(2, 101):
		s = i
		count = 0
		for j in range(1, 51):
			if freq[j]:
				if 0 <= s - j <= 50:
					count += min(freq[j], freq[s - j])
		ans = max(count // 2, ans)
	print(ans)
for t in range(int(input())):
	solve()


t = int(input())
while t:
	n = int(input())
	w = list(map(int, input().split()))
	nums = {}
	for i in range(n):
		if w[i] not in nums:
			nums[w[i]] = 1
		else:
			nums[w[i]] += 1
	max_teams = 0
	for s in range(2, 101):
		teams = 0
		runner = 1
		while True:
			if runner > s - runner:
				break
			if runner in nums and s - runner in nums:
				if runner != s - runner:
					teams += min(nums[runner], nums[s - runner])
				else:
					teams += nums[runner] // 2
			runner += 1
		max_teams = max(max_teams, teams)
	print(max_teams)
	t -= 1


def checker(n, lst):
	cnt = [0] * (n + 1)
	for elem in lst:
		cnt[elem] += 1
	result = 0
	for s in range(2, 2 * n + 1):
		current = 0
		for i in range(1, (s + 1) // 2):
			if s - i > n:
				continue
			current += min(cnt[i], cnt[s - i])
		if s % 2 == 0:
			current += cnt[s // 2] // 2
		result = max(result, current)
	return result
for _ in range(int(input())):
	m = int(input())
	a = [int(j) for j in input().split()]
	print(checker(m, a))


t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	freq = {}
	freqi = {}
	for i in range(n - 1):
		for j in range(i + 1, n):
			add = arr[i] + arr[j]
			if add in freq and (i not in freqi[add] and j not in freqi[add]):
				freq[add] += 1
				freqi[add].append(i)
				freqi[add].append(j)
			elif add not in freq:
				freq[add] = 1
				freqi[add] = [i]
				freqi[add].append(j)
	ans = 0
	for i in freq:
		ans = max(ans, freq[i])
	print(ans)


def calcTeam(weight):
	start = 0
	tmpW = W[:]
	cnt = 0
	while start < len(tmpW):
		flag = True
		for i in range(start + 1, len(tmpW)):
			if tmpW[start] + tmpW[i] == weight:
				tmpW.pop(i)
				tmpW.pop(start)
				cnt += 1
				flag = False
				break
		if flag:
			start += 1
	return cnt
T = int(input())
for _ in range(T):
	N = int(input())
	W = list(map(int, input().split()))
	ans = 0
	wmax = max(W) * 2
	for i in range(2, wmax + 1):
		ans = max(ans, calcTeam(i))
	print(ans)


t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	wt = list(map(int, input().split()))
	d = {}
	c = {}
	for i in range(n):
		for j in range(i + 1, n):
			if wt[i] + wt[j] not in d:
				d[wt[i] + wt[j]] = [i, j]
				c[wt[i] + wt[j]] = 1
			else:
				ch = 0
				for k in range(len(d[wt[i] + wt[j]])):
					if i == d[wt[i] + wt[j]][k] or j == d[wt[i] + wt[j]][k]:
						ch = 1
						break
				if ch == 0:
					d[wt[i] + wt[j]].append(i)
					d[wt[i] + wt[j]].append(j)
					c[wt[i] + wt[j]] += 1
	m = 0
	for i in c:
		if c[i] > m:
			m = c[i]
	print(m)


def solve():
	n = int(input())
	ap = [0] * 101
	for x in input().split():
		ap[int(x)] += 1
	ANS = 0
	for i in range(1, 101):
		ans = 0
		for j in range(1, i):
			ans += min(ap[j], ap[i - j])
		ANS = max(ANS, ans)
	print(ANS >> 1)
sex = int(input())
for i in range(sex):
	solve()


from collections import defaultdict as dd, Counter as cc
t = int(input())

def pp():
	n = int(input())
	l = list(map(int, input().split()))
	res = dd(int)
	res[-1] = 0
	cnt = cc(l)
	for i in cnt:
		if cnt[i] > 1:
			res[i * 2] += cnt[i] // 2
	ll = list(set(l))
	for i in range(len(ll)):
		for j in range(i + 1, len(ll)):
			res[ll[i] + ll[j]] += min(cnt[ll[i]], cnt[ll[j]])
	return max(res.values())
while t:
	print(pp())
	t -= 1


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	mx = max(a)
	l = [0] * (mx + 1)
	for el in a:
		l[el] += 1
	ans = 0
	for i in range(mx * 2 + 1):
		f = 1
		tr = 0
		while f < i - f:
			if i - f <= mx:
				tr += min(l[f], l[i - f])
			f += 1
		if i % 2 == 0:
			tr += l[i // 2] // 2
		if tr > ans:
			ans = tr
	print(ans)


T = int(input())
for _ in range(T):
	n = int(input())
	w = list(map(int, input().split()))
	ans = 0
	for i in range(2, 101):
		c = 0
		fl = [0 for i in range(n)]
		for j in range(n):
			if not fl[j]:
				for k in range(n):
					if not fl[k]:
						if k != j:
							if w[k] + w[j] == i:
								c += 1
								fl[j] = True
								fl[k] = True
								break
			if not fl[j]:
				fl[j] = True
		ans = max(c, ans)
	print(ans)


from collections import defaultdict
for _ in range(int(input())):
	N = int(input())
	List = [int(x) for x in input().split()]
	Dict = defaultdict(int)
	for i in range(N):
		Dict[List[i]] += 1
	Ans = 0
	Till = max(List) * 2 + 1
	for i in range(2, Till):
		count = 0
		for j in range(1, int(i // 2) + 1):
			if i != j + j:
				count += min(Dict[j], Dict[i - j])
			if i == j + j:
				count += Dict[j] // 2
		Ans = max(Ans, count)
	print(Ans)


import sys

def main():
	res = ''
	input = sys.stdin.readline
	print = sys.stdout.write
	t = int(input())
	for _ in range(t):
		n = int(input())
		w = list(map(int, input().split()))
		kw = [0] * (2 * (n + 1))
		for i in w:
			kw[i] += 1
		sub_res = 0
		for s in range(2, (n + 1) * 2):
			cur_res = 0
			for i in range(1, s // 2 + 1):
				if 2 * i == s:
					cur_res += kw[i] // 2
				else:
					cur_res += min(kw[i], kw[s - i])
			if cur_res > sub_res:
				sub_res = cur_res
		res += str(sub_res) + '\n'
	print(res)
main()


from collections import Counter
for _ in range(int(input())):
	n = int(input())
	w = Counter(map(int, input().split()))
	r = [0] * 101
	for i in w:
		for j in w:
			r[i + j] += min(w[i], w[j])
	print(max(r) // 2)


for _ in range(int(input())):
	n = int(input())
	data = [int(x) for x in input().split()]
	data.sort()
	if n == 1:
		print(0)
		continue
	minimum = data[0] + data[1]
	maximum = data[-1] + data[-2]
	ans = []
	for q in range(minimum, maximum + 1):
		temp = []
		for w in data:
			if w < q:
				temp.append(w)
		t = 0
		while True:
			if len(temp) <= 1:
				break
			first = temp[0]
			flag = 0
			for w in range(1, len(temp)):
				if first + temp[w] == q:
					t += 1
					flag = 1
					temp.pop(w)
					temp.pop(0)
					break
			if flag:
				continue
			else:
				temp.pop(0)
		ans.append(t)
	print(max(ans))


t = int(input())
for _ in range(t):
	n = int(input())
	w = list(map(int, input().split()))
	w.sort()
	res = 0
	for S in range(2, 2 * n + 1):
		(lo, hi) = (0, n - 1)
		tmp = 0
		while lo < hi:
			if w[lo] + w[hi] == S:
				lo += 1
				hi -= 1
				tmp += 1
			elif w[lo] + w[hi] > S:
				hi -= 1
			else:
				lo += 1
		res = max(res, tmp)
	print(res)


import copy
for _ in range(int(input())):
	n = int(input())
	w = list(map(int, input().split()))
	dw = {}
	for i in range(0, 2 * n + 1):
		dw[i] = 0
	for i in range(n):
		dw[w[i]] += 1
	ans = 0
	for cw in range(2, 2 * n + 1):
		cnt = 0
		for i in range(1, (cw + 1) // 2):
			cnt += min(dw[i], dw[cw - i])
		if cw % 2 == 0:
			cnt += int(dw[cw / 2] / 2)
		ans = max(ans, cnt)
	print(ans)


for tst in range(int(input())):
	n = int(input())
	a = sorted([int(i) for i in input().split()])
	ans = 0
	ansi = -1
	for s in range(2, 101):
		res = 0
		(l, r) = (0, n - 1)
		while l < r:
			while l < r and a[l] + a[r] > s:
				r -= 1
			if l < r and a[l] + a[r] == s:
				res += 1
				r -= 1
			l += 1
		if res > ans:
			ans = res
			ansi = s
	print(ans)


def pairs(number):
	res = []
	for i in range(1, number // 2 + 1):
		res.append([i, number - i])
	return res
for t in range(int(input())):
	n = int(input())
	w = sorted(list(map(int, input().split())))
	max_p = 0
	if max_p != n // 2:
		for i in range(w[0] + w[1], w[-2] + w[-1] + 1):
			cop = w[:]
			np = 0
			if max_p != n // 2:
				for j in pairs(i):
					while j[0] in cop and j[1] in cop:
						if j[0] != j[1]:
							cop.remove(j[0])
							cop.remove(j[1])
							np += 1
						else:
							cop.remove(j[0])
							if j[0] in cop:
								cop.remove(j[0])
								np += 1
			if np > max_p:
				max_p = np
	print(max_p)


def answer(n, A):
	A.sort()
	mini = min(A)
	maxi = max(A)
	max_count = 0
	for i in range(2 * mini, 2 * maxi + 1):
		d = {}
		for k in A:
			if k in d:
				d[k] += 1
			else:
				d[k] = 1
		count = 0
		for j in range(n):
			if d[A[j]] > 0:
				if A[j] < i:
					if i - A[j] in d:
						if i - A[j] == A[j]:
							if d[A[j]] > 1:
								count += 1
								d[A[j]] -= 2
						elif d[i - A[j]] > 0:
							count += 1
							d[A[j]] -= 1
							d[i - A[j]] -= 1
		max_count = max(max_count, count)
	return max_count
t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	print(answer(n, a))


t = int(input())
for j in range(t):
	n = int(input())
	a = sorted(list(map(int, input().split())))
	res = 0
	for i in range(2, 101):
		count = 0
		l = 0
		r = n - 1
		while l < r:
			if a[l] + a[r] == i:
				count += 1
				l += 1
				r -= 1
			elif a[l] + a[r] < i:
				l += 1
			else:
				r -= 1
		res = max(res, count)
	print(res)


t = int(input())
for _ in range(t):
	n = int(input())
	A = sorted(list(map(int, input().split())))
	counts = [0] * (n + n + 1)
	for a in A:
		counts[a] += 1
	res = 0
	for i in range(2, 2 * n + 1):
		temp = 0
		for j in range(1, i // 2 + 1):
			temp += min(counts[j], counts[i - j]) if i - j != j else counts[j] // 2
			if i - j < j:
				break
		res = max(res, temp)
	print(res)


def count(a, n, k):
	i = 0
	j = n - 1
	f = 0
	while i < j:
		x = a[i] + a[j]
		if x > k:
			j -= 1
		elif x == k:
			i += 1
			j -= 1
			f += 1
		elif x < k:
			i += 1
	return f
for _ in range(int(input())):
	n = int(input())
	c = [0] * 105
	f = 0
	a = list(map(int, input().split()))
	a.sort()
	for i in range(1, 102):
		c[i] = count(a, n, i)
	print(max(c))


test = int(input())
for t in range(0, test):
	n = int(input())
	w = [int(i) for i in input().split(' ')]
	wc = []
	for i in range(0, 2 * n + 1):
		wc.append(0)
	for e in w:
		wc[e] += 1
	w.sort()
	p = 0
	a = 0
	for wt in range(2, 2 * n + 1):
		b = []
		bc = []
		p = 0
		for e in w:
			b.append(wt - e)
		b.sort()
		for i in range(0, 2 * n + 1):
			bc.append(0)
		for e in b:
			bc[e] += 1
		c = list(dict.fromkeys(b))
		for e in c:
			if e > 0:
				p += min(bc[e], wc[e])
		a = max(a, p)
	print(int(a / 2))


from sys import stdin
input = stdin.buffer.readline
for _ in range(int(input())):
	n = int(input())
	(*w,) = map(int, input().split())
	r = 0
	for i in range(1, n << 1 | 1):
		cnt = [0] * (n << 1 | 1)
		k = 0
		for j in w:
			if j >= i:
				continue
			if cnt[i - j]:
				k += 1
				cnt[i - j] -= 1
			else:
				cnt[j] += 1
		r = max(r, k)
	print(r)


from collections import defaultdict, deque

def main():
	t = int(input())
	for c in range(t):
		n = int(input())
		ar = list(sorted(map(int, input().split(' '))))
		ans = 0
		mx = 0
		for k in range(101):
			cnt = [0] * 105
			koita = 0
			for x in ar:
				cnt[x] += 1
			for x in ar:
				cnt[x] -= 1
				if x <= k and cnt[k - x] > 0:
					cnt[k - x] -= 1
					koita += 1
			if mx < koita:
				mx = koita
				ans = k
		print(mx)
main()


from collections import defaultdict, Counter
from math import ceil
alph = 'abcdefghijklmnopqrstuvwxyz'
t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	pairs = defaultdict(int)
	count = Counter(a)
	for (k1, v1) in count.items():
		for (k2, v2) in count.items():
			if k2 < k1:
				continue
			if k1 == k2:
				pairs[k1 * 2] += v1 // 2
			else:
				pairs[k1 + k2] += min(v1, v2)
	print(max(pairs.values()))


import math
import sys
input = sys.stdin.readline

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

def inlst():
	return list(map(int, input().split()))

def instr():
	s = input()
	return list(s[:len(s) - 1])

def invar():
	return map(int, input().split())

def pbc(n, a):
	a.sort()
	maxn = 0
	for i in range(n):
		for j in range(i + 1, n):
			sumn = a[i] + a[j]
			res = 0
			start = 0
			end = n - 1
			while start < end:
				if a[start] + a[end] == sumn:
					res += 1
					start += 1
					end -= 1
				elif a[start] + a[end] < sumn:
					start += 1
				else:
					end -= 1
			maxn = max(maxn, res)
	return maxn
for _ in range(inp()):
	n = inp()
	a = inlst()
	print(pbc(n, a))


t = int(input())
for i in range(t):
	n = int(input())
	a = [0] * 51
	w = [int(item) for item in input().split()]
	for i in w:
		a[i] += 1
	ans = 0
	for s in range(2, 101):
		cur = 0
		for i in range(1, (s + 1) // 2):
			if s - i > n:
				continue
			cur += min(a[i], a[s - i])
		if s % 2 == 0:
			cur += a[s // 2] // 2
		ans = max(ans, cur)
	print(ans)


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split(' ')))
	count = [0] * (2 * (n + 1))
	res = 0
	for i in arr:
		count[i] += 1
	for s in range(2, 2 * n + 1):
		temp = 0
		for j in range(1, (s + 1) // 2):
			temp += min(count[j], count[s - j])
		if s % 2 == 0:
			temp += count[s // 2] // 2
		res = max(temp, res)
	print(res)


from collections import Counter
for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	d = Counter(l)
	ans = 0
	for i in range(2, 101):
		temp = 0
		for j in range(1, n + 1):
			if j > i - j:
				break
			if j == i - j:
				temp += d[j] // 2
			else:
				temp += min(d[j], d[i - j])
		ans = max(temp, ans)
	print(ans)


t = int(input())
for _ in range(t):
	n = int(input())
	ans = 0
	l = list(map(int, input().split()))
	for i in range(2, 101):
		c = 0
		vis = [0] * n
		for j in range(0, n):
			if vis[j] == 1:
				continue
			for k in range(0, n):
				if k == j:
					continue
				if vis[k] == 0 and vis[j] == 0:
					if l[j] + l[k] == i:
						c += 1
						vis[j] = 1
						vis[k] = 1
						break
			vis[j] = 1
		ans = max(ans, c)
	print(ans)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	b = [0] * (2 * n + 10)
	for i in a:
		b[i] += 1
	ans = 0
	for i in range(2, 2 * n + 1):
		now = 0
		for j in range(1, n + 1):
			if j < i - j:
				now += min(b[j], b[i - j])
			elif j == i - j:
				now += b[j] // 2
			else:
				break
		ans = max(ans, now)
	print(ans)


from collections import *
test_case = int(input())
while test_case:
	test_case -= 1
	k = input()
	how = defaultdict(int)
	mylist = list(map(int, input().split()))
	for x in mylist:
		how[x] += 1
	value = list(set(mylist))
	Sum = set()
	for i in range(len(value)):
		for j in range(i, len(value)):
			Sum.add(value[i] + value[j])
	maxi = 0
	for x in Sum:
		got = 0
		taken = defaultdict(int)
		for i in value:
			if taken[i] == 0 and x - i > 0:
				taken[i] = taken[x - i] = 1
				if i != x - i:
					got += min(how[i], how[x - i])
				else:
					got += how[i] // 2
		maxi = max(maxi, got)
	print(maxi)


def two_sum_pairs(a, x):
	n = len(a)
	h = {}
	for i in a:
		h[i] = h.get(i, 0) + 1
	c = 0
	for i in a:
		j = x - i
		if i > j:
			continue
		if j in h:
			if i == j:
				if h[i] < 2:
					continue
			h[i] -= 1
			h[j] -= 1
			if h[i] == 0:
				h.pop(i)
			if j in h and h[j] == 0:
				h.pop(j)
			c += 1
	return c
t = int(input())
for _ in range(t):
	n = int(input())
	a = [int(i) for i in input().split()]
	a.sort()
	k = 0
	for i in range(min(a) * 2, max(a) * 2 + 1):
		c = two_sum_pairs(a, i)
		k = max(k, c)
	print(k)


from collections import defaultdict
from itertools import combinations_with_replacement

def process():
	n = int(input())
	arr = list(map(int, input().split()))
	cntr = defaultdict(lambda : 0)
	for x in arr:
		cntr[x] += 1
	store = defaultdict(lambda : 0)
	sset = {tup[0] + tup[1] for tup in combinations_with_replacement(cntr.keys(), 2)}
	for s in sset:
		ways = 0
		newcntr = cntr.copy()
		for it in cntr.keys():
			if newcntr[it] > 0 and newcntr[s - it] > 0:
				m = 0
				if 2 * it != s:
					m = min(newcntr[it], newcntr[s - it])
					newcntr[it] -= m
					newcntr[s - it] -= m
					ways += m
				else:
					m = newcntr[it] // 2
					newcntr[it] -= 2 * m
					ways += m
		store[s] = max(ways, store[s])
	return max(store.items(), key=lambda k: k[1])[1]
for i in range(int(input())):
	print(process())


for _ in range(int(input())):
	n = int(input())
	arr = [int(i) for i in input().split()]
	arr.sort()
	if n == 1:
		print('0')
	elif n == 2 or n == 3:
		print('1')
	else:
		ans = -1
		for s in range(arr[0] + arr[1], arr[n - 2] + arr[n - 1] + 1):
			c = 0
			marked = [0] * n
			for i in range(n - 1):
				if marked[i] != 1:
					for j in range(i + 1, n):
						if arr[i] + arr[j] == s and marked[j] != 1:
							marked[i] = 1
							marked[j] = 1
							c += 1
							break
			if c > ans:
				ans = c
		print(ans)


for _ in range(int(input())):
	n = int(input())
	a = sorted(list(map(int, input().split())))
	cnt = [0] * (n + 1)
	for x in a:
		cnt[x] += 1
	ans = 0
	for s in range(2, 2 * n + 1):
		cur = 0
		for i in range(1, (s + 1) // 2):
			if s - i > n:
				continue
			cur += min(cnt[i], cnt[s - i])
		if s % 2 == 0:
			cur += cnt[s // 2] // 2
		if cur > ans:
			ans = cur
	print(ans)


from collections import Counter
t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	ans = 0
	c = Counter(l)
	for i in range(2, 101):
		count = 0
		for (j, k) in c.items():
			if i - j in c:
				count += min(k, c[i - j])
		ans = max(ans, count // 2)
	print(ans)


import sys
input = lambda : sys.stdin.readline().rstrip('\r\n')
from collections import Counter
for _ in range(int(input())):
	n = int(input())
	a = [int(x) for x in input().split()]
	if n == 1:
		print(0)
		continue
	a.sort()
	e = Counter(a)
	ans = 0
	for i in range(a[0] + a[1], a[-1] + a[-1] + 1):
		xx = 0
		d = dict(e)
		for x in list(d.keys()):
			if x in d:
				if i - x in d:
					if i - x == x:
						v = d[x] >> 1
						xx += v
						d[x] -= 2 * v
						if d[x] == 0:
							d.pop(x)
						continue
					if i - x in d:
						v = min(d[x], d[i - x])
						d[x] -= v
						d[i - x] -= v
						xx += v
						if d[x] == 0:
							d.pop(x)
						if d[i - x] == 0:
							d.pop(i - x)
		ans = max(ans, xx)
	print(ans)


from itertools import combinations
a = []
for _ in range(int(input())):
	input()
	a.append(list(map(int, input().split())))
for a in a:
	dict = {}
	for row in a:
		dict.setdefault(row, 0)
		dict[row] += 1
	res = {}
	for (i, j) in combinations(dict.keys(), 2):
		res.setdefault(i + j, 0)
		res[i + j] += min(dict[i], dict[j])
	for i in dict:
		res.setdefault(i * 2, 0)
		res[i * 2] += dict[i] // 2
	print(max(res.values()))


from collections import defaultdict
t = int(input())
for gg in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a = sorted(a)
	d = {}
	for i in a:
		d[i] = d.get(i, 0) + 1
	ans = 0
	c = sorted(set(a))
	d1 = defaultdict(int)
	n = len(c)
	for i in range(n):
		tc = 0
		for j in range(i, n):
			k = c[i] + c[j]
			if i != j:
				d1[k] += min(d[c[i]], d[c[j]])
			else:
				d1[k] += d[c[i]] // 2
	for i in d1:
		ans = max(ans, d1[i])
	print(ans)


t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	w = list(map(int, input().strip().split(' ')))

	def checkPoss(wg):
		done = [False] * n
		cnt = 0
		for i in range(len(w)):
			if not done[i]:
				done[i] = True
				for j in range(len(w)):
					if not done[j] and w[i] + w[j] == wg:
						cnt += 1
						done[j] = True
						break
		return cnt
	lp = min(w)
	up = 2 * max(w)
	ans = 1
	for i in range(lp, up + 10):
		ans = max(ans, checkPoss(i))
	if n == 1:
		print(0)
	else:
		print(ans)


def check(arrayList1):
	ans = 0
	for s in range(2, 101):
		j = 0
		k = n - 1
		cnt = 0
		while j < k:
			if arrayList1[j] + arrayList1[k] == s:
				j += 1
				k -= 1
				cnt += 1
			elif arrayList1[j] + arrayList1[k] < s:
				j += 1
			else:
				k -= 1
		if ans < cnt:
			ans = cnt
	print(ans)
t = int(input())
for i in range(0, t):
	n = int(input())
	lists1 = list((int(num) for num in input().strip().split()))[:n]
	lists1.sort()
	check(lists1)


import math
import sys
import bisect
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	d = {}
	for i in l:
		d[i] = d.get(i, 0) + 1
	(maxi, ans) = (0, 0)
	l = list(set(l))
	l.sort()
	for i in range(2, 101):
		dp = [0] * 51
		ans = 0
		for j in l:
			if i - j >= 0:
				if d.get(j, -1) != -1 and d.get(i - j, -1) != -1 and (dp[j] == 0) and (dp[i - j] == 0):
					if j == i - j:
						ans += d[j] // 2
					else:
						ans += min(d[j], d[i - j])
					dp[j] = 1
					dp[i - j] = 1
		maxi = max(ans, maxi)
	print(maxi)


t = int(input())
for _ in range(t):
	n = int(input())
	li = list(map(int, input().split()))
	res = 0
	li.sort()
	for s in range(2, 101):
		count = 0
		c = list(li)
		for i in range(0, len(c) - 1):
			if c[i] != -1:
				for j in range(i + 1, len(c)):
					if c[i] + c[j] == s and c[j] != -1:
						c[j] = -1
						count += 1
						break
		res = max(count, res)
	print(res)


from collections import defaultdict
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
t = int(input())
for i in range(t):
	n = int(input())
	b = list(map(int, input().split()))
	res = 0
	for s in range(2, 2 * n + 1):
		d = defaultdict(lambda : 0)
		for j in range(n):
			d[b[j]] += 1
		ans = 0
		for j in range(n):
			if d[b[j]] > 0:
				d[b[j]] -= 1
				q = s - b[j]
				if d[q] > 0:
					ans += 1
					d[q] -= 1
				else:
					d[b[j]] += 1
		res = max(res, ans)
	print(res)


def get_answer(a, n, min_a, max_a):
	if n == 1:
		return 0
	if n == 2:
		return 1
	result = []
	for m in range(2 * min_a, 2 * max_a + 1):
		b = []
		for i in range(n):
			b.append(m - a[i])
		b.sort()
		count = 0
		i = 0
		j = 0
		while i < n and j < n:
			if a[i] == b[j]:
				count += 1
				i += 1
				j += 1
			elif a[i] < b[j]:
				i += 1
			elif b[j] < a[i]:
				j += 1
		result.append(count // 2)
	return max(result)
t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	min_a = min(a)
	max_a = max(a)
	print(get_answer(a, n, min_a, max_a))


for _ in range(int(input())):
	n = int(input())
	ar = list(map(int, input().split()))
	cnt = {}
	for i in ar:
		if i in cnt:
			cnt[i] += 1
		else:
			cnt[i] = 1
	key = list(cnt.keys())
	dic = {}
	k = len(key)
	for i in range(k):
		for j in range(i + 1, k):
			var = key[i] + key[j]
			co = min(cnt[key[i]], cnt[key[j]])
			if var in dic:
				dic[var] += co
			else:
				dic[var] = co
	for i in key:
		var = 2 * i
		co = cnt[i] // 2
		if var in dic:
			dic[var] += co
		else:
			dic[var] = co
	val = list(dic.values())
	print(max(val))


from collections import defaultdict
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	mini = min(a)
	maxi = max(a)
	di = {}
	for i in a:
		if i in di:
			di[i] += 1
		else:
			di[i] = 1
	ans = 0
	res = 0
	for i in range(mini + 1, 2 * maxi + 1):
		d = di.copy()
		count = 0
		for j in range(n):
			if d[a[j]] == 0:
				continue
			if i - a[j] in d and d[i - a[j]] != 0:
				if i - a[j] == a[j] and d[i - a[j]] == 1:
					continue
				count += 1
				d[i - a[j]] -= 1
				d[a[j]] -= 1
		if count > ans:
			ans = count
			res = i
	print(ans)


from copy import deepcopy
from math import inf
t = int(input())
for T in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	count = 0
	for i in range(2, 2 * n + 1):
		temp = 0
		hashy = {}
		for j in range(n):
			if a[j] in hashy:
				hashy[a[j]] += 1
			else:
				hashy[a[j]] = 1
		for j in range(n):
			if hashy[a[j]] > 0:
				if i - a[j] in hashy and (hashy[i - a[j]] > 0 and a[j] != i - a[j] or (hashy[i - a[j]] > 1 and a[j] == i - a[j])):
					temp += 1
					hashy[a[j]] -= 1
					hashy[i - a[j]] -= 1
		count = max(count, temp)
	print(count)


import sys, os, io

def rs():
	return sys.stdin.readline().rstrip()

def ri():
	return int(sys.stdin.readline())

def ria():
	return list(map(int, sys.stdin.readline().split()))

def ws(s):
	sys.stdout.write(s + '\n')

def wi(n):
	sys.stdout.write(str(n) + '\n')

def wia(a):
	sys.stdout.write(' '.join([str(x) for x in a]) + '\n')
import math, datetime, functools, itertools, operator, bisect
from collections import deque, defaultdict, OrderedDict
import collections

def main():
	starttime = datetime.datetime.now()
	if os.path.exists('input.txt'):
		sys.stdin = open('input.txt', 'r')
		sys.stdout = open('output.txt', 'w')

	def numofpairs(b, s, p):
		c = 0
		for i in range(len(b)):
			t = 0
			if p[i] == 1:
				continue
			for j in range(i + 1, len(b)):
				if p[i] == 0 and p[j] == 0 and (b[i] + b[j] == s):
					p[i] = 1
					p[j] = 1
					t = 1
					c += 1
					break
		return c
	for _ in range(ri()):
		n = ri()
		a = ria()
		d = {}
		for i in range(n):
			for j in range(i + 1, n):
				k = a[i] + a[j]
				if k not in d:
					d[k] = 1
		a = sorted(a)
		m = 0
		for i in d:
			z = a.copy()
			p = [0] * n
			m = max(m, numofpairs(z, i, p))
		print(m)
	endtime = datetime.datetime.now()
	time = (endtime - starttime).total_seconds() * 1000
	if os.path.exists('input.txt'):
		print('Time:', time, 'ms')

class FastReader(io.IOBase):
	newlines = 0

	def __init__(self, fd, chunk_size=1024 * 8):
		self._fd = fd
		self._chunk_size = chunk_size
		self.buffer = io.BytesIO()

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, self._chunk_size))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self, size=-1):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, self._chunk_size if size == -1 else size))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

class FastWriter(io.IOBase):

	def __init__(self, fd):
		self._fd = fd
		self.buffer = io.BytesIO()
		self.write = self.buffer.write

	def flush(self):
		os.write(self._fd, self.buffer.getvalue())
		(self.buffer.truncate(0), self.buffer.seek(0))

class FastStdin(io.IOBase):

	def __init__(self, fd=0):
		self.buffer = FastReader(fd)
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

class FastStdout(io.IOBase):

	def __init__(self, fd=1):
		self.buffer = FastWriter(fd)
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.flush = self.buffer.flush
sys.stdin = FastStdin()
sys.stdout = FastStdout()
main()


def boat(arr):
	n = len(arr)
	ans = 0
	blanck = [0] * (n + 1)
	for i in arr:
		blanck[i] += 1
	for s in range(2, 2 * n + 1):
		curr = 0
		for i in range(1, (s + 1) // 2):
			if s - i > n:
				continue
			curr += min(blanck[i], blanck[s - i])
		if s % 2 == 0:
			curr += blanck[s // 2] // 2
		ans = max(ans, curr)
	return ans
t = int(input())
for _ in range(t):
	a = input()
	lst = list(map(int, input().strip().split()))
	print(boat(lst))


def int_array():
	return list(map(int, input().strip().split()))
for _ in range(int(input())):
	n = int(input())
	a = sorted(int_array())
	dick = {}
	for i in range(n - 1):
		for j in range(i + 1, n):
			dick[a[i] + a[j]] = dick.get(a[i] + a[j], 0) + 1
	cnt = {}
	for i in a:
		cnt[i] = cnt.get(i, 0) + 1
	ans = 0
	for s in dick:
		this = 0
		for i in cnt:
			this += min(cnt.get(i, 0), cnt.get(s - i, 0))
		ans = max(ans, this // 2)
	print(max(ans, 0))


def countPairsWithDiffK(arr, n, k):
	count = 0
	l = 0
	r = n - 1
	while r >= 0 and l < n and (l < r):
		if arr[r] + arr[l] == k:
			count += 1
			l += 1
			r -= 1
		elif arr[r] + arr[l] > k:
			r -= 1
		else:
			l += 1
		if l == r:
			break
	return count
for _ in range(int(input())):
	n = int(input())
	arr = [int(x) for x in input().split()]
	arr.sort()
	dp = [0] * 101
	for i in range(2, 101):
		dp[i] = countPairsWithDiffK(arr, n, i)
	print(max(dp))


testcases = int(input())
for testcase in range(testcases):
	n = int(input())
	temparr = input()
	temparr = temparr.split()
	arr = []
	for i in temparr:
		arr.append(int(i))
	arr = sorted(arr)
	maxelem = arr[-1]
	if len(arr) == 1:
		print(0)
		continue
	if len(arr) <= 3:
		print(1)
		continue
	dicts = {}
	for i in arr:
		if i not in dicts:
			dicts[i] = 1
		else:
			dicts[i] += 1
	availablenum = {}
	availnumber = []
	for (key, value) in dicts.items():
		if value >= 2:
			vvh = int(key + key)
			availablenum[vvh] = 1
		availnumber.append(key)
	nn = len(availnumber)
	for i in range(0, nn - 1):
		for j in range(i + 1, nn):
			newans = availnumber[i] + availnumber[j]
			availablenum[newans] = 1
	arr1 = []
	count = 0
	finalkey = 0
	for (key, value) in availablenum.items():
		curcount = 0
		skip = {}
		for i in range(0, n - 1):
			for j in range(i + 1, n):
				if i in skip:
					break
				if arr[i] + arr[j] == key and j not in skip:
					curcount += 1
					skip[j] = 1
					break
		if curcount > count:
			count = curcount
			finalkey = key
	print(count)


import math
import sys
import itertools
import random
import bisect
import heapq
import collections

def lcm(x, y):
	return x * y // math.gcd(x, y)

def hcf(x, y):
	return math.gcd(x, y)

def primes(n):
	prime = [True for _ in range(0, n + 1)]
	res = []
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[p] = False
		p += 1
	for i in range(0, n + 1):
		if prime[i] == True:
			res.append(i)
	return res

def primeFactors(n):
	res = []
	while n % 2 == 0:
		res.append(2)
		n //= 2
	for i in range(3, math.sqrt(n) + 1, 2):
		while n % i == 0:
			res.append(i)
			n //= i
	if n > 2:
		res.append(n)
	return res
for _ in range(0, int(input())):
	n = int(input())
	l = list(map(int, input().strip().split()))
	h = [0 for a in range(0, 51)]
	for i in l:
		h[i] += 1
	res = []
	for i in range(0, 51):
		if h[i] > 0:
			res.append([i, h[i]])
	r2 = []
	for i in range(0, len(res)):
		for j in range(i + 1, len(res)):
			r2.append([res[i][0] + res[j][0], 2 * min(res[i][1], res[j][1])])
	h1 = {}
	for i in r2:
		if i[0] in h1:
			h1[i[0]] += i[1]
		else:
			h1.update({i[0]: i[1]})
	for i in range(0, 51):
		if h[i] > 0:
			if i * 2 in h1:
				h1[i * 2] += h[i] // 2 * 2
			else:
				h1.update({i * 2: h[i] // 2 * 2})
	g = -1
	for i in h1.keys():
		g = max(g, h1[i] // 2)
	print(g)


t = int(input())
for test_case in range(t):
	n = int(input())
	l = [0] * (n + n + 1)
	a = [int(e) for e in input().split()]
	for i in a:
		l[i] += 1
	ans = 0
	for s in range(2 * n + 1):
		sum = 0
		for i in range(s // 2 + 1):
			if i != s - i:
				sum += min(l[i], l[s - i])
			else:
				sum += l[i] // 2
		ans = max(ans, sum)
	print(ans)


t = int(input())
res = ''
for q in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	ans = 0
	for s in range(2, 106):
		c = 0
		for x in range(n):
			start = x
			end = n - 1
			c1 = 0
			while start <= end and start != end:
				if a[start] + a[end] == s:
					start += 1
					end -= 1
					c1 += 1
				elif a[start] + a[end] < s:
					start += 1
				else:
					end -= 1
			c = max(c, c1)
		ans = max(ans, c)
	res += str(ans) + '\n'
print(res)


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().strip().split()))
	arr.sort()
	cnt = 0
	ans = 0
	k = 1
	while k < 101:
		i = 0
		j = n - 1
		while i < j:
			if arr[i] + arr[j] == k:
				cnt += 1
				i += 1
				j -= 1
			elif arr[i] + arr[j] < k:
				i += 1
			else:
				j -= 1
		if ans < cnt:
			ans = cnt
		cnt = 0
		k += 1
	print(ans)


t = int(input())
while t:
	t -= 1
	n = int(input())
	w = map(int, input().split())
	cnt = [0 for i in range(n + 1)]
	for i in w:
		cnt[i] += 1
	ans = 0
	for s in range(2, 2 * n + 1):
		tot = 0
		for i in range(1, n + 1):
			j = s - i
			if n < j or j < 1 or j > i:
				continue
			if i == j:
				tot += cnt[i] // 2
			else:
				tot += min(cnt[i], cnt[j])
		ans = max(ans, tot)
	print(ans)


from sys import stdin, stdout

def ii():
	return int(stdin.readline())

def mi():
	return map(int, stdin.readline().split())

def li():
	return list(mi())

def si():
	return stdin.readline()

def pair(l1, i):
	l = 0
	r = len(l1) - 1
	while l < r:
		if l1[l] + l1[r] == i:
			ans[i] += 1
			l += 1
			r -= 1
		elif l1[l] + l1[r] > i:
			r -= 1
		else:
			l += 1
for _ in range(ii()):
	n = ii()
	ans = [0] * (2 * n + 1)
	l1 = li()
	l1.sort()
	for i in range(2 * n + 1):
		pair(l1, i)
	print(max(ans))


t = int(input())
while t:
	t -= 1
	n = int(input())
	w = list(map(int, input().split()))
	l = [0] * n
	for i in w:
		l[i - 1] += 1
	m = 0
	for i in range(2, 2 * n + 1):
		gm = 0
		for j in range(max(1, i - n), i // 2 + 1):
			if j == i // 2 and i % 2 == 0:
				gm += l[j - 1] // 2
				continue
			gm += min(l[j - 1], l[i - j - 1])
		m = max(m, gm)
	print(m)


from sys import stdin, stdout
import math
from collections import Counter, deque
L = lambda : deque(list(map(int, stdin.readline().strip().split())))
M = lambda : map(int, stdin.readline().strip().split())
I = lambda : int(stdin.readline().strip())
IN = lambda : stdin.readline().strip()
C = lambda : stdin.readline().strip().split()
mod = 1000000007

def s(a):
	print(''.join(list(map(str, a))))

def solve():
	n = I()
	a = sorted(L())
	ans = 0
	for x in range(2, 2 * a[-1] + 1):
		i = 0
		j = n - 1
		c = 0
		while j > i:
			if a[i] + a[j] == x:
				c += 1
				i += 1
				j -= 1
			elif a[i] + a[j] > x:
				j -= 1
			else:
				i += 1
		ans = max(c, ans)
	print(ans)
for _ in range(I()):
	solve()


from sys import stdin
input = lambda : stdin.readline().strip()
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	k = 0
	if len(a) > 1:
		for s in range(a[0] + a[1], a[len(a) - 2] + a[len(a) - 1] + 1):
			c = 0
			b = list(a)
			while True:
				x = b[0]
				b.pop(0)
				if s - x in b:
					b.remove(s - x)
					c += 1
				if len(b) == 0:
					break
			k = max(k, c)
		print(k)
	else:
		print(0)


import sys
input = sys.stdin.readline
t = int(input())
for ti in range(t):
	n = int(input())
	count = [0] * 51
	arr = list(map(int, input().split()))
	for i in arr:
		count[i] += 1
	ans = 0
	for i in range(2, 101):
		cur = 0
		for j in range(1, (i + 1) // 2 + 1):
			if i - j < j or i - j > n:
				continue
			if i - j != j:
				tms = min(count[j], count[i - j])
			else:
				tms = count[j] // 2
			cur += tms
		ans = max(ans, cur)
	print(ans)


def numberOfTeams(arr, wSum):
	ctr = 0
	di = {}
	for i in arr:
		di[i] = di.get(i, 0) + 1
	for i in arr:
		a = i
		b = wSum - i
		if a == b and a not in di:
			continue
		if a == b and di[a] < 2:
			continue
		if a in di and b in di:
			ctr += 1
			if di[a] == 1:
				del di[a]
			else:
				di[a] = di[a] - 1
			if di[b] == 1:
				del di[b]
			else:
				di[b] = di[b] - 1
	return ctr
for _ in range(int(input())):
	n = int(input())
	arr = []
	liStr = input().split()
	for i in liStr:
		arr.append(int(i))
	if n == 1:
		print('0')
		continue
	arr.sort()
	maxSum = arr[n - 1] + arr[n - 2]
	minSum = arr[0] + arr[1]
	mAns = -1
	for wSum in range(minSum, maxSum + 1):
		a = numberOfTeams(arr, wSum)
		if a > mAns:
			mAns = a
	print(mAns)


import sys
input = sys.stdin.readline
from collections import *
for _ in range(int(input())):
	n = int(input())
	w = list(map(int, input().split()))
	cnt = Counter(w)
	ans = 0
	for s in range(2 * n + 1):
		cand = 0
		for k in cnt.keys():
			if k > s // 2:
				continue
			k2 = s - k
			if k == k2:
				cand += cnt[k] // 2
			else:
				cand += min(cnt[k], cnt[k2])
		ans = max(ans, cand)
	print(ans)


from collections import defaultdict as dc
from collections import Counter
for _ in range(int(input())):
	x = dc(int)
	n = int(input())
	l = list(map(int, input().split()))
	c = Counter(l)
	l = list(set(l))
	for i in range(len(l)):
		if c[l[i]] > 1:
			x[2 * l[i]] += c[l[i]] // 2
		for j in range(i + 1, len(l)):
			x[l[i] + l[j]] += min(c[l[i]], c[l[j]])
	m = 0
	for i in x.keys():
		m = max(m, x[i])
	print(m)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	k = 0
	if len(a) > 1:
		for s in range(a[0] + a[1], a[len(a) - 2] + a[len(a) - 1] + 1):
			c = 0
			b = list(a)
			while True:
				x = b[0]
				b.pop(0)
				y = s - x
				if y in b:
					b.remove(y)
					c += 1
				if len(b) == 0:
					break
			k = max(k, c)
		print(k)
	else:
		print(0)


import os
import sys
from io import BytesIO, IOBase

def main():
	pass
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()

def test():
	n = int(input())
	l = sorted(list(map(int, input().split())))

	def pair(l, s):
		(i, j) = (0, len(l) - 1)
		c = 0
		while i < j:
			if l[i] + l[j] == s:
				c += 1
				i += 1
				j -= 1
			elif l[i] + l[j] > s:
				j -= 1
			elif l[i] + l[j] < s:
				i += 1
		return c
	c = 0
	for s in range(2, 101):
		c = max(c, pair(l, s))
	return c
t = int(input())
for _ in range(t):
	print(test())


for _ in range(int(input())):
	am = int(input())
	arr = list(map(int, input().split()))
	m = 0
	for mass in range(am * 2 + 1):
		was = [False] * am
		t = 0
		for i in range(am):
			for g in range(am):
				if arr[i] + arr[g] == mass and i != g and (not was[i] and (not was[g])):
					t += 1
					was[i] = True
					was[g] = True
					break
		m = max(t, m)
	print(m)


def solve(n, arr):
	res = 0
	arr.sort()
	for target in range(2, 2 * n + 1):
		cnt = 0
		i = 0
		j = n - 1
		while i < j:
			if arr[i] + arr[j] == target:
				cnt += 1
				i += 1
				j -= 1
			elif arr[i] + arr[j] < target:
				i += 1
			else:
				j -= 1
		res = max(res, cnt)
	print(res)
	return
t = int(input())
for i in range(0, t):
	n = int(input())
	arr = list(map(int, input().split()))
	solve(n, arr)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	wa = {}
	for i in range(n):
		for j in range(i + 1, n):
			w = a[i] + a[j]
			if w not in wa.keys():
				wa[w] = [1, [i, j]]
			elif i not in wa[w][1] and j not in wa[w][1]:
				wa[w][0] += 1
				wa[w][1].append(i)
				wa[w][1].append(j)
	v = -1
	for i in wa.keys():
		v = max(wa[i][0], v)
	print(max(v, 0))


def solve(n, w):
	cnt = [0] * (n + 1)
	ans = 0
	for i in range(n):
		cnt[w[i]] += 1
	for s in range(2, 2 * n + 1):
		t = 0
		for i in range(1, (s + 1) // 2):
			j = s - i
			if j > n or j <= 0:
				continue
			t += min(cnt[i], cnt[j])
		if s % 2 == 0:
			t += cnt[s // 2] // 2
		ans = max(ans, t)
	return ans
t = int(input())
for dum in range(t):
	n = int(input())
	w = list(map(int, input().split()))
	res = solve(n, w)
	print(res)


for _ in range(int(input())):
	i_liczb = int(input())
	liczby = sorted([int(x) for x in input().split()])
	best = 0
	for x in range(liczby[0] * 2, liczby[-1] * 2 + 1):
		(sta, kon) = (0, i_liczb - 1)
		wynik = 0
		while sta < kon:
			while liczby[sta] + liczby[kon] != x and sta != kon:
				if liczby[sta] + liczby[kon] > x:
					kon -= 1
				else:
					sta += 1
			while liczby[sta] + liczby[kon] == x and sta < kon:
				wynik += 1
				sta += 1
				kon -= 1
		best = max(best, wynik)
	print(best)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	d = dict()
	for i in a:
		if i in d:
			d[i] += 1
		else:
			d[i] = 1
	ans = float('-inf')
	for s in range(2, 2 * n + 1):
		cur = 0
		for i in range(1, (s + 1) // 2):
			cur += min(d[i] if i in d else 0, d[s - i] if s - i in d else 0)
		if not s & 1:
			if s // 2 in d:
				cur += d[s // 2] // 2
		ans = max(ans, cur)
	print(ans)


t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	arr = []
	for i in range(2 * n, 1, -1):
		j = 0
		k = n - 1
		count = 0
		while j < k:
			if l[j] + l[k] == i:
				count += 1
				j += 1
				k -= 1
			elif l[j] + l[k] > i:
				k -= 1
			else:
				j += 1
		arr.append(count)
	print(max(arr))


from itertools import combinations

def teams(parts):
	counts = {}
	for i in parts:
		counts[i] = counts.get(i, 0) + 1
	sums = {}
	for (a, b) in combinations(counts.keys(), 2):
		sums[a + b] = sums.get(a + b, 0) + min(counts[a], counts[b])
	for i in counts:
		sums[i * 2] = sums.get(i * 2, 0) + counts[i] // 2
	return max(sums.values())
t = int(input())
for i in range(t):
	n = int(input())
	a = [int(j) for j in input().split()]
	print(teams(a))


t = int(input())
for _ in range(t):
	n = int(input())
	data = list(map(int, input().split()))
	ndata = []
	counts = []
	for i in data:
		if i not in ndata:
			ndata.append(i)
			counts.append(data.count(i))
	fdata = dict()
	for i in range(len(ndata)):
		for j in range(i, len(ndata)):
			if j == i:
				sum = 2 * ndata[j]
				c = counts[j] // 2
			else:
				sum = ndata[i] + ndata[j]
				c = min(counts[i], counts[j])
			if sum in fdata:
				fdata[sum] += c
			else:
				fdata[sum] = c
	max = 0
	for i in fdata:
		if fdata[i] > max:
			max = fdata[i]
	print(max)


from itertools import combinations
for _ in range(int(input())):
	n = int(input())
	arr = list((int(i) for i in input().split()))
	mp = dict()
	for i in arr:
		mp[i] = mp.get(i, 0) + 1
	key = list(mp.keys())
	mp1 = dict()
	for i in mp:
		mp1[2 * i] = mp[i] // 2
	for comb in combinations(key, 2):
		tmp = comb
		sm = tmp[0] + tmp[1]
		mp1[sm] = mp1.get(sm, 0) + min(mp[tmp[0]], mp[tmp[1]])
	value = list(mp1.values())
	print(max(value))


def fun(arr, n):
	count = [0 for i in range(n + 1)]
	for i in arr:
		count[i] += 1
	ans = 0
	for s in range(2, 2 * n + 1):
		cur = 0
		for i in range((s + 1) // 2):
			if s - i > n:
				continue
			cur += min(count[i], count[s - i])
		if s % 2 == 0:
			cur += count[s // 2] // 2
		ans = max(ans, cur)
	return ans
for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	print(fun(arr, n))


t = int(input())
for i in range(t):
	n = int(input())
	w = list(map(int, input().split()))
	a = [0 for i in range(n + 1)]
	b = [0 for i in range(2 * n + 1)]
	for v in w:
		a[v] += 1
	for j in range(n + 1):
		for k in range(j + 1):
			if j == k:
				b[j + k] += a[j] // 2
			else:
				b[j + k] += min(a[j], a[k])
	print(max(b))


def solve():
	n = int(input())
	l = [int(x) for x in input().split()]
	mx = 0
	for i in range(min(l) * 2, max(l) * 2 + 1):
		e = 0
		g = sorted(l)
		for j in range(n):
			for k in range(j + 1, n):
				if g[j] != 0 and g[k] != 0 and (g[j] + g[k] == i):
					e += 1
					(g[j], g[k]) = (0, 0)
		mx = max(e, mx)
	print(mx)
for _ in range(int(input())):
	solve()


for _ in range(int(input())):
	p = int(input())
	l = list(map(int, input().split()))
	l.sort()
	ma = 0
	for i in range(2, 101):
		j = 0
		k = p - 1
		c = 0
		while j < k:
			if l[j] + l[k] == i:
				j = j + 1
				k = k - 1
				c = c + 1
			elif l[j] + l[k] > i:
				k = k - 1
			else:
				j = j + 1
		ma = max(ma, c)
	print(ma)


def main():
	n = int(input())
	a = list(map(int, input().split()))
	mx = 0
	for i in range(2 * n + 1):
		visited = [0 for _ in range(n)]
		cnt = 0
		for k in range(n):
			if visited[k] == 1:
				continue
			for j in range(n):
				if visited[j] == 1:
					continue
				if k != j and a[k] + a[j] == i:
					visited[j] = 1
					visited[k] = 1
					cnt += 1
					break
		mx = max(cnt, mx)
	print(mx)
	return

def test():
	t = int(input())
	while t:
		main()
		t -= 1
	return
test()


t = int(input())
for _ in range(t):
	size = int(input())
	arr = [int(p) for p in input().split()]
	a = sorted(list(set(arr)))
	freq = {}
	(m, M) = (a[0], a[-1])
	for i in range(len(arr)):
		try:
			freq[arr[i]] += 1
		except KeyError:
			freq[arr[i]] = 1
	count = {}
	for i in range(2 * m, 2 * M + 1):
		count[i] = 0
	for i in range(2 * m, 2 * M + 1):
		for j in range(len(a)):
			try:
				if i == 2 * a[j]:
					count[i] += freq[a[j]] // 2
				elif i - a[j] > i // 2:
					count[i] += min(freq[a[j]], freq[i - a[j]])
			except KeyError:
				continue
	curr = 0
	for i in count:
		curr = max(curr, count[i])
	print(curr)


from __future__ import division, print_function
from fractions import Fraction
import sys
import os
from io import BytesIO, IOBase
from itertools import *
import bisect
from heapq import *
from math import *
from copy import *
from collections import deque
from collections import Counter as counter
from itertools import combinations as comb
from itertools import permutations as permutate
from bisect import bisect_left as bl
from bisect import bisect_right as br
from bisect import bisect
BUFSIZE = 8192
from sys import stderr

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
from types import GeneratorType

def iterative(f, stack=[]):

	def wrapped_func(*args, **kwargs):
		if stack:
			return f(*args, **kwargs)
		to = f(*args, **kwargs)
		while True:
			if type(to) is GeneratorType:
				stack.append(to)
				to = next(to)
				continue
			stack.pop()
			if not stack:
				break
			to = stack[-1].send(to)
		return to
	return wrapped_func
mod = 1000000007

def inp():
	return sys.stdin.readline().rstrip('\r\n')

def out(var):
	sys.stdout.write(str(var))

def lis():
	return list(map(int, inp().split()))

def stringlis():
	return list(map(str, inp().split()))

def sep():
	return map(int, inp().split())

def strsep():
	return map(str, inp().split())

def zerolist(n):
	return [0] * n

def nextline():
	out('\n')

def testcase(t):
	for p in range(t):
		solve()

def printlist(a):
	for p in range(0, len(a)):
		out(str(a[p]) + ' ')

def pow(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res
from functools import reduce

def factors(n):
	return set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0)))

def gcd(a, b):
	if a == b:
		return a
	while b > 0:
		(a, b) = (b, a % b)
	return a
from operator import add

def solve():
	n = int(inp())
	ar = lis()
	c = counter(ar)
	ans = []
	for i in range(100, 1, -1):
		temp = c.copy()
		t_ans = 0
		for j in range(1, 51):
			if j != i - j:
				k = min(temp[j], temp[i - j])
			else:
				k = temp[j] // 2
			temp[j] -= k
			temp[i - j] -= k
			t_ans += k
		ans.append(t_ans)
	print(max(ans))
testcase(int(inp()))


import sys, math
import io, os
from bisect import bisect_left as bl, bisect_right as br, insort
from heapq import heapify, heappush, heappop
from collections import defaultdict as dd, deque, Counter

def data():
	return sys.stdin.readline().strip()

def mdata():
	return list(map(int, data().split()))

def outl(var):
	sys.stdout.write(' '.join(map(str, var)) + '\n')

def out(var):
	sys.stdout.write(str(var) + '\n')
from decimal import Decimal
from fractions import Fraction
INF = float('inf')
mod = int(1000000000.0) + 7
for t in range(int(data())):
	n = int(data())
	w = sorted(mdata())
	ans = 0
	for i in range(2, 2 * max(w) + 1):
		cnt = 0
		(s, e) = (0, n - 1)
		while s < e:
			if w[s] + w[e] == i:
				cnt += 1
				s += 1
				e -= 1
			elif w[s] + w[e] < i:
				s += 1
			else:
				e -= 1
		ans = max(ans, cnt)
	out(ans)


import sys
t = int(input())
for cases in range(t):
	n = int(sys.stdin.readline())
	a = list(map(int, sys.stdin.readline().strip().split()))
	b = dict()
	for i in range(len(a) - 1):
		for j in range(i + 1, len(a)):
			s = a[i] + a[j]
			if s not in b.keys():
				b[s] = set([i, j])
			elif i not in b[s] and j not in b[s]:
				b[s].add(i)
				b[s].add(j)
	m = 1
	for i in b:
		m = max(m, len(b[i]))
	sys.stdout.write(str(m // 2) + '\n')


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	mp = [0] * 101
	for i in a:
		mp[i] += 1
	ans = 0
	for i in range(1, 101):
		temp = 0
		for j in range(1, i + 1):
			temp += min(mp[j], mp[i - j])
		ans = max(ans, temp)
	print(ans // 2)


import collections

def solve():
	n = int(input())
	nums = list(map(lambda x: int(x), input().split()))
	weights = collections.defaultdict(set)
	maxTeam = 0
	for i in range(n - 1):
		for j in range(i + 1, n):
			weight = nums[i] + nums[j]
			contestants = weights[weight]
			if i not in contestants and j not in contestants:
				weights[weight].add(i)
				weights[weight].add(j)
				maxTeam = max(maxTeam, len(weights[weight]) // 2)
	return maxTeam
n = int(input())
for i in range(n):
	result = solve()
	print(result)


t = int(input())
for _ in range(t):
	n = int(input())
	ans = 0
	l = list(map(int, input().split()))
	g = [0] * 110
	for i in l:
		g[i] += 1
	for su in range(2, 2 * n + 1):
		res = 0
		for j in range(1, su // 2 + 1):
			if j == su - j:
				res += g[j] // 2
			else:
				res += min(g[j], g[su - j])
		if res > ans:
			ans = res
	print(ans)


t = int(input())
for _ in range(t):
	n = int(input())
	w = list(map(int, input().split()))
	ans = 0
	cnt = [0 for i in range(n + 1)]
	for i in range(n):
		cnt[w[i]] += 1
	for s in range(2, 2 * n + 1):
		a = 0
		for i in range(1, (s + 1) // 2):
			if s - i > n:
				continue
			a += min(cnt[i], cnt[s - i])
		if s % 2 == 0:
			a += cnt[s // 2] // 2
		ans = max(ans, a)
	print(ans)


for cases in range(int(input())):
	n = int(input())
	l1 = list(map(int, input().split()))
	max1 = 0
	l1.sort()
	for s in range(2, 2 * n + 1):
		l = 0
		r = n - 1
		res = 0
		while r > l:
			if l1[l] + l1[r] == s:
				res += 1
				r = r - 1
				l = l + 1
			if l1[l] + l1[r] < s:
				l += 1
			if l1[l] + l1[r] > s:
				r = r - 1
		max1 = max(max1, res)
	print(max1)


from __future__ import division, print_function
from fractions import Fraction
import sys
import os
from io import BytesIO, IOBase
from itertools import *
import bisect
from heapq import *
from math import *
from copy import *
from collections import deque
from collections import Counter as counter
from itertools import combinations as comb
from itertools import permutations as permutate
from bisect import bisect_left as bl
from bisect import bisect_right as br
from bisect import bisect
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
from types import GeneratorType

def iterative(f, stack=[]):

	def wrapped_func(*args, **kwargs):
		if stack:
			return f(*args, **kwargs)
		to = f(*args, **kwargs)
		while True:
			if type(to) is GeneratorType:
				stack.append(to)
				to = next(to)
				continue
			stack.pop()
			if not stack:
				break
			to = stack[-1].send(to)
		return to
	return wrapped_func
mod = 1000000007

def inp():
	return sys.stdin.readline().rstrip('\r\n')

def out(var):
	sys.stdout.write(str(var))

def lis():
	return list(map(int, inp().split()))

def stringlis():
	return list(map(str, inp().split()))

def sep():
	return map(int, inp().split())

def strsep():
	return map(str, inp().split())

def zerolist(n):
	return [0] * n

def nextline():
	out('\n')

def testcase(t):
	for p in range(t):
		solve()

def printlist(a):
	for p in range(0, len(a)):
		out(str(a[p]) + ' ')

def lcm(a, b):
	return a * b // gcd(a, b)

def power(a, b):
	ans = 1
	while b > 0:
		if b % 2 == 1:
			ans *= a
		a *= a
		b //= 2
	return ans

def ncr(n, r):
	return factorial(n) // (factorial(r) * factorial(max(n - r, 1)))

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def solve():
	n = int(inp())
	a = lis()
	ans = 0
	for s in range(2, 2 * max(a) + 1):
		curr = 0
		cnt = {}
		for i in range(n):
			if a[i] in cnt:
				cnt[a[i]] += 1
			else:
				cnt[a[i]] = 1
		for i in range(n):
			if cnt[a[i]] > 0:
				if s - a[i] in cnt:
					if s - a[i] == a[i]:
						if cnt[a[i]] > 1:
							curr += 1
							cnt[a[i]] -= 1
							cnt[s - a[i]] -= 1
					elif cnt[s - a[i]] > 0:
						curr += 1
						cnt[a[i]] -= 1
						cnt[s - a[i]] -= 1
		ans = max(ans, curr)
	print(ans)
testcase(int(inp()))


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))[:n]
	a.sort()
	res = 0
	if n == 1:
		print(0)
		continue
	for w in range(a[0] + a[1], a[-1] + a[-2] + 1):
		i = 0
		j = n - 1
		cnt = 0
		while i < j:
			if a[i] + a[j] == w:
				cnt += 1
				i += 1
				j -= 1
			elif a[i] + a[j] > w:
				j -= 1
			else:
				i += 1
		res = max(res, cnt)
	print(res)


import sys
from collections import Counter
import math
input = sys.stdin.readline
for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	c = Counter(arr)
	result = 0
	for i in range(2, 2 * n + 1):
		ans = 0
		for j in range(1, (i + 1) // 2):
			if i - j > n:
				continue
			ans += min(c[j], c[i - j])
		if i % 2 == 0:
			ans += c[i / 2] // 2
		result = max(ans, result)
	print(result)


for _ in range(int(input())):
	n = int(input())
	a = [0 for i in range(n + 1)]
	arr = [int(i) for i in input().split()]
	for i in range(n):
		a[arr[i]] += 1
	ans = -1
	for s in range(2, 2 * n + 1):
		cs = 0
		for i in range(1, (s + 1) // 2):
			if s - i > n:
				continue
			cs += min(a[i], a[s - i])
		if s % 2 == 0:
			cs += a[s // 2] // 2
		ans = max(ans, cs)
	print(ans)


import sys, os
from io import BytesIO, IOBase
import collections, itertools, bisect, heapq, math, string
from decimal import *
BUFSIZE = 8192
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def main():
	t = int(input())
	for i in range(t):
		n = int(input())
		w = list(map(int, input().split()))
		if n == 1:
			print(0)
			continue
		if n <= 3:
			print(1)
			continue
		s = set()
		for j in range(n):
			for k in range(j + 1, n):
				s.add(w[j] + w[k])
		dw = collections.Counter(w)
		key = set(dw.keys())
		ans = 0
		for x in s:
			temp = 0
			d = dw.copy()
			for y in key:
				if d[y] > 0:
					if x == 2 * y:
						temp += d[y] // 2
					elif x - y in key:
						temp += min(d[x - y], d[y])
					(d[x - y], d[y]) = (-1, -1)
			ans = max(temp, ans)
		print(ans)
main()


import os
import heapq
import sys
import math
import operator
from collections import defaultdict
from io import BytesIO, IOBase

def inpt():
	return [int(k) for k in input().split()]

def main():
	for _ in range(int(input())):
		n = int(input())
		ar = inpt()
		ans = 0
		for j in range(1, 101):
			d = defaultdict(int)
			for i in ar:
				d[i] += 1
			ct = 0
			for i in ar:
				if d[i] > 0:
					d[i] -= 1
					if j - i in d and d[j - i] > 0:
						ct += 1
						d[j - i] -= 1
					else:
						d[i] += 1
			ans = max(ans, ct)
		print(ans)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


bor = [0] * 51
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	ans = 0
	for ves in range(2, 2 * n + 1):
		for j in range(n + 1):
			bor[j] = 0
		temp = 0
		for x in a:
			if x >= ves:
				continue
			if ves - x <= n and bor[ves - x]:
				temp += 1
				bor[ves - x] -= 1
				bor[x] = max(0, bor[x] - 1)
			else:
				bor[x] += 1
		ans = max(ans, temp)
	print(ans)


from collections import defaultdict, Counter
for _ in range(int(input())):
	n = int(input())
	w = sorted([int(_) for _ in input().split()])
	cnt = Counter(w)
	res = defaultdict(int)
	for (w1, n1) in cnt.items():
		for (w2, n2) in cnt.items():
			if w1 != w2:
				res[w1 + w2] += min(n1, n2)
			else:
				res[w1 + w2] += n1
	print(max(res.values()) // 2)


t = int(input())
for T in range(t):
	n = int(input())
	w = [int(i) for i in input().split()]
	weight_count = [0 for i in range(2 * n + 1)]
	for weight in w:
		weight_count[weight] += 1
	maxTeams = 0
	for s in range(2 * n + 1):
		teams = sum([min(weight_count[i], weight_count[s - i]) for i in range(1, (s + s % 2) // 2)])
		if s % 2 == 0:
			teams += weight_count[s // 2] // 2
		maxTeams = max(maxTeams, teams)
	print(maxTeams)


from collections import Counter

def main():
	for _ in range(int(input())):
		n = int(input())
		a = list(map(int, input().split()))
		a.sort()
		ans = 0
		for s in range(2, 2 * n + 1):
			tmp = 0
			(i, j) = (0, n - 1)
			while i < j:
				if a[i] + a[j] == s:
					tmp += 1
					i += 1
					j -= 1
				elif a[i] + a[j] > s:
					j -= 1
				else:
					i += 1
			ans = max(ans, tmp)
		print(ans)
main()


from collections import Counter, defaultdict
from sys import stdin, stdout
input = stdin.readline
I = lambda : int(input())
M = lambda : map(int, input().split())
LI = lambda : list(map(int, input().split()))
for _ in range(I()):
	n = I()
	a = LI()
	a.sort()
	ans = 0
	for i in range(2, 2 * n + 1):
		b = [] + a
		c = 0
		for j in range(n):
			if a[j] in b:
				b.remove(a[j])
			for k in range(len(b)):
				if a[j] + b[k] == i:
					c += 1
					b.pop(k)
					break
		ans = max(ans, c)
	print(ans)


import math, sys
from collections import defaultdict, Counter, deque
INF = float('inf')
MOD = 1000000007

def gcd(a, b):
	while b:
		(a, b) = (b, a % b)
	return a

def isPrime(n):
	if n <= 1:
		return False
	i = 2
	while i ** 2 <= n:
		if n % i == 0:
			return False
		i += 1
	return True

def primeFactors(n):
	factors = []
	i = 2
	while i ** 2 <= n:
		while n % i == 0:
			factors.append(i)
			n //= i
		i += 1
	if n > 1:
		factors.append(n)
	return factors

def vars():
	return map(int, input().split())

def array():
	return list(map(int, input().split()))

def main():
	n = int(input())
	arr = array()
	arr.sort()
	limit = 2 * max(arr)
	ans = 0
	for i in range(2, limit + 1):
		l = 0
		r = n - 1
		cnt = 0
		while l < r:
			s = arr[l] + arr[r]
			if s == i:
				cnt += 1
				l += 1
				r -= 1
			elif s < i:
				l += 1
			else:
				r -= 1
		ans = max(ans, cnt)
	print(ans)
t = int(input())
for _ in range(t):
	main()


import sys
input = sys.stdin.readline

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

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())

def chkteams(w, s, n):
	teams = 0
	i = 0
	j = n - 1
	while i < j:
		if w[i] + w[j] > s:
			j -= 1
		elif w[i] + w[j] < s:
			i += 1
		elif w[i] + w[j] == s:
			i += 1
			j -= 1
			teams += 1
	return teams
t = inp()
while t > 0:
	t -= 1
	n = inp()
	w = inlt()
	if n == 1:
		print(0)
		continue
	w.sort()
	l_sum = w[0] + w[1]
	u_sum = w[-1] + w[-2] + 1
	max_teams = 0
	for s in range(l_sum, u_sum):
		teams = chkteams(w, s, n)
		if max_teams < teams:
			max_teams = teams
	print(max_teams)


import os
from collections import defaultdict, deque, Counter
is_dev = 'vscode' in os.environ
if is_dev:
	inF = open('in.txt', 'r')
	outF = open('out.txt', 'w')

def ins(r):
	return list(map(int, r.split(' ')))

def input_():
	if is_dev:
		return inF.readline()[:-1]
	else:
		return input()

def print_(data):
	if is_dev:
		outF.write(str(data) + '\n')
	else:
		print(data)
for _ in range(int(input_())):
	n = int(input_())
	a = ins(input_())
	counter = Counter(a)
	sum_val = defaultdict(int)
	for i in counter:
		for j in counter:
			if i < j:
				sum_val[i + j] += min(counter[i], counter[j])
			elif i == j:
				sum_val[2 * i] += counter[i] // 2
	print_(max(sum_val.values()))
if is_dev:
	outF.close()

	def compare_file():
		print(open('out.txt', 'r').read() == open('outactual.txt', 'r').read())
	compare_file()


import math
T = int(input())
for i in range(T):
	n = int(input())
	a = list(map(int, input().split()))
	d = False
	A = set([])
	ans = 0
	for i in range(n):
		for j in range(n):
			if i != j:
				A.add(a[i] + a[j])
	for i in A:
		ans1 = 0
		used = [0] * n
		ad = [i - j for j in a]
		for j in range(n):
			if used[j]:
				continue
			used[j] = 1
			ad[j] = -1
			if a[j] in ad:
				adi = ad.index(a[j])
				if not used[adi]:
					ans1 += 1
					used[adi] = 1
					ad[adi] = -1
		ans = max(ans1, ans)
	print(ans)


for _ in range(int(input())):
	n = int(input())
	w = list(map(int, input().split()))
	cnt = [0] * (n + 1)
	for i in w:
		cnt[i] += 1
	res = 0
	for s in range(2, 2 * n + 1):
		cur = 0
		for i in range(1, (s + 1) // 2):
			if s - i > n:
				continue
			cur += min(cnt[i], cnt[s - i])
		if not s % 2:
			cur += cnt[s // 2] // 2
		res = max(res, cur)
	print(res)


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	ans = 0
	for x in range(1, 2 * n + 1):
		i = 0
		j = n - 1
		c = 0
		while i < j:
			if a[i] + a[j] == x:
				c += 1
				i += 1
				j -= 1
			elif a[i] + a[j] > x:
				j -= 1
			else:
				i += 1
		ans = max(ans, c)
	print(ans)


a = int(input())
for _ in range(a):
	x = int(input())
	li = list(map(int, input().split()))
	li1 = [0] * (x + 1)
	for i in li:
		li1[i] += 1
	ans = 0
	for i in range(2, 2 * x + 1):
		cur = 0
		for j in range(1, (i + 1) // 2):
			if i - j > x:
				continue
			cur += min(li1[j], li1[i - j])
		if i % 2 == 0:
			cur += li1[i // 2] // 2
		ans = max(ans, cur)
	print(ans)


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	ans = 0
	for j in range(2, 101):
		k = [0] * 101
		pair = 0
		for i in l:
			if j > i and k[j - i]:
				k[j - i] -= 1
				pair += 1
			else:
				k[i] += 1
		ans = max(ans, pair)
	print(ans)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	if n == 1:
		print(0)
		continue
	ans = 1
	a.sort()
	for s in range(2, 101):
		temp = 0
		i = 0
		j = n - 1
		while i < j:
			if a[i] >= s:
				break
			if s - a[i] < a[j]:
				j -= 1
			elif s - a[i] <= a[j]:
				temp += 1
				i += 1
				j -= 1
			else:
				i += 1
		ans = max(ans, temp)
	print(ans)


import sys
LI = lambda : list(map(int, sys.stdin.readline().strip('\n').split()))
MI = lambda : map(int, sys.stdin.readline().strip('\n').split())
SI = lambda : sys.stdin.readline().strip('\n')
II = lambda : int(sys.stdin.readline().strip('\n'))
for _ in range(II()):
	n = II()
	a = LI()
	opt = {i: set([]) for i in range(2 * n + 1)}
	for i in range(n):
		for j in range(n):
			if i != j and i not in opt[a[i] + a[j]] and (j not in opt[a[i] + a[j]]):
				opt[a[i] + a[j]].add(i)
				opt[a[i] + a[j]].add(j)
	print(len(max(opt.values(), key=len)) // 2)


from collections import Counter

def solve():
	n = int(input())
	A = list(map(int, input().split()))
	if n == 1:
		return 0
	A.sort()
	mi = A[0] + A[1]
	ma = A[-1] + A[-2]
	a = Counter(A)
	t = 0
	q = -1
	for i in range(mi, ma + 1):
		t = 0
		for j in a:
			if i - j in a:
				if j == i - j:
					t += a[j]
				else:
					t += min(a[i - j], a[j])
		q = max(q, t // 2)
	return q
t = int(input())
for l in range(t):
	print(solve())


import sys
t = int(input())
for i in range(0, t):
	n = int(input())
	arr = [int(item) for item in input().split(' ')]
	arr.sort()
	if n == 1:
		print(0)
	elif n == 2:
		print(1)
	else:
		mp = {}
		for item in arr:
			if mp.__contains__(item):
				mp[item] += 1
			else:
				mp[item] = 1
		maxi = 0
		for num in range(2, 2 * n + 1):
			temp = mp.copy()
			teams = 0
			for item in mp:
				if temp.__contains__(num - item) and num != 2 * item:
					teams += min(temp[item], temp[num - item])
					temp.pop(item)
					temp.pop(num - item)
				elif temp.__contains__(num - item) and num == 2 * item:
					teams += int(temp[item] / 2)
					temp.pop(item)
			maxi = max(maxi, teams)
		print(maxi)


from collections import defaultdict
t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	d = {}
	d = defaultdict(lambda : [], d)
	for i in range(n - 1):
		for j in range(i + 1, n):
			d[a[i] + a[j]].append((i, j))
	ans = 0
	for i in d.keys():
		arr = [0] * n
		cnt = 0
		for w in d[i]:
			if arr[w[0]] == 0 and arr[w[1]] == 0:
				cnt += 1
				arr[w[0]] = 1
				arr[w[1]] = 1
		ans = max(ans, cnt)
	print(ans)


import sys
import math
import bisect
from sys import stdin, stdout
from math import gcd, floor, sqrt, log2, ceil
from collections import defaultdict
from bisect import bisect_left as bl, bisect_right as br
from collections import Counter
from collections import deque
from heapq import heappush, heappop
ip = lambda : int(stdin.readline())
inp = lambda : map(int, stdin.readline().split())
ips = lambda : stdin.readline().rstrip()

def solve(arr, total):
	n = len(arr)
	ct = 0
	while True:
		flag = False
		for i in range(len(arr)):
			for j in range(i + 1, len(arr)):
				if arr[i] + arr[j] == total:
					flag = True
					ct += 1
					break
			if flag:
				break
		if flag == False:
			break
		else:
			del arr[j]
			del arr[i]
	return ct
t = ip()
for _ in range(t):
	n = ip()
	arr = list(inp())
	arr.sort()
	if len(arr) == 1:
		m = arr[0]
	else:
		m = arr[-1] + arr[-2]
	ans = -1
	for i in range(1, m + 1):
		ans = max(ans, solve(list(arr), i))
	print(ans)


def solve():
	t = int(input())
	for _ in range(t):
		n = int(input())
		w = list(map(int, input().split()))
		val = [0 for i in range(2 * n + 1)]
		d = {}
		for i in range(n + 1):
			d[i] = 0
		for i in w:
			d[i] += 1
		for i in range(2 * n + 1):
			for j in range(n + 1):
				if i - j == j:
					try:
						val[i] += d[j]
					except:
						pass
				else:
					try:
						val[i] += min(d[j], d[i - j])
					except:
						pass
		print(max(val) // 2)
solve()


t = int(input())
for i in range(t):
	n = int(input())
	arr = [int(item) for item in input().split()]
	if n == 1:
		print(0)
	if n == 2 or n == 3:
		print(1)
	if n > 3:
		arr.sort()
		sum1 = arr[0] + arr[1]
		sum2 = arr[-1] + arr[-2]
		count = 0
		for j in range(sum1, sum2 + 1):
			i = 0
			k = n - 1
			s = 0
			while i < k:
				if arr[i] + arr[k] == j:
					s = s + 1
					i = i + 1
					k = k - 1
				elif arr[i] + arr[k] < j:
					i = i + 1
				elif arr[i] + arr[k] > j:
					k = k - 1
			if s > count:
				count = s
		print(count)


def read():
	return [int(x) for x in input().split()]
(cas,) = read()
for _ in range(cas):
	(n,) = read()
	x = sorted(read())
	mx = 0
	for v in range(2, 2 * n + 1):
		_x = x.copy()
		ct = 0
		for i in range(n):
			a = x[i]
			b = v - a
			if a == b:
				if _x.count(a) >= 2:
					ct += 1
					_x.remove(a)
					_x.remove(b)
			elif a in _x and b in _x:
				ct += 1
				_x.remove(a)
				_x.remove(b)
		mx = max(mx, ct)
	print(mx)


def test_case():
	n = int(input())
	w = [int(x) for x in input().strip().split(' ')]
	w.sort()
	ans = 0
	for s in range(1, 101):
		i = 0
		j = n - 1
		count = 0
		while i < j:
			if w[i] + w[j] == s:
				i += 1
				j -= 1
				count += 1
			elif w[i] + w[j] < s:
				i += 1
			else:
				j -= 1
		if count > ans:
			ans = count
	print(ans)

def main():
	t = int(input())
	for x in range(t):
		test_case()
main()


import math
import datetime
import collections
import statistics
import itertools

def is_prime(num):
	for i in range(2, int(math.sqrt(num)) + 1):
		if num % i == 0:
			return False
	return True

def input_list():
	ll = list(map(int, input().split(' ')))
	return ll
tc = int(input())
for _ in range(tc):
	n = int(input())
	arr = input_list()
	mp = dict()
	if n == 1:
		print(0)
		continue
	for i in range(n):
		for j in range(i + 1, n):
			x = arr[i] + arr[j]
			if x in mp:
				if i not in mp[x][1] and j not in mp[x][1]:
					mp[x][0] += 1
					mp[x][1].append(i)
					mp[x][1].append(j)
			else:
				mp[x] = [1, [i, j]]
	ll = -1
	for (i, j) in mp.items():
		ll = max(ll, j[0])
	print(ll)


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	b = [0] * (n + 1)
	for i in a:
		b[i] += 1
	mx = -1
	for i in range(2, 2 * n + 1):
		rn = 0
		for j in range(1, i // 2 + 1):
			if i - j > 0 and i - j < n + 1:
				if j == i - j:
					rn += b[j] // 2
				else:
					rn += min(b[j], b[i - j])
		mx = max(rn, mx)
	print(mx)


from collections import Counter

def par(l):
	d = []
	dicto = Counter(l)
	lk = list(dicto.keys())
	if len(lk) > 1:
		for i in range(len(lk)):
			for j in range(i + 1, len(lk)):
				for s in range(min(dicto[lk[i]], dicto[lk[j]])):
					d.append(lk[i] + lk[j])
	for i in range(len(lk)):
		if dicto[lk[i]] > 1:
			for j in range(dicto[lk[i]] // 2):
				d.append(lk[i] + lk[i])
	if len(d) == 0:
		return '0'
	acto = Counter(d)
	return str(max(list(acto.values())))
t = input()
no = int(t)
s = ''
for i in range(no):
	r1 = input()
	r2 = input().split(' ')
	km = list(map(int, r2))
	s += par(km) + '\n'
print(s)


import sys
input = sys.stdin.readline

def sim(n, a, s):
	(i1, i2) = (0, n - 1)
	count = 0
	while 0 <= i1 < i2:
		pair = a[i1] + a[i2]
		if pair == s:
			count += 1
			i1 += 1
			i2 -= 1
		elif pair > s:
			i2 -= 1
		else:
			i1 += 1
	return count

def solve(n, a):
	a.sort()
	total_weights = set()
	for i in range(n):
		for j in range(i, n):
			total_weights.add(a[i] + a[j])
	best = 0
	for s in total_weights:
		best = max(best, sim(n, a, s))
	return best
t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	print(solve(n, a))


from sys import stdin
input = stdin.readline
from collections import defaultdict
t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	ans = 0
	for score in range(1, max(a) * 2 + 1):
		freq = defaultdict(int)
		for i in a:
			freq[i] += 1
		cur = 0
		for i in a:
			if i != score - i and freq[i] and freq[score - i]:
				freq[i] -= 1
				freq[score - i] -= 1
				cur += 1
			elif i == score - i and freq[i] >= 2:
				freq[i] -= 2
				cur += 1
		ans = max(ans, cur)
	print(ans)


t = int(input())
for _ in range(0, t):
	n = int(input())
	w = list(map(int, input().split()))
	if len(w) == 1:
		print(0)
		continue
	w.sort()
	amin = w[0] + w[1]
	amax = w[n - 1] + w[n - 2] + 1
	reln = 0
	for s in range(amin, amax):
		cache = [0] * 110
		relk = 0
		for j in range(0, n):
			for r in range(n - 1, j, -1):
				if not cache[r] and w[j] + w[r] == s:
					cache[r] = 1
					relk += 1
					break
		reln = max(reln, relk)
	print(reln)


for ii in range(int(input())):
	n = int(input())
	a = [int(x) for x in input().split()]
	ans = 0
	x = 0
	y = n - 1
	a.sort()
	for x in range(0, n):
		for y in range(x + 1, n):
			sum = a[x] + a[y]
			i = 0
			j = n - 1
			temp = 0
			while i < n and j < n and (i < j):
				if a[i] + a[j] == sum:
					temp += 1
					i += 1
					j -= 1
				elif a[i] + a[j] < sum:
					i += 1
				else:
					j -= 1
			if temp > ans:
				ans = temp
	print(ans)


for i in range(int(input())):
	n = int(input())
	w = list(map(int, input().split()))
	ans = 0
	w.sort()
	for z in range(2, 2 * n + 1):
		fre = 0
		i = 0
		j = n - 1
		while i < n and j > -1 and (i < j):
			if w[i] + w[j] == z:
				fre += 1
				i += 1
				j -= 1
			elif w[i] + w[j] < z:
				i += 1
			else:
				j -= 1
		if fre > ans:
			ans = fre
	print(ans)


from math import *
from sys import *
t = int(stdin.readline().strip())
for _ in range(t):
	n = int(stdin.readline().strip())
	a = list(map(int, stdin.readline().strip().split()))
	if n == 1:
		print(0)
		continue
	a.sort()
	s = set()
	for i in range(n - 1):
		for j in range(i + 1, n):
			s.add(a[i] + a[j])
	s = list(s)
	s.sort()
	ans = 0
	for i in range(len(s)):
		(l, r) = (0, n - 1)
		m = 0
		while l < r and r > 0:
			if a[l] + a[r] == s[i]:
				m = m + 1
				l = l + 1
				r = r - 1
			elif a[l] + a[r] > s[i]:
				r = r - 1
			elif a[l] + a[r] < s[i]:
				l = l + 1
		ans = max(ans, m)
	print(ans)


import sys
from collections import defaultdict
input = sys.stdin.readline
for _ in range(int(input())):
	n = int(input())
	lis = list(map(int, input().split()))
	lis.sort()
	m = 0
	for k in range(2, n * n + 1):
		i = 0
		j = n - 1
		c = 0
		while i < j:
			x = lis[i] + lis[j]
			if x == k:
				c += 1
				i += 1
				j -= 1
			elif x < k:
				i += 1
			else:
				j -= 1
			m = max(m, c)
	print(m)


T = int(input())
while T > 0:
	n = int(input())
	w = list(map(int, input().split()))
	w.sort()
	res = 0
	for i in range(n - 1):
		for j in range(n - 1, i, -1):
			total = w[i] + w[j]
			temp = 1
			(l, r) = (i + 1, j - 1)
			while l < r:
				x = w[l] + w[r]
				if x > total:
					r -= 1
				elif x < total:
					l += 1
				else:
					temp += 1
					l += 1
					r -= 1
			res = max(res, temp)
	print(res)
	T -= 1


from collections import *
from math import *
for _ in range(int(input())):
	n = int(input())
	w = list(map(int, input().split()))
	freq = defaultdict(int)
	for i in w:
		freq[i] += 1
	(lo, hi) = (2, n * 2)
	res = 0
	for tgt in range(lo, hi + 1):
		mp = freq.copy()
		cnt = 0
		for i in range(n):
			if w[i] == tgt - w[i] and mp[w[i]] >= 2:
				mp[w[i]] -= 2
				cnt += 1
			elif w[i] != tgt - w[i] and mp[w[i]] and mp[tgt - w[i]]:
				mp[w[i]] -= 1
				mp[tgt - w[i]] -= 1
				cnt += 1
		if cnt > res:
			res = cnt
	print(res)


TC = int(input())
for tc in range(TC):
	N = int(input())
	A = list(map(int, input().split()))
	cnt = {}
	mn = A[0]
	mx = A[0]
	for a in A:
		cnt[a] = cnt.setdefault(a, 0) + 1
		if a < mn:
			mn = a
		if a > mx:
			mx = a
	result = 0
	for i in range(mn * 2, mx * 2 + 1):
		r = 0
		for (k, v) in cnt.items():
			if i - k in cnt:
				r += min(v, cnt[i - k])
		if r > result:
			result = r
	print(result // 2)


for i in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	ans = 0
	a.sort()
	for num in range(2, 2 * n + 1):
		b = a[:]
		c = 0
		while len(b) > 1:
			x = b[0]
			if num - x in b[1:]:
				y = b.index(num - x, 1)
				c += 1
				del b[0]
				del b[y - 1]
			else:
				del b[0]
		ans = max(ans, c)
	print(ans)


def solve(w, left, right):
	target_s = w[left] + w[right]
	cnt = 0
	while left < right:
		cur_s = w[left] + w[right]
		if cur_s == target_s:
			cnt += 1
			left += 1
			right -= 1
		elif cur_s < target_s:
			left += 1
		else:
			right -= 1
	return cnt
for _ in range(int(input())):
	n = int(input())
	(*w,) = map(int, input().split())
	w.sort()
	ans = 0
	for left in range(n):
		for right in range(left + 1, n):
			ans = max(ans, solve(w, left, right))
	print(ans)


results = []
tests = int(input())
for _x in range(tests):
	n = int(input())
	a = list((int(item) for item in input().split()))[:n]
	a.sort()
	ans = 0
	for w in range(2, 106):
		s = 0
		for it in range(n):
			i = it
			j = n - 1
			cnt = 0
			while i <= j:
				if a[i] + a[j] == w and i != j:
					cnt += 1
					i += 1
					j -= 1
				elif a[i] + a[j] < w:
					i += 1
				else:
					j -= 1
			s = max(s, cnt)
		ans = max(s, ans)
	results.append(ans)
print(*results, sep='\n')


q = int(input())
for _ in range(q):
	k = int(input())
	dat = list(map(int, input().split()))
	dat.sort(reverse=True)
	finalres = 0
	for s in range(2, 2 * k + 1):
		res = 0
		used = [False] * k
		for i in range(k):
			if used[i]:
				continue
			used[i] = True
			target = s - dat[i]
			ismake = False
			for j in range(i + 1, k):
				if used[j]:
					continue
				if dat[j] == target:
					used[j] = True
					res += 1
					ismake = True
					break
		finalres = max(finalres, res)
	print(finalres)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	sol = 0
	for t in range(2, 101):
		(l, r) = (0, n - 1)
		cn = 0
		while l < r:
			c = a[l] + a[r]
			if c == t:
				cn += 1
				l += 1
				r -= 1
			elif c > t:
				r -= 1
			else:
				l += 1
		sol = max(sol, cn)
	print(sol)


import sys
import heapq
import math
from collections import deque
from collections import defaultdict
from collections import Counter
modH = int(10 ** 9) + 7
I = lambda : list(map(int, input().split(' ')))

def PRINT(lst, sep=' '):
	print(sep.join(map(str, lst)))

def nums(lst, s):
	st = set()
	cnt = 0
	for i in range(len(lst)):
		for j in range(i + 1, len(lst)):
			if lst[i] + lst[j] == s and i not in st and (j not in st):
				st.add(i)
				st.add(j)
				cnt += 1
	return cnt
for _ in range(int(input())):
	n = int(input())
	lst = I()
	mm = 0
	for s in range(2, 2 * n + 1):
		mm = max(mm, nums(lst, s))
	print(mm)


from functools import reduce
import os
import sys
from math import *
from collections import *
from fractions import *
from bisect import *
from heapq import *
from io import BytesIO, IOBase
input = lambda : sys.stdin.readline().rstrip('\r\n')

def value():
	return tuple(map(int, input().split()))

def arr():
	return [int(i) for i in input().split()]

def sarr():
	return [int(i) for i in input()]

def inn():
	return int(input())
t = inn()
while t:
	t -= 1
	n = inn()
	a = arr()
	d = defaultdict(list)
	for i in range(n):
		for j in range(i + 1, n):
			val = a[i] + a[j]
			if val not in d:
				d[val] += [i, j]
			elif i not in d[val] and j not in d[val]:
				d[val] += [i, j]
	mx = 0
	for i in d:
		res = len(d[i])
		mx = max(mx, res)
	print(mx // 2)


from itertools import combinations, starmap

def get_max_commands_count_with_weight(s_weight, weights):
	partner_weights = sorted(map(s_weight.__sub__, weights))
	success_counter = 0
	i_pw = 0
	for w in weights:
		while i_pw < len(partner_weights) and partner_weights[i_pw] < w:
			i_pw += 1
		if i_pw >= len(partner_weights):
			break
		if partner_weights[i_pw] == w:
			success_counter += 1
			i_pw += 1
	return success_counter // 2

def get_answer(weights):
	weights = sorted(weights)
	if len(weights) < 2:
		return 0
	possible_s = set(starmap(int.__add__, combinations(weights, 2)))
	return max((get_max_commands_count_with_weight(s, weights) for s in possible_s))

def main():
	t = int(input())
	for i in range(t):
		n = int(input())
		weights = map(int, input().split())
		max_commands = get_answer(weights)
		print(max_commands)
main()


for i in range(int(input())):
	n = int(input())
	main = [int(i) for i in input().split()]
	if n == 1:
		print(0)
		continue
	new_dict = {new_list: [] for new_list in range(1, 2 * max(main) + 1)}
	for i in range(n - 1):
		for j in range(i + 1, n):
			chk = main[i] + main[j]
			if i not in new_dict[chk] and j not in new_dict[chk]:
				new_dict[chk].append(i)
				new_dict[chk].append(j)
	maximum = -1
	ans = -1
	for i in new_dict:
		if len(new_dict[i]) >= maximum and len(new_dict[i]) != 0:
			maximum = len(new_dict[i])
			ans = len(new_dict[i]) // 2
	print(ans)


from sys import stdin, stdout
k = ''
for _ in ' ' * int(stdin.readline()):
	a = stdin.readline()
	ans = 0
	d = dict()
	for i in map(int, stdin.readline().split()):
		d[i] = d.get(i, 0) + 1
	s = 100
	while s > 1:
		i = 1
		t = 0
		o = s // 2
		while i <= o:
			if i == s - i:
				t += d.get(i, 0) // 2
			elif d.get(i, 0) and d.get(s - i, 0):
				t += min(d.get(i, 0), d.get(s - i, 0))
			i += 1
		ans = max(ans, t)
		s -= 1
	k += str(ans) + '\n'
stdout.write(k)


from sys import stdin, stdout
input = lambda : stdin.readline().strip()
for _ in range(int(input())):
	n = int(input())
	lst1 = list(map(int, input().split()))
	set2 = set()
	for i in range(0, n):
		for j in range(i + 1, n):
			set2.add(lst1[i] + lst1[j])
	max1 = 0
	for i in set2:
		lst2 = []
		nd = 0
		for j in lst1:
			lst2.append(j)
		j = 0
		while j < len(lst2):
			a = lst2[j]
			try:
				lst2.remove(a)
				lst2.remove(i - a)
			except:
				nd = nd - 1
			nd += 1
		max1 = max([max1, nd])
	print(max1)


def solve(a, n):
	i = 0
	j = len(a) - 1
	an = 0
	while i < j:
		k = a[i] + a[j]
		if k > n:
			j -= 1
		elif k == n:
			i += 1
			j -= 1
			an += 1
		elif k < n:
			i += 1
	return an
for i in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a = sorted(a)
	co = 0
	for i in range(1, 2 * n + 1):
		an = solve(a, i)
		if co < an:
			co = an
	print(co)


t = int(input())
for _ in range(t):
	n = int(input())
	w = list(map(int, input().split()))
	(range_start, range_end) = (2, 2 * n + 1)
	team_count = 0
	for team_weight in range(range_start, range_end):
		team_count_fortarget = 0
		team_dict = {}
		for weights in w:
			if team_dict.get(weights, 0) > 0:
				team_dict[weights] = team_dict[weights] - 1
				team_count_fortarget += 1
			else:
				team_dict[team_weight - weights] = max(team_dict.get(team_weight - weights, 0), 0) + 1
		team_count = max(team_count, team_count_fortarget)
	print(team_count)


def solve():
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	c = [0] * (n + 1)
	for i in a:
		c[i] += 1
	ans = 0
	for tw in range(1, 101):
		cans = 0
		b = [0] * (n + 1)
		for i in a:
			j = tw - i
			if j > n or j <= 0:
				continue
			if i != j and c[i] - b[i] >= 1 and (c[j] - b[j] >= 1) or (i == j and c[i] - b[i] >= 2):
				b[i] += 1
				b[j] += 1
				cans += 1
		ans = max(ans, cans)
	print(ans)
t = int(input())
for _ in range(t):
	solve()


linp = 'list(map(int,input().split()))'

def teams(l, s):
	freq = {}
	for i in l:
		try:
			freq[i] += 1
		except:
			freq[i] = 1
	ans = 0
	for i in freq:
		if s - i in freq:
			if i != s - i:
				f = min(freq[i], freq[s - i])
				ans += f
				freq[i] -= f
				freq[s - i] -= f
			else:
				f = freq[i] // 2
				ans += f
				freq[i] = 0
	return ans
for _ in range(int(input())):
	n = int(input())
	l = eval(linp)
	ans = 0
	for i in range(101):
		ans = max(ans, teams(l, i))
	print(ans)


t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	dv = {}
	di = {}
	for i in range(n - 1):
		for j in range(i + 1, n):
			S = l[i] + l[j]
			if S in dv and (i not in di[S] and j not in di[S]):
				dv[S] += 1
				di[S].append(i)
				di[S].append(j)
			elif S not in dv:
				dv[S] = 1
				di[S] = [i]
				di[S].append(j)
	sol = 0
	for i in dv:
		sol = max(sol, dv[i])
	print(sol)


import sys
import os
import math
import copy
from math import gcd
from bisect import bisect
from io import BytesIO, IOBase
from math import sqrt, floor, factorial, gcd, log, ceil
from collections import deque, Counter, defaultdict
from itertools import permutations, combinations
import itertools

def Int():
	return int(sys.stdin.readline())

def Mint():
	return map(int, sys.stdin.readline().split())

def Lstr():
	return list(sys.stdin.readline().strip())

def Str():
	return sys.stdin.readline().strip()

def Mstr():
	return map(str, sys.stdin.readline().strip().split())

def List():
	return list(map(int, sys.stdin.readline().split()))

def Hash():
	return dict()

def Mod():
	return 1000000007

def Ncr(n, r, p):
	return fact[n] * (ifact[r] * ifact[n - r] % p) % p

def Most_frequent(list):
	return max(set(list), key=list.count)

def Mat2x2(n):
	return [List() for _ in range(n)]

def Lcm(x, y):
	return x * y // gcd(x, y)

def dtob(n):
	return bin(n).replace('0b', '')

def btod(n):
	return int(n, 2)

def common(l1, l2):
	return set(l1).intersection(l2)

def solution():
	for _ in range(Int()):
		n = Int()
		a = List()
		a.sort()
		ans = -1
		for k in range(101):
			c = 0
			i = 0
			j = n - 1
			while i < j:
				if a[i] + a[j] == k:
					c += 1
					i += 1
					j -= 1
				elif a[i] + a[j] < k:
					i += 1
				else:
					j -= 1
			ans = max(ans, c)
		print(ans)
solution()


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def RL():
	return map(int, sys.stdin.readline().rstrip().split())

def RLL():
	return list(map(int, sys.stdin.readline().rstrip().split()))

def N():
	return int(input())

def comb(n, m):
	return factorial(n) / (factorial(m) * factorial(n - m)) if n >= m else 0

def perm(n, m):
	return factorial(n) // factorial(n - m) if n >= m else 0

def mdis(x1, y1, x2, y2):
	return abs(x1 - x2) + abs(y1 - y2)

def toord(c):
	return ord(c) - ord('a')

def lcm(a, b):
	return a * b // lcm(a, b)
mod = 998244353
INF = float('inf')
from math import factorial, sqrt, ceil, floor, gcd
from collections import Counter, defaultdict, deque
from heapq import heapify, heappop, heappush

def main():
	for _ in range(N()):
		n = N()
		arr = RLL()
		res = 0
		for i in range(2, 101):
			dic = defaultdict(int)
			now = 0
			for j in range(n):
				if dic[i - arr[j]] > 0:
					now += 1
					dic[i - arr[j]] -= 1
				else:
					dic[arr[j]] += 1
			res = max(res, now)
		print(res)
main()


for _ in range(int(input())):
	n = int(input())
	w = list(map(int, input().split()))
	f = [0] * (n + 1 + 1)
	for i in range(n):
		f[w[i]] += 1
	maxk = 0
	for s in range(1 + 1, 2 * n + 1):
		curk = 0
		for t in range(max(1, s - n), n + 1):
			if 0 <= s - t <= n:
				curk += min(f[t], f[s - t])
		maxk = max(maxk, curk)
	print(maxk // 2)


from collections import defaultdict

def solve():
	N = int(input())
	a = list(map(int, input().split()))
	w = defaultdict(int)
	for x in a:
		w[x] += 1
	keys = list(w.keys())
	keys.sort()
	res = 0
	max_value = 0
	for i in range(len(keys)):
		for j in range(i, len(keys)):
			V = keys[i] + keys[j]
			ans = 0
			for v in keys:
				if V - v in w.keys():
					if V != 2 * v:
						ans += min(w[V - v], w[v])
					else:
						ans += w[v] // 2 * 2
			ans = ans // 2
			if max_value < ans:
				max_value = ans
				res = V
	print(max_value)
	return

def main():
	T = int(input())
	for i in range(T):
		solve()
	return
main()


for _ in range(int(input())):
	n = int(input())
	temp = list(map(int, input().split()))
	l = [0] * (n + 1)
	for i in temp:
		l[i] += 1
	ans = 0
	for s in range(2, 2 * n + 1):
		cur = 0
		for i in range(1, (s + 1) // 2):
			if s - i <= n:
				cur += min(l[i], l[s - i])
		if s % 2 == 0:
			cur += l[s // 2] // 2
		ans = max(ans, cur)
	print(ans)


t = int(input())
for _ in range(t):
	n = int(input())
	ws = sorted(map(int, input().split()))
	ans = 0
	for s in range(2, 101):
		count = 0
		l = 0
		r = n - 1
		while r > l:
			if ws[l] + ws[r] == s:
				l += 1
				r -= 1
				count += 1
			elif ws[l] + ws[r] < s:
				l += 1
			else:
				r -= 1
		ans = max(ans, count)
	print(ans)


t = int(input())
for _ in range(t):
	n = int(input())
	w = list(map(int, input().split()))
	cnt = {}
	for weight in w:
		cnt[weight] = cnt.get(weight, 0) + 1
	ans = 0
	for sum_w in range(2, 101):
		tmp_ans = 0
		for w1 in cnt:
			w2 = sum_w - w1
			if w1 == w2:
				tmp_ans += cnt[w1] // 2 * 2
			elif w2 in cnt:
				tmp_ans += min(cnt[w1], cnt[w2])
		ans = max(ans, tmp_ans // 2)
	print(ans)


for _ in range(int(input())):
	n = int(input())
	a = [int(x) for x in input().split()]
	b = [0] * (n + 1)
	ss = []
	for i in a:
		b[i] += 1
	for i in range(2, 2 * n + 1):
		cnt = 0
		for j in range(1, i // 2 + 1):
			if j <= n and i - j <= n:
				if j * 2 == i:
					cnt += b[j] // 2
				else:
					cnt += min(b[j], b[i - j])
		ss.append(cnt)
	print(max(ss))


t = int(input())
for _ in range(t):
	n = int(input())
	warr = list(map(int, input().split()))
	d = {}
	for i in warr:
		if i not in d.keys():
			d[i] = 1
		else:
			d[i] += 1
	ans = 0
	for s in range(2, 2 * n + 1):
		curr = 0
		td = d.copy()
		for i in range(n):
			if td[warr[i]] > 0:
				if s - warr[i] in td.keys():
					if td[s - warr[i]] > 0:
						if s - warr[i] != warr[i]:
							td[warr[i]] -= 1
							td[s - warr[i]] -= 1
							curr += 1
						elif td[warr[i]] != 1:
							td[warr[i]] -= 1
							td[s - warr[i]] -= 1
							curr += 1
		ans = max(ans, curr)
	print(ans)


from collections import defaultdict

def solution(A, n):
	final = 0
	D = defaultdict(int)
	for a in A:
		D[a] += 1
	for best in range(2 * max(A) + 1):
		total = 0
		for i in range(1, best):
			total += min(D[i], D[best - i])
		final = max(final, total // 2)
	return final
t = int(input())
for _ in range(t):
	n = int(input())
	A = list(map(int, input().split(' ')))
	print(solution(A, n))


for _ in range(int(input())):
	n = int(input())
	arr = [int(i) for i in input().split()]
	ans = -1
	for value in range(0, 101):
		cnt = 0
		marked = [0] * n
		for i in range(0, n - 1):
			if marked[i] == 0:
				for j in range(i + 1, n):
					if marked[j] == 0:
						if arr[i] + arr[j] == value:
							cnt += 1
							marked[j] = 1
							marked[i] = 1
							break
		if cnt > ans:
			ans = cnt
	print(ans)


t = int(input())
for i1 in range(t):
	n = int(input())
	ans = [set() for i in range(110)]
	vec = list(map(int, input().split()))
	for i in range(n):
		for j in range(i + 1, n):
			w = vec[i] + vec[j]
			if i not in ans[w] and j not in ans[w]:
				ans[w].add(i)
				ans[w].add(j)
	print(max((len(i) for i in ans)) // 2)


import sys
import math
import collections
import operator as op
from collections import deque
from math import gcd, inf, sqrt, pi, cos, sin, ceil, log2
from bisect import bisect_right, bisect_left
from functools import reduce
from sys import stdin, stdout, setrecursionlimit
setrecursionlimit(2 ** 20)

def factorial(n):
	if n == 0:
		return 1
	return n * factorial(n - 1)

def ncr(n, r):
	r = min(r, n - r)
	numer = reduce(op.mul, range(n, n - r, -1), 1)
	denom = reduce(op.mul, range(1, r + 1), 1)
	return numer // denom

def prime_factors(n):
	i = 2
	factors = []
	while i * i <= n:
		if n % i:
			i += 1
		else:
			n //= i
			factors.append(i)
	if n > 1:
		factors.append(n)
	return list(factors)
MOD = 1000000007
PMOD = 998244353
T = 1
T = int(stdin.readline())
for _ in range(T):
	n = int(stdin.readline())
	a = list(map(int, stdin.readline().rstrip().split()))
	d = {}
	for i in range(1, n + 1):
		d[i] = 0
	for i in range(n):
		d[a[i]] += 1
	ans = 0
	for s in range(2, 2 * n + 1):
		cur = 0
		for i in range(1, (s + 1) // 2):
			if s - i > n:
				continue
			cur += min(d[i], d[s - i])
		if s % 2 == 0:
			cur += d[s // 2] // 2
		ans = max(ans, cur)
	print(ans)


from sys import stdin, stdout
from collections import Counter
from math import ceil
from bisect import bisect_left
from bisect import bisect_right
import math
ai = lambda : list(map(int, stdin.readline().split()))
ei = lambda : map(int, stdin.readline().split())
ip = lambda : int(stdin.readline().strip())
for i in range(ip()):
	n = ip()
	weight = ai()
	d = {}
	arr = []
	for i in range(n - 1):
		for j in range(i + 1, n):
			arr.append((weight[i] + weight[j], i, j))
	for i in range(len(arr)):
		if arr[i][0] not in d:
			d[arr[i][0]] = [arr[i][1], arr[i][2]]
		elif arr[i][1] not in d[arr[i][0]] and arr[i][2] not in d[arr[i][0]]:
			d[arr[i][0]].append(arr[i][1])
			d[arr[i][0]].append(arr[i][2])
	for (k, v) in d.items():
		d[k] = len(set(v)) // 2
	final = []
	for (k, v) in d.items():
		final.append(v)
	try:
		print(max(final))
	except:
		print(0)


def solve(n, l):
	if n < 2:
		return 0
	ans = 0
	s = l[-1] + l[-2]
	m = l.copy()
	for i in range(1, s + 1):
		l = m.copy()
		count = 0
		for j in range(n):
			temp = l[j]
			l[j] = -100
			if i - temp in l:
				l[l.index(i - temp)] = -100
				count += 1
			else:
				l[j] = temp
		ans = max(ans, count)
	return ans
t = int(input())
for we in range(t):
	n = int(input())
	l = sorted(list(map(int, input().split())))
	print(solve(n, l))


t = int(input())
while t > 0:
	n = int(input())
	l = list(map(int, input().split()))
	d = {}
	for i in range(n - 1):
		for j in range(i + 1, n):
			if l[i] + l[j] not in d:
				d[l[i] + l[j]] = {i, j}
			elif i not in d[l[i] + l[j]] and j not in d[l[i] + l[j]]:
				d[l[i] + l[j]].add(i)
				d[l[i] + l[j]].add(j)
	maxi = 0
	for i in d:
		maxi = max(maxi, len(d[i]) // 2)
	print(maxi)
	t -= 1


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

def insr():
	s = input()
	return s

def inlt():
	return list(map(int, input().split()))

def solve(l):
	best = 0
	l = sorted(l)
	for s in range(1, 101):
		ans = 0
		i = 0
		j = len(l) - 1
		while i < j:
			if l[i] + l[j] == s:
				ans += 1
				i += 1
				j -= 1
			elif l[i] + l[j] > s:
				j -= 1
			else:
				i += 1
		best = max(best, ans)
	return best
r = inp()
for i in range(r):
	a = inp()
	l2 = inlt()
	s = solve(l2)
	print(s)


import math, sys
from sys import stdin, stdout
from collections import Counter, defaultdict, deque
input = stdin.readline
I = lambda : int(input())
li = lambda : list(map(int, input().split()))

def solve():
	n = I()
	a = li()
	ans = 0
	for i in range(2, 2 * n + 1):
		d = 0
		c = Counter(a)
		for j in range(n):
			if i < a[j]:
				continue
			if i - a[j] in c and c[i - a[j]] > 0:
				d += 1
				c[i - a[j]] -= 1
		d = d // 2
		ans = max(ans, d)
	print(ans)
for _ in range(I()):
	solve()


import sys
reader = (s.rstrip() for s in sys.stdin)
input = reader.__next__
from collections import Counter
t = int(input())
for _ in range(t):
	n = int(input())
	weights = list(map(int, input().split()))
	cnt = Counter(weights)
	ans = 0
	for s in range(2, 101):
		temp = 0
		for a in range(1, s // 2 + 1):
			b = s - a
			if a in cnt and b in cnt:
				if a == b:
					temp += cnt[a] // 2
				else:
					temp += min(cnt[a], cnt[b])
		ans = max(ans, temp)
	print(ans)


import sys, math
try:
	(sys.stdin, sys.stdout) = (open('input.txt', 'r'), open('output.txt', 'w'))
except:
	pass
from sys import stdin, stdout
mod = int(1000000000.0 + 7)
from statistics import mode
from collections import *
from math import ceil, floor, inf, factorial, gcd, log2, sqrt
ii1 = lambda : int(stdin.readline().strip())
is1 = lambda : stdin.readline().strip()
iia = lambda : list(map(int, stdin.readline().strip().split()))
isa = lambda : stdin.readline().strip().split()

def lcm(a, b):
	return a * b // gcd(a, b)

def setbits(n):
	return bin(n).count('1')

def resetbits(n):
	return bin(n).count('0')

def modinv(n, p):
	return pow(n, p - 2, p)

def ncr_p(n, r, p):
	(num, den) = (1, 1)
	for i in range(r):
		num = num * (n - i) % p
		den = den * (i + 1) % p
	return num * modinv(den, p) % p

def isPrime(num):
	if num <= 1:
		return False
	if num == 2 or n == 3:
		return True
	if num % 2 == 0 or num % 3 == 0:
		return False
	for i in range(5, int(num ** 0.5) + 1, 6):
		if num % i == 0 or num % (i + 2) == 0:
			return False
	return True

def bin_search(arr, low, high, val):
	while low <= high:
		mid = low + (high - low) // 2
		if arr[mid] == val:
			return mid
		elif arr[mid] < val:
			low = mid + 1
		else:
			high = mid - 1
	return -1

def sumofdigit(num):
	count = 0
	while num:
		count += num % 10
		num //= 10
	return count

def make_dic(arr):
	freq = {}
	for val in arr:
		freq[val] = freq[val] + 1 if val in freq else 1
	return freq

def inputmatrix():
	(r, c) = iia()
	mat = [0] * r
	for i in range(r):
		mat[i] = iia()
	return mat

def prefix_sum(n, arr):
	for i in range(1, n):
		arr[i] += arr[i - 1]
	return arr

def binomial(n, k):
	if 0 <= k <= n:
		ntok = 1
		ktok = 1
		for t in range(1, min(k, n - k) + 1):
			ntok *= n
			ktok *= t
			n -= 1
		return ntok // ktok
	else:
		return 0

def divisors(n):
	res = []
	for i in range(1, ceil(sqrt(n)) + 1):
		if n % i == 0:
			if i == n // i:
				res.append(i)
			else:
				res.append(i)
				res.append(n // i)
	return res
for _ in range(ii1()):
	n = ii1()
	arr = iia()
	dic = {}
	b = min(arr)
	a = max(arr)
	counter = Counter(arr)
	ma = 0
	for i in range(2 * b, 2 * a + 1):
		s = i
		ans = 0
		for (key, val) in counter.items():
			newkey = s - key
			if newkey in counter:
				ans += min(val, counter[newkey])
		ans //= 2
		ma = max(ma, ans)
	print(ma)


from sys import stdin, stdout
test = int(stdin.readline())
for _ in range(test):
	n = int(stdin.readline())
	a = [int(x) for x in stdin.readline().split()]
	a.sort()
	ans = 0
	for i in range(n):
		for j in range(n - 1, -1, -1):
			if i == j:
				continue
			sm = a[i] + a[j]
			cnt = 1
			(ti, tj) = (0, n - 1)
			while ti < tj:
				if ti == tj:
					ti += 1
					tj -= 1
					continue
				if ti == i or ti == j:
					ti += 1
					continue
				if tj == j or tj == i:
					tj -= 1
					continue
				if a[ti] + a[tj] > sm:
					tj -= 1
					continue
				if a[ti] + a[tj] < sm:
					ti += 1
					continue
				cnt += 1
				ti += 1
				tj -= 1
			ans = max(ans, cnt)
	print(ans)


def solve(lst):
	dct = {}
	for i in range(len(lst)):
		for j in range(i + 1, len(lst)):
			sums = lst[i] + lst[j]
			if sums in dct and i not in dct[sums][1] and (j not in dct[sums][1]):
				dct[sums][0] += 1
				dct[sums][1].add(i)
				dct[sums][1].add(j)
			elif sums not in dct:
				dct[sums] = [1, set([i, j])]
	best = -1
	for val in list(dct.values()):
		(cts, const) = val
		best = max(best, cts)
	return max(best, 0)
test_cases = int(input())
for i in range(test_cases):
	n = input()
	a = list(map(int, input().rstrip().split()))
	res = solve(a)
	print(res)


from collections import defaultdict

def solve():
	input()
	nums = list(map(int, input().split()))
	best = 0
	for weight in range(max(nums) * 2 + 1):
		total = 0
		counts = defaultdict(int)
		i = 0
		for num in nums:
			if counts[weight - num]:
				total += 1
				counts[weight - num] -= 1
			else:
				counts[num] += 1
		best = max(total, best)
	return best
t = int(input())
for _ in range(t):
	print(solve())


T = int(input())
for _ in range(T):
	N = int(input())
	A = list(map(int, input().split()))
	A.sort()
	ans = 0
	for ind in range(2, N + N + 1):
		cnt = 0
		i = 0
		j = N - 1
		while i < j:
			a = A[i]
			b = A[j]
			if a + b == ind:
				cnt += 1
				i += 1
				j -= 1
			elif a + b > ind:
				j -= 1
			else:
				i += 1
		ans = max(ans, cnt)
	print(ans)


from collections import Counter
n = int(input())
for _ in range(n):
	nn = int(input())
	ls = Counter(list(map(int, input().split())))
	ws = [0 for x in range(105)]
	for i in ls:
		for j in ls:
			if j > i:
				continue
			ws[i + j] += min(ls[i], ls[j]) if i != j else ls[i] // 2
	print(max(ws))


from collections import Counter

def maxPossiblePairs(freqs, n):
	maxCount = 0
	s = 2
	while s <= 2 * n:
		possiblePair = 0
		for each in range(1, (s + 1) // 2):
			possiblePair += min(freqs.get(each, 0), freqs.get(s - each, 0))
		if s % 2 == 0:
			possiblePair += freqs.get(s // 2, 0) // 2
		maxCount = max(maxCount, possiblePair)
		s += 1
	return maxCount
for (i, _) in enumerate(range(int(input()))):
	N = int(input())
	weights = []
	weights = list(map(int, input().split()))
	count = dict(Counter(weights))
	print(maxPossiblePairs(count, N))


from collections import defaultdict

def main():
	for _ in range(int(input())):
		n = int(input())
		l = [0] * 101
		a = list(map(int, input().split()))
		(i, j) = (0, 0)
		teams = 0
		m = 0
		d = defaultdict(list)
		for i in range(n):
			d[a[i]].append(i)
		for i in range(2, 101):
			s = set()
			for j in range(n):
				if i - a[j] in d:
					for y in d[i - a[j]]:
						if y not in s and j not in s:
							s.add(y)
							s.add(j)
							break
			m = max(m, len(s) // 2)
		print(m)
main()


import os
import sys
import math
from io import BytesIO, IOBase
from fractions import Fraction
import collections
from itertools import permutations
from collections import defaultdict
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
mod = 998244353
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	d = dict()
	for i in a:
		if i in d:
			d[i] += 1
		else:
			d[i] = 1
	mx = 0
	a.sort()
	a = list(set(a))
	for i in range(2, 2 * n + 1):
		curr = 0
		for j in a:
			k = i - j
			if j in d and k in d:
				curr += min(d[j], d[k])
		curr //= 2
		mx = max(mx, curr)
	print(mx)


t = int(input())
for j in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	b = [[] for _ in range(2 * n + 1)]
	for i in range(n):
		for j in range(i + 1, n):
			if i not in b[a[i] + a[j]] and j not in b[a[i] + a[j]]:
				b[a[i] + a[j]].append(i)
				b[a[i] + a[j]].append(j)
	c = [len(b[i]) for i in range(2 * n + 1)]
	print(max(c) // 2)


def solve():
	n = int(input())
	arr = list(map(int, input().split()))
	max_arr = max(arr)
	crr = [0] * (2 * max_arr + 1)
	OTBET = 0
	for i in arr:
		crr[i] += 1
	for s in range(2, 2 * max_arr + 1):
		s_OTBET = 0
		for i in range(1, s // 2 + 1):
			if 2 * i == s:
				s_OTBET += crr[s // 2] // 2
			else:
				s_OTBET += min(crr[s - i], crr[i])
		OTBET = max(OTBET, s_OTBET)
	print(OTBET)

def main():
	for _ in range(int(input())):
		solve()
main()


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().strip().split(' ')))
	b = [0] * 51
	v = [0] * 1001
	r = list(set(a))
	for i in range(n):
		b[a[i]] += 1
	for i in range(len(r)):
		for j in range(i + 1, len(r)):
			v[r[i] + r[j]] += min(b[r[i]], b[r[j]])
	for i in range(len(r)):
		v[r[i] + r[i]] += b[r[i]] // 2
	print(max(v))


from collections import deque
from math import *
import heapq
from random import *
import sys
t = int(input())
for i in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	d = {}
	MAX = 0
	if n == 1:
		print(0)
		continue
	for j in range(len(l) - 1):
		for k in range(j + 1, len(l)):
			val = l[j] + l[k]
			if val not in d:
				d[val] = [j, k]
			elif j not in d[val] and k not in d[val]:
				d[val].append(j)
				d[val].append(k)
			if len(d[val]) // 2 > MAX:
				MAX = len(d[val]) // 2
	print(MAX)


tests = int(input())
for test in range(tests):
	n = int(input())
	A = list(map(int, input().split()))
	ans = 0
	for s in range(1, 2 * n + 1):
		M = {}
		for i in A:
			if i not in M:
				M[i] = 1
			else:
				M[i] += 1
		count = 0
		for i in range(len(A)):
			if s - A[i] in M and (A[i] != s - A[i] and M[s - A[i]] > 0 and (M[A[i]] > 0) or (A[i] == s - A[i] and M[A[i]] > 1)):
				M[A[i]] -= 1
				M[s - A[i]] -= 1
				count += 1
		ans = max(ans, count)
	print(ans)


from collections import Counter
for _ in range(int(input())):
	n = int(input())
	list1 = list(map(int, input().split()))
	dict1 = Counter(list1)
	max1 = 0
	counterstore = {}
	templist = []
	for i in dict1.keys():
		templist.append(i)
	for i in range(len(templist)):
		try:
			counterstore[templist[i] * 2] += dict1[templist[i]] // 2
		except:
			counterstore[templist[i] * 2] = dict1[templist[i]] // 2
		for j in range(i + 1, len(templist)):
			possible = min(dict1[templist[j]], dict1[templist[i]])
			try:
				counterstore[templist[i] + templist[j]] += possible
			except:
				counterstore[templist[i] + templist[j]] = possible
	ans = 0
	for i in counterstore:
		ans = max(ans, counterstore[i])
	print(ans)


from collections import Counter
t = int(input())
for _ in range(t):
	n = int(input())
	wi = list(map(int, input().split()))
	li = [0] * (n + 1)
	for i in wi:
		li[i] += 1
	an = 0
	for s in range(2, 2 * n + 1):
		ans = 0
		for j in range(1, s // 2 + 1):
			if s - j > n:
				continue
			if s % 2 == 0:
				if j != s // 2:
					ans += min(li[j], li[s - j])
			else:
				ans += min(li[j], li[s - j])
		if s % 2 == 0:
			ans += li[s // 2] // 2
		an = max(an, ans)
	print(an)


from sys import stdin
input = lambda : stdin.readline().strip()
from math import ceil, sqrt, factorial, gcd
from collections import deque
for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	if n == 1:
		print(0)
	else:
		l.sort()
		count = 0
		d = {}
		for j in l:
			if j in d:
				d[j] += 1
			else:
				d[j] = 1
		for i in range(l[0] + l[1], l[-1] + l[-2] + 1):
			t = i
			z = dict(d)
			c = 0
			for j in z:
				if t - j == j:
					c += z[j] // 2
					z[j] = z[j] % 2
				elif t - j in z:
					x = min(z[j], z[t - j])
					z[j] -= x
					z[t - j] -= x
					c += x
			count = max(count, c)
		print(count)


import sys
input = sys.stdin.readline
t = int(input())
for t1 in range(t):
	n = int(input())
	l = list(map(int, input().split(' ')))
	l.sort()
	ans = 0
	for i in range(1, 2 * n + 1):
		w = {}
		b = 0
		for j in range(n):
			w[l[j]] = w.get(l[j], 0) + 1
		for j in range(n):
			a = i - l[j]
			if a == l[j] and w.get(l[j], 0) >= 2:
				w[l[j]] -= 2
				b += 1
			elif a != l[j] and w.get(a, 0) > 0 and (w.get(l[j], 0) > 0):
				b += 1
				w[l[j]] -= 1
				w[a] -= 1
		ans = max(ans, b)
	print(ans)


for _ in range(int(input())):
	n = int(input())
	lst = list(map(int, input().split()))
	total = 0
	dict = {}
	for i in lst:
		if i in dict:
			dict[i] += 1
		else:
			dict[i] = 1
	for i in range(2, 2 * n + 1):
		cur = 0
		for j in range(1, i + 1):
			if i - j > n:
				continue
			try:
				cur += min(dict[j], dict[i - j])
			except:
				pass
		cur = cur // 2
		total = max(total, cur)
	print(total)


t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	arr = list(map(int, input().split()))
	count_arr = [0] * 105
	max_team = 0
	for i in arr:
		count_arr[i] += 1
	for i in range(2, 101):
		j = 1
		k = i - 1
		count = 0
		while j <= k:
			if j == k:
				count += int(count_arr[j] // 2)
			else:
				count += min(count_arr[j], count_arr[k])
			j += 1
			k -= 1
		max_team = max(max_team, count)
	print(max_team)


import sys
import math
from collections import defaultdict, Counter, deque

def solve(test):
	n = int(input())
	w = list(map(int, input().split()))
	if n == 1:
		print(0)
	elif n == 2 or n == 3:
		print(1)
	else:
		ans = 0
		w.sort()
		mn = w[0] + w[1]
		mx = w[-1] + w[-2]
		rec = Counter(w)
		for s in range(mn, mx + 1):
			team = 0
			done = set()
			for p1 in rec:
				if p1 in done:
					continue
				p2 = s - p1
				if p1 == p2:
					team += rec[p1] // 2
				else:
					team += min(rec[p1], rec[p2])
				done.add(p2)
			ans = max(ans, team)
		print(ans)
test_cases = int(input())
for t in range(1, test_cases + 1):
	solve(t)


from collections import Counter

def solve():
	n = int(input())
	arr = list(map(int, input().split()))
	max_count = 0
	counter = Counter(arr)
	for s in range(2, 2 * n + 1):
		count = 0
		for i in range(1, (s + 1) // 2):
			if s - i > n:
				continue
			count += min(counter[i], counter[s - i])
		if s % 2 == 0:
			count += counter[s // 2] // 2
		max_count = max(max_count, count)
	print(max_count)
	return
t = int(input())
while t:
	solve()
	t -= 1


from collections import Counter
for _ in range(int(input())):
	n = int(input())
	nums = Counter(list(map(int, input().split())))
	if n == 1:
		print('0')
		continue
	numlist = list(nums.keys())
	numlen = len(numlist)
	sums = {}
	ans = 0
	for i in range(numlen):
		if nums[numlist[i]] > 1:
			try:
				sums[numlist[i] * 2] += nums[numlist[i]] // 2
			except:
				sums[numlist[i] * 2] = nums[numlist[i]] // 2
		for j in range(i + 1, numlen):
			try:
				sums[numlist[i] + numlist[j]] += min(nums[numlist[i]], nums[numlist[j]])
			except:
				sums[numlist[i] + numlist[j]] = min(nums[numlist[i]], nums[numlist[j]])
	print(max(sums.values()))


t = int(input())
for _ in range(t):
	n = int(input())
	w = list(map(int, input().split()))
	number_of_weights = [0] * (2 * n + 1)
	for weight in w:
		number_of_weights[weight] += 1
	highest_number = 0
	for s in range(2, 2 * n + 1):
		number_of_teams = 0
		for i in range(1, s // 2 + 1):
			if i == s - i:
				number_of_teams += number_of_weights[i] // 2
			else:
				number_of_teams += min(number_of_weights[i], number_of_weights[s - i])
		highest_number = max(number_of_teams, highest_number)
	print(highest_number)


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
for j in range(int(input())):
	n = int(input())
	vals = list(map(int, input().split()))
	vals.sort()
	dict1 = {}
	for s in range(2, 101):
		dict1[s] = 0
	dict2 = {}
	for s in vals:
		if not s in dict2:
			dict2[s] = 1
		else:
			dict2[s] += 1
	for s in range(2, 101):
		temp = dict2.copy()
		target = s
		for b in range(len(vals)):
			if s - vals[b] in temp:
				if vals[b] == s - vals[b]:
					if temp[vals[b]] >= 2:
						temp[vals[b]] -= 2
						dict1[s] += 1
				elif temp[s - vals[b]] >= 1 and temp[vals[b]] >= 1:
					temp[s - vals[b]] -= 1
					temp[vals[b]] -= 1
					dict1[s] += 1
	print(max(dict1.values()))


from sys import stdin, stdout
import math
from itertools import permutations, combinations
from collections import defaultdict
from bisect import bisect_left
from bisect import bisect_right

def L():
	return list(map(int, stdin.readline().split()))

def In():
	return map(int, stdin.readline().split())

def I():
	return int(stdin.readline())
P = 1000000007

def maxCountSameSUM(arr, n):
	M = defaultdict(lambda : 0)
	for i in range(n):
		for j in range(n):
			if i != j and arr[i] + arr[j] not in M.keys():
				M[arr[i] + arr[j]] = 0
	arr1 = list(M.keys())
	mx = 0
	for val in arr1:
		lis = [1 for i in range(n)]
		for i in range(0, n - 1):
			for j in range(i + 1, n):
				if lis[i] and lis[j] and (arr[i] + arr[j] == val):
					lis[i] = 0
					lis[j] = 0
					M[arr[i] + arr[j]] += 1
	for key in M:
		mx = max(mx, M[key])
	return mx

def main():
	for t in range(I()):
		n = I()
		arr = L()
		print(maxCountSameSUM(arr, n))
main()


from collections import Counter

def findweight(arr, t):
	d = {}
	for i in arr:
		d[i] = d.get(i, 0) + 1
	maxi = 0
	for i in range(2, 2 * t + 1):
		total = 0
		for j in d:
			other = i - j
			if other > 0 and other in d:
				total += min(d[j], d[other])
		total = total // 2
		maxi = max(maxi, total)
	return maxi
n = int(input())
for i in range(n):
	t = int(input())
	arr = [int(i) for i in input().split()]
	print(findweight(arr, t))


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	ans = {}
	ans1 = 0
	for sum in range(1, 100 + 1):
		ans = {}
		for i in range(n):
			if a[i] in ans:
				ans[a[i]] += 1
			else:
				ans[a[i]] = 1
		count = 0
		for i in range(n):
			if ans[a[i]] > 0:
				check = sum - a[i]
				if check in ans:
					if ans[check] > 0:
						if check == a[i]:
							if ans[check] >= 2:
								count += 1
								ans[check] -= 1
								ans[a[i]] -= 1
						else:
							count += 1
							ans[check] -= 1
							ans[a[i]] -= 1
		ans1 = max(ans1, count)
	print(ans1)


from sys import stdin, stdout
from itertools import combinations
from collections import defaultdict, Counter
import math

def listIn():
	return list(map(int, stdin.readline().strip().split()))

def stringListIn():
	return [x for x in stdin.readline().split()]

def intIn():
	return int(stdin.readline())

def stringIn():
	return stdin.readline().strip()

def solve(arr, n):
	di = {}
	for i in range(0, n - 1):
		for j in range(i + 1, n):
			s = arr[i] + arr[j]
			if s not in di:
				di[s] = [i, j]
			elif i not in di[s] and j not in di[s]:
				di[s] += [i, j]
	max_count = 0
	ans = 0
	for ele in di:
		l = len(di[ele])
		if max_count < l:
			max_count = l
	return max_count
t = intIn()
while t > 0:
	t -= 1
	n = intIn()
	w = listIn()
	ans = solve(w, n)
	print(ans // 2)


import time
from collections import deque

def inpt():
	return int(input())

def inpl():
	return list(map(int, input().split()))

def inpm():
	return map(int, input().split())

def func(s, n, l):
	i = 0
	count = 0
	j = n - 1
	while i < j:
		if l[i] + l[j] == s:
			count += 1
			i += 1
			j -= 1
		elif l[i] + l[j] > s:
			j -= 1
		else:
			i += 1
	return count

def solve():
	n = inpt()
	l = sorted(inpl())
	if n == 1:
		print(0)
		return
	elif n == 2 or n == 3:
		print(1)
		return
	low = l[0] + l[1]
	high = l[-1] + l[-2]
	ans = 0
	for s in range(low, high + 1):
		ans = max(ans, func(s, n, l))
	print(ans)

def main():
	m = 10 ** 9 + 7
	t = int(input())
	while t:
		t -= 1
		solve()
main()


import math
for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	carr = [0] * 51
	for i in l:
		carr[i] += 1
	ans = 0
	for k in range(2, 101):
		var = 0
		vis = [False] * 51
		for i in range(1, 51):
			x = k - i
			if x < 0 or x > 50:
				continue
			if carr[i] == 0 or vis[x] == True:
				continue
			if x == i:
				var += carr[i] // 2
				continue
			if x < 0 or x > 50:
				continue
			if carr[x] > 0:
				var += min(carr[i], carr[x])
			vis[i] = True
		ans = max(ans, var)
	print(ans)


from collections import Counter

def main():
	t = Iint()
	for _ in range(t):
		n = Iint()
		w = Ilist()
		if n == 1:
			print(0)
			continue
		weights = list(Counter(w).items())
		weight_sum = Counter()
		l = len(weights)
		for i in range(l):
			for j in range(i + 1, l):
				weight_sum[weights[i][0] + weights[j][0]] += min(weights[i][1], weights[j][1])
		for i in range(l):
			weight_sum[weights[i][0] * 2] += weights[i][1] // 2
		both_weight = weight_sum.most_common()
		print(both_weight[0][1])
FIO = 10

def I():
	return input()

def Iint():
	return int(input())

def Ilist():
	return list(map(int, input().split()))

def Imap():
	return map(int, input().split())

def Plist(li, s=' '):
	print(s.join(map(str, li)))
en = enumerate

def console(*args):
	print('\x1b[36m', *args, '\x1b[0m', file=sys.stderr)
	return
if not FIO:
	if __name__ == '__main__':
		main()
		exit()
else:
	from io import BytesIO, IOBase
	import sys
	import os
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))

def input():
	return sys.stdin.readline().rstrip('\r\n')
main()


t = int(input())
for _ in range(t):
	n = int(input())
	a = [int(x) for x in input().split()]
	sums = set()
	for i in range(n):
		for j in range(i + 1, n):
			sums.add(a[i] + a[j])
	c = 0
	for s in sums:
		count = 0
		avail = list(range(n))
		for i in range(n):
			for j in range(i + 1, n):
				if a[i] + a[j] == s and i in avail and (j in avail):
					avail.remove(i)
					avail.remove(j)
					count += 1
		c = max(c, count)
	print(c)


t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	a = [int(x) for x in input().split()]
	a.sort()
	count = 0
	for p in range(2, 2 * n + 1):
		aux = 0
		i = 0
		j = n - 1
		while i < j:
			if a[i] + a[j] == p:
				aux += 1
				i += 1
				j -= 1
			elif a[i] + a[j] < p:
				i += 1
			else:
				j -= 1
		count = aux > count and aux or count
	print(count)


import heapq as hq
from heapq import heappop, heappush
from collections import deque, defaultdict, Counter

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

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s)])

def invr():
	return map(int, input().split())

def subset_sum_count(arr, n, sum):
	dp = [[0 for _ in range(sum + 1)] for _ in range(n + 1)]
	for i in range(n + 1):
		for j in range(sum + 1):
			if j == 0:
				dp[i][j] = 1
			elif arr[i - 1] <= j:
				dp[i][j] = dp[i - 1][j - arr[i - 1]] + dp[i - 1][j]
			else:
				dp[i][j] = dp[i - 1][j]
	return dp[n][sum]

def prefix(a):
	pre = []
	pre.append(a[0])
	for i in range(1, len(a)):
		pre.append(pre[i - 1] + a[i])
	return pre

def binary_search(func, lo, hi, abs_prec=1e-07):
	while abs(hi - lo) > abs_prec:
		mi = lo + (hi - lo) / 2
		if func(mi):
			hi = mi
		else:
			lo = mi
	return (lo + hi) / 2

def ternary_search(func, lo, hi, abs_prec=1e-07):
	while abs(hi - lo) > abs_prec:
		lo_third = lo + (hi - lo) / 3
		hi_third = hi - (hi - lo) / 3
		if func(lo_third) < func(hi_third):
			lo = lo_third
		else:
			hi = hi_third
	return (lo + hi) / 2

def discrete_binary_search(func, lo, hi):
	while lo < hi:
		mi = lo + (hi - lo) // 2
		if func(mi):
			hi = mi
		else:
			lo = mi + 1
	return lo

def discrete_ternary_search(func, lo, hi):
	while lo <= hi:
		lo_third = lo + (hi - lo) // 3
		hi_third = lo + (hi - lo) // 3 + (1 if 0 < hi - lo < 3 else (hi - lo) // 3)
		if func(lo_third) < func(hi_third):
			lo = lo_third + 1
		else:
			hi = hi_third - 1
	return lo
	return -1

def right_rotate(a, s):
	return a[s:] + a[:s]

def dec_to_bin(x):
	return int(bin(x)[2:])

def str_to_integer_list(n):
	a = []
	for i in range(len(n)):
		a.append(int(n[i]))
	return a

def list_to_str(l):
	s = ''
	for i in l:
		s += str(i)
	return s

def dijkstra(s, N, E):
	visited = set()
	dist = {}
	for i in range(1, N + 1):
		dist[i] = 1 << 29
	queue = [(dist[i], i) for i in range(1, N + 1)]
	hq.heappush(queue, (0, s))
	dist[s] = 0
	while queue:
		(d, u) = hq.heappop(queue)
		if u in visited:
			continue
		for t in E[u]:
			(v, r) = t
			if dist[v] > d + r:
				dist[v] = d + r
				hq.heappush(queue, (dist[v], v))
		visited.add(u)
	return dist

def prime_sieve(n):
	flag = n % 6 == 2
	sieve = bytearray((n // 3 + flag >> 3) + 1)
	for i in range(1, int(n ** 0.5) // 3 + 1):
		if not sieve[i >> 3] >> (i & 7) & 1:
			k = 3 * i + 1 | 1
			for j in range(k * k // 3, n // 3 + flag, 2 * k):
				sieve[j >> 3] |= 1 << (j & 7)
			for j in range(k * (k - 2 * (i & 1) + 4) // 3, n // 3 + flag, 2 * k):
				sieve[j >> 3] |= 1 << (j & 7)
	return sieve

def prime_list(n):
	res = []
	if n > 1:
		res.append(2)
	if n > 2:
		res.append(3)
	if n > 4:
		sieve = prime_sieve(n + 1)
		res.extend((3 * i + 1 | 1 for i in range(1, (n + 1) // 3 + (n % 6 == 1)) if not sieve[i >> 3] >> (i & 7) & 1))
	return res

def dijkstra(n, graph, start):
	(dist, parents) = ([float('inf')] * n, [-1] * n)
	dist[start] = 0
	queue = [(0, start)]
	while queue:
		(path_len, v) = heappop(queue)
		if path_len == dist[v]:
			for (w, edge_len) in graph[v]:
				if edge_len + path_len < dist[w]:
					(dist[w], parents[w]) = (edge_len + path_len, v)
					heappush(queue, (edge_len + path_len, w))
	return (dist, parents)

def path(start, end, parent):
	path = [end]
	while path[-1] != start:
		path.append(parent[path[-1]])
	path.reverse()
	return path

def bfs(graph, start, goal):
	if start == goal:
		return [start]
	visited = {start}
	queue = deque([(start, [])])
	while queue:
		(current, path) = queue.popleft()
		visited.add(current)
		for neighbor in graph[current]:
			if neighbor == goal:
				return path + [current, neighbor]
			if neighbor in visited:
				continue
			queue.append((neighbor, path + [current]))
			visited.add(neighbor)
	return None
import os
import sys
from io import BytesIO, IOBase

def DecimalToBinary(n):

	def helper(n):
		if n == 0:
			return ''
		else:
			if n % 2 == 1:
				binaryDigit = '1'
			else:
				binaryDigit = '0'
			return helper(n // 2) + binaryDigit
	if n == 0:
		result = '0'
	else:
		result = helper(n)
	return result

def p(board):
	for i in range(8):
		s = ''
		for j in range(8):
			s += board[i][j]
		print(s)

def binaryToDecimal(n):
	return int(n, 2)

def decimalToBinary(n):
	return bin(n).replace('0b', '')

def solve(a, b):
	x = DecimalToBinary(a)
	y = DecimalToBinary(b)
	z = x + y
	l = y + x
	r = binaryToDecimal(z) - binaryToDecimal(l)
	return r

def mostFrequent(arr, n):
	arr.sort()
	max_count = 1
	res = arr[0]
	curr_count = 1
	for i in range(1, n):
		if arr[i] == arr[i - 1]:
			curr_count += 1
		else:
			if curr_count > max_count:
				max_count = curr_count
				res = arr[i - 1]
			curr_count = 1
	if curr_count > max_count:
		max_count = curr_count
		res = arr[n - 1]
	return res

def main():
	for _ in range(inp()):
		n = inp()
		a = sorted(inlt())
		ans = 0
		for s in range(2, 106):
			sum = 0
			for x in range(n):
				i = x
				j = n - 1
				cnt = 0
				while i <= j and i != j:
					if a[i] + a[j] == s:
						i += 1
						j -= 1
						cnt += 1
					elif a[i] + a[j] < s:
						i += 1
					else:
						j -= 1
				sum = max(sum, cnt)
			ans = max(ans, sum)
		print(ans)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


import sys
from collections import Counter
input = sys.stdin.readline
for nt in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	c = Counter(a)
	loc = {}
	for i in range(n):
		if a[i] not in loc:
			loc[a[i]] = [0, i]
		else:
			loc[a[i]].append(i)
	ans = 0
	for i in range(2, 2 * n + 1):
		count = 0
		for j in c:
			if j >= i:
				continue
			if i - j in c:
				count += min(c[j], c[i - j])
		ans = max(ans, count)
	print(ans // 2)


from sys import stdin
for _ in range(int(stdin.readline())):
	n = int(stdin.readline())
	a = list(map(int, stdin.readline().split()))
	count = [0] * (n + 1)
	for i in a:
		count[i] += 1
	res = 0
	for i in range(2, 2 * n + 1):
		t = 0
		for j in range(1, (i + 1) // 2):
			if i - j <= n:
				t += min(count[j], count[i - j])
		if i % 2 == 0:
			t += count[i // 2] // 2
		res = max(res, t)
	print(res)


from collections import defaultdict
for i in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	d = defaultdict(int)
	for i in a:
		d[i] += 1
	su = defaultdict(int)
	for i in d:
		for j in d:
			if i == j:
				su[i + j] += d[i] // 2
			else:
				su[i + j] += min(d[i], d[j]) / 2
	su = {y: x for (x, y) in su.items()}
	print(round(max(su)))


import sys
import math, bisect
from collections import defaultdict
from itertools import groupby, accumulate
from heapq import heapify, heappop, heappush
from collections import deque, Counter, OrderedDict

def neo():
	return map(int, input().split())

def Neo():
	return list(map(int, input().split()))
for _ in range(int(input())):
	n = int(input())
	A = Neo()
	if n == 1:
		print(0)
		continue
	A.sort()
	Z = Counter(A)
	k = A[-1] + A[-2]
	Ans = []
	for p in range(1, k + 1):
		q = 0
		Z1 = Z.copy()
		for i in A:
			if Z1.get(i, 0) > 0:
				Z1[i] -= 1
				if Z1.get(p - i, 0) > 0:
					q += 1
					Z1[p - i] -= 1
				else:
					Z1[i] += 1
		Ans.append(q)
	print(max(Ans))


from collections import Counter
for _ in range(int(input())):
	n = int(input())
	a = [*map(int, input().split())]
	c = Counter(a)
	ans = 0
	for i in range(2, 101):
		res = 0
		done = set()
		for j in c:
			if j not in done:
				if j == i - j:
					res += c[j] // 2
					done.add(j)
				else:
					res += min(c[j], c[i - j])
					done.add(j)
					done.add(i - j)
		ans = max(res, ans)
	print(ans)


from collections import defaultdict as d
import sys
input = sys.stdin.buffer.readline
t = int(input())
for _ in range(t):
	n = int(input())
	w = [int(x) for x in input().split()]
	if n == 1:
		print(0)
		continue
	cnts = d(lambda : 0)
	taken = d(set)
	for i in range(n - 1):
		for j in range(i + 1, n):
			summ = w[i] + w[j]
			if i not in taken[summ] and j not in taken[summ]:
				cnts[summ] += 1
				taken[summ].add(i)
				taken[summ].add(j)
	print(max(cnts.values()))


for testcases in range(int(input())):
	num = int(input())
	a = list(map(int, input().split()))
	l = []
	if num < 2:
		print(0)
	elif num < 4:
		print(1)
	else:
		for i in range(2, 2 * num + 1):
			wt = 0
			s = a.copy()
			for j in range(num):
				if s[j] != -1:
					temp = i - s[j]
					temp3 = s[j]
					s[j] = -1
				else:
					continue
				if temp > 0:
					if temp in s:
						temp1 = s.index(temp)
						s[j] = -1
						s[temp1] = -1
						wt += 1
					else:
						s[j] = temp3
			l.append(wt)
		print(max(l))


import sys
import math as mt
import collections as cc
input = sys.stdin.readline
I = lambda : list(map(int, input().split()))
for tc in range(int(input())):
	(n,) = I()
	l = I()
	d = cc.Counter(l)
	ans = 0
	for i in range(2, 101):
		temp = 0
		for j in sorted(d):
			if j < i:
				wt = i - j
				if d[wt]:
					temp += min(d[wt], d[j])
		ans = max(temp // 2, ans)
	print(ans)


import sys
input = sys.stdin.readline

def search(a, b, ind, check):
	for i in range(len(a)):
		if a[i] == b and i != ind and (check[i] == 0):
			return i
	return -1

def main(n, lst):
	setA = set(lst)
	totalSum = set()
	for i in setA:
		for j in setA:
			totalSum.add(i + j)
	countM = 0
	for i in totalSum:
		count = 0
		check = [0] * n
		for j in range(n):
			m = search(lst, i - lst[j], j, check)
			if check[j] == 0 and m != -1 and (check[m] == 0):
				if m != -1:
					count += 1
					check[j] = 1
					check[m] = 1
		countM = max(countM, count)
	return countM
for _ in range(int(input())):
	n = int(input())
	lst = list(map(int, input().split()))
	print(main(n, lst))


t = int(input())
for _ in range(t):
	n = int(input())
	w = list(map(int, input().split()))
	max_cnt = 0
	for i in range(2, 2 * n + 1):
		local_cnt = 0
		people_cnt = [0 for j in range(2 * n + 2)]
		for man in w:
			people_cnt[man] += 1
		for j in range(1, i // 2 + 1):
			if j == i - j:
				local_cnt += people_cnt[j] // 2
			else:
				local_cnt += min(people_cnt[j], people_cnt[i - j])
		if local_cnt > max_cnt:
			max_cnt = local_cnt
	print(max_cnt)


t = int(input())
for _ in range(t):
	n = int(input())
	w = [int(x) for x in input().split()]
	d = dict()
	for x in w:
		if x in d:
			d[x] += 1
		else:
			d[x] = 1
	ansd = dict()
	for x in d:
		for y in d:
			if x < y:
				if x + y in ansd:
					ansd[x + y] += min(d[x], d[y])
				else:
					ansd[x + y] = min(d[x], d[y])
			if x == y:
				if x + y in ansd:
					ansd[x + y] += d[x] // 2
				else:
					ansd[x + y] = d[x] // 2
	m = 0
	for x in ansd:
		m = max(m, ansd[x])
	print(m)


import collections
t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	freqs = collections.Counter(arr)
	dd = collections.defaultdict(int)
	ls = [[i, f] for (i, f) in freqs.items()]
	for i in range(len(ls) - 1):
		for j in range(i + 1, len(ls)):
			dd[ls[i][0] + ls[j][0]] += min(ls[i][1], ls[j][1])
	for item in ls:
		dd[2 * item[0]] += item[1] // 2
	print(max(dd.values()))


from collections import Counter

def func(A):
	if len(A) == 1:
		return 0
	A.sort()
	(mini, maxi) = (A[0] + A[1], A[-1] + A[-2])
	res = 0
	for i in range(mini, maxi + 1):
		c = Counter(A)
		s = set()
		temp = 0
		for j in c:
			rem = i - j
			if rem == j:
				temp += c[j] // 2
			elif j not in s:
				temp += min(c[j], c[rem])
				s.add(rem)
		res = max(temp, res)
	return res
t = int(input())
for i in range(t):
	n = int(input())
	A = list(map(int, input().split()))
	print(func(A))


t = int(input())
for j in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	ans = 0
	for i in range(2, 2 * n + 1):
		c = [0] * 101
		cur = 0
		for x in arr:
			if i > x and c[i - x] != 0:
				c[i - x] -= 1
				cur += 1
			else:
				c[x] += 1
		ans = max(ans, cur)
	print(ans)


t = int(input())
for _ in range(t):
	n = int(input())
	weight = list(map(int, input().split()))
	dict = {}
	d_index = {}
	for i in range(n):
		for j in range(i + 1, n):
			x = weight[i] + weight[j]
			if x in d_index:
				if i in d_index[x] or j in d_index[x]:
					continue
				else:
					d_index[x].append(i)
					d_index[x].append(j)
			else:
				d_index[x] = [i, j]
			if x in dict:
				dict[x] += 1
			else:
				dict[x] = 1
	m = 0
	for i in dict:
		m = max(m, dict[i])
	print(m)


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	m = 0
	for s in range(2, 101):
		c = 0
		x = n - 1
		for i in range(n - 1):
			for j in range(x, i, -1):
				d = l[i] + l[j]
				if d == s:
					x = j - 1
					c += 1
					break
				elif d < s:
					x = j
					break
		if c > m:
			m = c
	print(m)


nb = int(input())

def dp(T, n):
	dp = [[0, []] for k in range(2 * n + 1)]
	dp[T[0] + T[1]] = [1, [0, 1]]
	res = 1
	for i in range(2, n):
		for j in range(0, i):
			if i not in dp[T[i] + T[j]][1] and j not in dp[T[i] + T[j]][1]:
				dp[T[i] + T[j]][0] += 1
				dp[T[i] + T[j]][1].append(i)
				dp[T[i] + T[j]][1].append(j)
				if dp[T[i] + T[j]][0] > res:
					res = dp[T[i] + T[j]][0]
	return res
	return dp
for k in range(nb):
	n = int(input())
	A = list(map(int, input().split(' ')))
	if n > 1:
		res = dp(A, n)
		print(res)
	else:
		print(0)


from sys import stdin, stdout
import heapq
import cProfile
from collections import Counter, defaultdict, deque
from functools import reduce
import math

def get_int():
	return int(stdin.readline().strip())

def get_tuple():
	return map(int, stdin.readline().split())

def get_list():
	return list(map(int, stdin.readline().split()))

def solve():
	n = get_int()
	ls = get_list()
	freq_dic = Counter(ls)
	sums_poss = set()
	for i in range(n):
		for j in range(i + 1, n):
			sums_poss.add(ls[i] + ls[j])
	sums_poss = list(sums_poss)
	ans = 0
	for sum_p in sums_poss:
		temp = 0
		for r in range(sum_p // 2 + 1):
			if r != sum_p - r:
				temp += min(freq_dic[r], freq_dic[sum_p - r])
			else:
				temp += freq_dic[r] // 2
		ans = max(ans, temp)
	print(ans)

def main():
	solve()
TestCases = True
if TestCases:
	for i in range(get_int()):
		main()
else:
	main()


def solve(weights):
	dweights = {w: 0 for w in range(2 * len(weights) + 1)}
	for w in weights:
		dweights[w] += 1
	m = 0
	for total in range(2 * len(weights) + 1):
		nb_teams = 0
		for w in range(total // 2 + 1):
			if 2 * w == total:
				nb_teams += dweights[total // 2] // 2
			else:
				nb_teams += min(dweights[w], dweights[total - w])
		m = max(m, nb_teams)
	return m
for _ in range(int(input())):
	n = int(input())
	weights = [int(x) for x in input().split()]
	print(solve(weights))


T = int(input())
while T:
	n = int(input())
	W = list(map(int, input().split()))
	D = {}
	for i in W:
		if i in D:
			D[i] += 1
		else:
			D[i] = 1
	S = {}
	for i in D:
		for j in D:
			S[i + j] = 0
	for x in S:
		R = {}
		for i in D:
			R[i] = 0
			j = x - i
			if i * 2 == x:
				S[x] += D[i] // 2
			if j in D and j not in R:
				S[x] += min(D[i], D[j])
	Z = set(S.values())
	print(max(Z))
	T = T - 1


from functools import lru_cache
import math
t = int(input())
while t:
	t -= 1
	n = int(input())
	wrr = [int(x) for x in input().split()]
	best = 0
	wrr.sort()

	def find(e):
		i = 0
		j = n - 1
		ans = 0
		while i < j:
			if wrr[i] + wrr[j] == e:
				ans += 1
				i += 1
				j -= 1
			elif wrr[i] + wrr[j] > e:
				j -= 1
			else:
				i += 1
		return ans
	for e in range(1, 110):
		best = max(best, find(e))
	print(best)


from sys import stdin

def readline():
	return stdin.readline()
tests = int(readline())

def solve(n, w):
	ans = 0
	w.sort()
	for i in range(0, n):
		for j in range(i + 1, n):
			res = 0
			s = w[i] + w[j]
			p1 = 0
			p2 = n - 1
			while p1 < p2:
				if w[p1] + w[p2] == s:
					res += 1
					p1 += 1
					p2 -= 1
				elif w[p1] + w[p2] > s:
					p2 -= 1
				else:
					p1 += 1
			ans = max(ans, res)
			if ans == n // 2:
				break
	return ans
for t in range(0, tests):
	n = int(readline().rstrip('\n'))
	w = list(map(int, readline().rstrip('\n').split(' ')))
	print(solve(n, w))


t = int(input())
for _ in range(t):
	n = int(input())
	w = list(map(int, input().split()))
	sums = []
	mn = min(w) + 1
	mx = max(w) * 2 + 1
	for cursum in range(mn, mx):
		cnt = 0
		blacklist = [0] * n
		for i in range(n):
			if blacklist[i]:
				continue
			for j in range(i + 1, n):
				if w[i] + w[j] == cursum and (not blacklist[i]) and (not blacklist[j]):
					cnt += 1
					blacklist[i] = 1
					blacklist[j] = 1
					break
		sums.append(cnt)
	print(max(sums))


t = int(input())
for p in range(t):
	n = int(input())
	w = list(map(int, input().split()))
	count_array = [0 for i in range(n + 1)]
	for i in w:
		count_array[i] += 1
	ans = 0
	for s in range(2, 2 * n + 1):
		cur = 0
		for i in range(1, (s + 1) // 2):
			if s - i > n:
				continue
			cur += min(count_array[i], count_array[s - i])
		if s % 2 == 0:
			cur += count_array[s // 2] // 2
		ans = max(ans, cur)
	print(ans)


for _ in range(int(input())):
	n = int(input())
	w = list(map(int, input().split()))
	dic = [0] * (n + 1)
	for i in w:
		dic[i] += 1
	ans = 0
	for s in range(2, max(w) * 2 + 1):
		cur = 0
		for i in range(1, (s + 1) // 2):
			if s - i <= n:
				cur += min(dic[i], dic[s - i])
		if s % 2 == 0:
			cur += dic[s // 2] // 2
		ans = max(ans, cur)
	print(ans)


for _ in range(int(input())):
	n = int(input())
	w = sorted(list(map(int, input().split(' '))))
	w1 = [x for x in w]
	w_min = w[0]
	w_max = w[-1]
	if n < 2:
		print(0)
		continue
	if n <= 3:
		print(1)
		continue
	i = 2 * w_min
	j = 2 * w_max
	max_team = 0
	while i <= j:
		try:
			k = w[0]
		except:
			break
		team = 0
		while True:
			if len(w) > 2:
				if k in w and i - k in w[1:]:
					team += 1
					w.remove(k)
					w.remove(i - k)
					try:
						k = w[0]
					except:
						break
				else:
					w.remove(k)
					try:
						k = w[0]
					except:
						break
			elif len(w) == 2:
				if w[0] + w[1] == i:
					team += 1
					w.remove(k)
					w.remove(i - k)
				else:
					break
			else:
				break
		w = [x for x in w1]
		if team > max_team:
			max_team = team
		i += 1
	print(max_team)


import sys
reader = (s.rstrip() for s in sys.stdin)
input = reader.__next__
from collections import defaultdict

def gift():
	for _ in range(t):
		n = int(input())
		arry = list(map(int, input().split()))
		finalans = 0
		kap = max(arry)
		bibi = min(arry)
		for i in range(bibi + 1, kap * 2 + 1):
			dic = defaultdict(lambda : 0)
			ans = 0
			for ele in arry:
				if i > ele:
					if dic[i - ele] > 0:
						dic[i - ele] -= 1
						ans += 1
					else:
						dic[ele] += 1
			finalans = max(finalans, ans)
		yield finalans
t = int(input())
ans = gift()
print(*ans, sep='\n')


def count(p, arr):
	pairs = 0
	i = 0
	j = len(arr) - 1
	while i < j:
		cur = arr[i] + arr[j]
		if cur < p:
			i += 1
		elif cur > p:
			j -= 1
		else:
			pairs += 1
			i += 1
			j -= 1
	return pairs
test = int(input())
for _ in range(test):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	maxp = 0
	for i in range(n):
		for j in range(i + 1, n):
			p = arr[i] + arr[j]
			maxp = max(maxp, count(p, arr))
	print(maxp)


for _ in range(int(input())):
	n = int(input())
	a = sorted([int(x) for x in input().split()])
	if n >= 2:
		m = a[-1] + a[-2]
		ans = 0
		for i in range(1, m + 1):
			count = 0
			temp = a[:]
			for j in range(n):
				start = temp[j]
				for k in range(n):
					if start + temp[k] == i and temp[k] != 0 and (temp[j] != 0) and (j != k):
						count += 1
						temp[k] = 0
						temp[j] = 0
						break
			ans = max(count, ans)
		print(ans)
	else:
		print(0)


t = int(input())

def search(w, arr):
	(l, r) = (0, len(arr) - 1)
	ret = 0
	while l < r:
		tmp = arr[l] + arr[r]
		if tmp < w:
			l += 1
		elif tmp > w:
			r -= 1
		else:
			ret += 1
			l += 1
			r -= 1
	return ret
while t:
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	mi = min(arr)
	ma = max(arr)
	ans = 0
	for i in range(2, 101):
		ans = max(ans, search(i, arr))
	print(ans)
	t -= 1


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def RL():
	return map(int, sys.stdin.readline().rstrip().split())

def RLL():
	return list(map(int, sys.stdin.readline().rstrip().split()))

def N():
	return int(input())

def print_list(l):
	print(' '.join(map(str, l)))
from collections import Counter
for _ in range(N()):
	n = N()
	nums = RLL()
	dic = Counter(nums)
	ans = 0
	for s in range(2, 2 * n + 1):
		dd = dic.copy()
		res = 0
		for k in dd:
			if k == s / 2 and dd[k] > 0:
				tmp = dd[k] >> 1
				dd[k] -= tmp * 2
				res += tmp
			elif dd[k] > 0 and s - k in dd and (dd[s - k] > 0):
				tmp = min(dd[k], dd[s - k])
				dd[k] -= tmp
				dd[s - k] -= tmp
				res += tmp
		ans = max(res, ans)
	print(ans)


import sys
from collections import Counter
input = lambda : sys.stdin.readline()
int_arr = lambda : list(map(int, input().split()))
str_arr = lambda : list(map(str, input().split()))
get_str = lambda : map(str, input().split())
get_int = lambda : map(int, input().split())
get_flo = lambda : map(float, input().split())
mod = 1000000007
INF = 100000

def solve(n, arr):
	dp = [0] * 101
	d = dict()
	for (e, t) in Counter(arr).items():
		d[e] = t
	for i in d:
		for j in d:
			dp[i + j] += min(d[i], d[j])
	print(max(dp) // 2)
for _ in range(int(input())):
	n = int(input())
	arr = int_arr()
	solve(n, arr)


def solve():
	n = int(input())
	wlst = list(map(int, input().split()))
	cand = []
	cnt = 0
	wlst.sort()
	bef = wlst[0]
	for w in wlst:
		if w == bef:
			cnt += 1
		else:
			cand.append([bef, cnt])
			cnt = 1
		bef = w
	cand.append([bef, cnt])
	l = len(cand)
	ans = [0 for _ in range(2 * n + 1)]
	for i in range(l):
		wi = cand[i][0]
		ci = cand[i][1]
		ans[wi * 2] += ci // 2
		for j in range(i + 1, l):
			wj = cand[j][0]
			cj = cand[j][1]
			ans[wi + wj] += min(ci, cj)
	print(max(ans))
t = int(input())
for _ in range(t):
	solve()


t = int(input())
for i in range(t):
	n = int(input())
	ps = [int(p) for p in input().split(' ')]
	sums = {}
	for i in range(0, n - 1):
		for j in range(i + 1, n):
			s = ps[i] + ps[j]
			if s in sums:
				sums[s].append((i, j))
			else:
				sums[s] = [(i, j)]
	maxC = 0
	if len(sums) != 0:
		for (k, v) in sums.items():
			used = []
			teamL = 0
			for team in v:
				if team[0] not in used and team[1] not in used:
					teamL += 1
					used.append(team[0])
					used.append(team[1])
			maxC = max(maxC, teamL)
	print(maxC)


def function(nums):
	if len(nums) == 1:
		return 0
	nums.sort()
	total = 0
	l1 = []
	max_c = 0
	count = 0
	l = 0
	r = len(nums) - 1
	k = 0
	for k in range(1, 2 * max(nums) + 1):
		count = 0
		l = 0
		r = len(nums) - 1
		while l < r:
			c = nums[l] + nums[r]
			if c == k:
				count += 1
				l += 1
				r -= 1
			if c < k:
				l += 1
			if c > k:
				r -= 1
		if count > max_c:
			max_c = count
	return max_c
t = int(input())
for i in range(t):
	n = int(input())
	nums = list(map(int, input().rstrip().split()))
	print(function(nums))


def solve(n, a):
	a.sort()
	sol = 0
	for tw in range(2, 50 * 2 + 1):
		(l, r) = (0, n - 1)
		curr = 0
		while l < r:
			c = a[l] + a[r]
			if c == tw:
				(l, r) = (l + 1, r - 1)
				curr += 1
			elif c > tw:
				r -= 1
			else:
				l += 1
		sol = max(sol, curr)
	return sol
t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	print(solve(n, a))


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	n = int(input())
	w = sorted([int(i) for i in input().split()])
	ans = 0
	for i in range(2, 2 * n + 1):
		pair = 0
		st = 0
		end = n - 1
		while st < end:
			if w[st] + w[end] == i:
				pair += 1
				st += 1
				end -= 1
			elif w[st] + w[end] < i:
				st += 1
			else:
				end -= 1
		ans = max([ans, pair])
	print(ans)


for _ in range(int(input())):
	n = int(input())
	a = [int(x) for x in input().split()]
	d = set()
	a.sort()
	for i in range(n - 1):
		for j in range(i + 1, n):
			d.add(a[i] + a[j])
	mx = 0
	for i in d:
		st = 0
		ed = n - 1
		ans = 0
		while st < ed:
			if a[st] + a[ed] > i:
				ed -= 1
			elif a[st] + a[ed] < i:
				st += 1
			else:
				ans += 1
				st += 1
				ed -= 1
		mx = max(mx, ans)
	print(mx)


import sys
sys.setrecursionlimit(10 ** 5)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep='\n')

def II():
	return int(sys.stdin.readline())

def MI():
	return map(int, sys.stdin.readline().split())

def LI():
	return list(map(int, sys.stdin.readline().split()))

def LLI(rows_number):
	return [LI() for _ in range(rows_number)]

def SI():
	return sys.stdin.readline()[:-1]
for _ in range(II()):
	n = II()
	aa = LI()
	aa.sort()
	ss = set()
	for i in range(n):
		for j in range(i):
			ss.add(aa[i] + aa[j])
	ans = 0
	for s in ss:
		cnt = 0
		i = 0
		j = n - 1
		while i < j:
			while i < j and aa[i] + aa[j] < s:
				i += 1
			if i == j:
				break
			while i < j and aa[i] + aa[j] > s:
				j -= 1
			if i == j:
				break
			if aa[i] + aa[j] == s:
				cnt += 1
				i += 1
				j -= 1
		ans = max(ans, cnt)
	print(ans)


from __future__ import division, print_function
from sys import stdin, stdout
import bisect
import math
import heapq
i_m = 9223372036854775807

def inin():
	return int(input())

def stin():
	return input()

def spin():
	return map(int, stin().split())

def lin():
	return list(map(int, stin().split()))

def matrix(n):
	return [list(map(int, input().split())) for i in range(n)]

def count2Dmatrix(i, list):
	return sum((c.count(i) for c in list))

def modinv(n, p):
	return pow(n, p - 2, p)

def GCD(x, y):
	x = abs(x)
	y = abs(y)
	if min(x, y) == 0:
		return max(x, y)
	while y:
		(x, y) = (y, x % y)
	return x

def Divisors(n):
	l = []
	for i in range(1, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n // i == i:
				l.append(i)
			else:
				l.append(i)
				l.append(n // i)
	return l
prime = []

def SieveOfEratosthenes(n):
	global prime
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	f = []
	for p in range(2, n):
		if prime[p]:
			f.append(p)
	return f
q = []

def dfs(n, d, v, c):
	global q
	v[n] = 1
	x = d[n]
	q.append(n)
	j = c
	for i in x:
		if i not in v:
			f = dfs(i, d, v, c + 1)
			j = max(j, f)
	return j
for _ in range(inin()):
	n = inin()
	a = lin()
	c = [a.count(i) for i in range(2 * n + 1)]
	ans = 0
	for s in range(2, 2 * n + 1):
		temp = 0
		for i in range(1, n + 1):
			j = s - i
			if i == j:
				temp += c[i] // 2
			elif i < j:
				temp += min(c[i], c[j])
			else:
				break
		ans = max(ans, temp)
	print(ans)


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	mp = dict()
	for i in range(n):
		for j in range(i + 1, n):
			s = arr[i] + arr[j]
			if s in mp:
				if i not in mp[s] and j not in mp[s]:
					mp[s].add(i)
					mp[s].add(j)
			else:
				mp[s] = set()
				mp[s].add(i)
				mp[s].add(j)
	ans = 0
	for i in mp:
		ans = max(ans, len(mp[i]) // 2)
	print(ans)


t = int(input())
for hh in range(0, t):
	n = int(input())
	a = [int(x) for x in input().split()]
	a.sort()
	mx = 0
	for i in range(0, n):
		for j in range(i + 1, n):
			st = i + 1
			en = j - 1
			su = a[i] + a[j]
			ans = 1
			while st < en:
				if a[st] + a[en] < su:
					st += 1
				elif a[st] + a[en] > su:
					en -= 1
				else:
					st += 1
					en -= 1
					ans += 1
			mx = max(mx, ans)
	print(mx)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	c = [0] * 51
	kq = [0] * 101
	for i in a:
		c[i] += 1
	for i in range(51):
		for j in range(i + 1, 51):
			kq[i + j] += min(c[i], c[j])
	for i in range(51):
		kq[i * 2] += c[i] // 2
	print(max(kq))


t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	weights = []
	for i in range(101):
		weights.append([])
	temp = input()
	temp = temp.split()
	w = [int(i) for i in temp]
	for i in range(n):
		for j in range(i + 1, n):
			temp = weights[w[i] + w[j]]
			if i in temp or j in temp:
				continue
			else:
				weights[w[i] + w[j]].append(i)
				weights[w[i] + w[j]].append(j)
	max_len = 0
	for i in range(2, 101):
		temp_len = len(weights[i])
		if temp_len > max_len:
			max_len = temp_len
	print(int(max_len / 2))


t = int(input())
while t:
	t = t - 1
	n = int(input())
	a = list(map(int, input().split()))
	d = dict()
	for i in a:
		d[i] = d.get(i, 0) + 1
	d1 = dict()
	for i in range(2, 101):
		d1[i] = 0
	out = 0
	for i in range(2, 101):
		m = d.copy()
		for j in a:
			p = i - j
			if m[j] > 0 and m.get(p, 0) > 0:
				if j != p or (j == p and m[j] > 1):
					d1[i] += 1
					m[p] -= 1
					m[j] -= 1
	out = max(d1.values())
	print(out)


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	v = 0
	f = 0
	s = 2
	while s <= 2 * n:
		i = 0
		j = n - 1
		while i < j:
			if l[i] + l[j] == s:
				f += 1
				i += 1
				j -= 1
			elif l[i] + l[j] > s:
				j -= 1
			elif l[i] + l[j] < s:
				i += 1
		if f > v:
			v = f
		f = 0
		s += 1
	print(v)


T = int(input())
for _ in range(T):
	n = int(input())
	a = list(map(int, input().split()))
	ans = [[0] * n] * n
	b = []
	for i in range(2 * n + 1):
		for j in range(2 * n + 1):
			temp = []
		b.append(temp)
	flag = 0
	for i in range(n):
		for j in range(i + 1, n):
			flag = 0
			p = a[i] + a[j]
			if i not in b[p] and j not in b[p]:
				b[p].append(i)
				b[p].append(j)
	m = 0
	for i in range(2 * n + 1):
		if len(b[i]) > m:
			m = len(b[i])
	print(m // 2)


import sys

def rs():
	return sys.stdin.readline().rstrip()

def ri():
	return int(sys.stdin.readline())

def ria():
	return list(map(int, sys.stdin.readline().split()))

def ws(s):
	sys.stdout.write(s)
	sys.stdout.write('\n')

def wi(n):
	sys.stdout.write(str(n))
	sys.stdout.write('\n')

def wia(a, sep=' '):
	sys.stdout.write(sep.join([str(x) for x in a]))
	sys.stdout.write('\n')

def solve(n, a):
	cnt = [0] * (2 * n + 1)
	d = {}
	for ai in a:
		if ai not in d:
			d[ai] = 0
		d[ai] += 1
	for s in range(2 * n + 1):
		taken = [False] * n
		dd = d.copy()
		for i in range(n):
			if taken[i]:
				continue
			x = a[i]
			y = s - a[i]
			if x == y:
				if x in dd and dd[x] > 1:
					cnt[s] += 1
					dd[x] -= 2
			elif x in dd and dd[x] > 0 and (y in dd) and (dd[y] > 0):
				cnt[s] += 1
				dd[x] -= 1
				dd[y] -= 1
	return max(cnt)

def main():
	for _ in range(ri()):
		n = ri()
		a = ria()
		wi(solve(n, a))
main()


from collections import Counter
t = int(input())
for _ in range(t):
	n = int(input())
	weights = [int(x) for x in input().split()]
	result = 0
	for target in range(1, 2 * n + 2):
		count = Counter(weights)
		tempResult = 0
		for w in weights:
			if count[target - w] >= 1 and count[w] >= 1:
				if target - w == w and count[w] < 2:
					continue
				count[target - w] -= 1
				count[w] -= 1
				tempResult += 1
		result = max(result, tempResult)
	print(result)


from sys import stdin, stdout, setrecursionlimit
from math import gcd, ceil, sqrt
from collections import Counter
from bisect import bisect_left, bisect_right
ii1 = lambda : int(stdin.readline().strip())
is1 = lambda : stdin.readline().strip()
iia = lambda : list(map(int, stdin.readline().strip().split()))
isa = lambda : stdin.readline().strip().split()
setrecursionlimit(100000)
mod = 1000000007
tc = ii1()
for _ in range(tc):
	n = ii1()
	arr = sorted(iia())
	if n < 2:
		print(0)
	else:
		sml = arr[0] + arr[1]
		big = arr[-1] + arr[-2]
		res = 0
		for cur in range(sml, big + 1):
			ele = arr[:]
			count = 0
			for i in range(len(arr)):
				a = cur - arr[i]
				b = arr[i]
				if a != b and a in ele and (b in ele):
					ele.remove(a)
					ele.remove(b)
					count += 1
				elif a == b and ele.count(a) > 1:
					ele.remove(a)
					ele.remove(b)
					count += 1
			res = max(res, count)
		print(res)


k = ''
for _ in ' ' * int(input()):
	a = int(input())
	ans = 0
	d = dict()
	for i in map(int, input().split()):
		d[i] = d.get(i, 0) + 1
	s = 100
	while s > 1:
		i = 1
		t = 0
		o = s // 2
		while i <= o:
			if i == s - i:
				t += d.get(i, 0) // 2
			elif d.get(i, 0) and d.get(s - i, 0):
				t += min(d.get(i, 0), d.get(s - i, 0))
			i += 1
		ans = max(ans, t)
		s -= 1
	k += str(ans) + '\n'
print(k)


T = int(input())
for _ in range(T):
	n = int(input())
	a = list(map(int, input().split()))
	act_ans = 0
	for i in range(2, 2 * n + 1):
		li = [0] * 51
		for j in range(n):
			li[a[j]] += 1
		ans = 0
		for j in range(n):
			if li[a[j]] != 0:
				x = a[j]
				y = i - a[j]
				if y <= n and y >= 0 and (li[y] != 0):
					if x != y or (x == y and li[x] >= 2):
						ans += 1
						li[x] -= 1
						li[y] -= 1
		act_ans = max(act_ans, ans)
	print(act_ans)


import sys
input = sys.stdin.readline

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

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())

def solve():
	n = inp()
	a = inlt()
	ans = 0
	a.sort()
	for s in range(0, 2 * n + 1):
		currAns = 0
		l = 0
		r = n - 1
		while l < r:
			if a[l] + a[r] == s:
				currAns += 1
				l += 1
				r -= 1
				continue
			if a[l] + a[r] < s:
				l += 1
				continue
			if a[l] + a[r] > s:
				r -= 1
				continue
		ans = max(ans, currAns)
	return ans
t = inp()
while t > 0:
	print(solve())
	t -= 1


def compute(l, sm, n):
	(i, j) = (0, n - 1)
	count = 0
	while i < j:
		s = l[i] + l[j]
		if sm > s:
			i += 1
		elif sm < s:
			j -= 1
		else:
			i += 1
			j -= 1
			count += 1
	return count
t = int(input())
while t > 0:
	n = int(input())
	l = sorted(map(int, input().split()))
	ans = 0
	for sm in range(1, 101):
		rt = compute(l, sm, n)
		ans = max(rt, ans)
	print(ans)
	t -= 1


from collections import Counter
for _ in range(int(input())):
	n = int(input())
	a = Counter(map(int, input().split()))
	ans = [0] * 101
	for i in a:
		for j in a:
			ans[i + j] += min(a[i], a[j])
	print(max(ans) // 2)


import itertools
import sys
from collections import defaultdict, Counter
from math import sqrt
input = sys.stdin.readline

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

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())

def s(d):
	dis = 1 + 4 * 2 * 3 * d
	ds = sqrt(dis)
	return (-1 + ds) / 6

def main():
	d = inp()
	for i in range(d):
		d1 = inp()
		v = inlt()
		dc = dict(Counter(v))
		mx = 0
		for j in range(2 * d1 + 1):
			m = 0
			for (k, vv) in dc.items():
				if k == j - k:
					m += vv
				else:
					vv2 = dc.get(j - k)
					if vv2:
						m += min(vv2, vv)
			mx = max(m, mx)
		print(mx // 2)
main()


def MaxCommands(a):
	max_com = 0
	a.sort()
	for s in range(2 * a[-1] + 1):
		current_com = 0
		(i, j) = (0, len(a) - 1)
		while i < j:
			if a[i] + a[j] == s:
				i += 1
				j -= 1
				current_com += 1
			elif a[i] + a[j] > s:
				j -= 1
			else:
				i += 1
		if current_com > max_com:
			max_com = current_com
	return max_com
t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	print(MaxCommands(a))


from sys import stdin

def getPairsCount(arr, n, sum):
	count = 0
	a2 = arr.copy()
	for i in range(0, n):
		if a2[i] != -99999:
			for j in range(i + 1, n):
				if arr[i] + a2[j] == sum:
					a2[j] = -99999
					count += 1
					break
	return count
for _ in range(int(stdin.readline().rstrip())):
	n = int(stdin.readline().rstrip())
	a = list(map(int, stdin.readline().rstrip().split(' ')))
	a.sort()
	if n == 1:
		print(0)
	else:
		max_sum = a[-2] + a[-1]
		min_sum = a[0] + a[1]
		if max_sum == min_sum:
			print(n // 2)
		else:
			mc = 0
			for i in range(min_sum, max_sum + 1):
				c = getPairsCount(a, n, i)
				if c > mc:
					mc = c
			print(mc)


test_cases = int(input())
while test_cases:
	num = int(input())
	player_cnt = [0] * (num + 1)
	player = list(map(int, input().strip().split()))
	for i in player:
		player_cnt[i] += 1
	teams = 0
	for j in range(2, 2 * num + 1):
		current_teams = 0
		for s in range(1, (j + 1) // 2):
			if j - s > num:
				continue
			current_teams += min(player_cnt[s], player_cnt[j - s])
		if j % 2 == 0:
			current_teams += player_cnt[j // 2] // 2
		teams = max(teams, current_teams)
	print(teams)
	test_cases -= 1


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
from collections import Counter
import heapq
from collections import Counter
for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	w = set()
	d = {}
	for i in range(n):
		for j in range(i + 1, n):
			w.add(arr[i] + arr[j])
	ls = list(w)
	ans = 0
	for i in ls:
		cnt = 0
		v = [0] * (n + 1)
		for j in range(n):
			for k in range(j + 1, n):
				if arr[j] + arr[k] == i:
					if v[k] == 0 and v[j] == 0:
						v[k] = 1
						v[j] = 0
						cnt += 1
						break
		ans = max(cnt, ans)
	print(ans)


from sys import stdin
for _ in range(int(input())):
	n = int(input())
	weightMap = {}
	weights = list(map(int, stdin.readline().split()))
	for w in weights:
		if w in weightMap:
			weightMap[w] += 1
		else:
			weightMap[w] = 1
	possiblePair = {}
	keys = list(weightMap.keys())
	ans = 0
	for i in range(len(keys)):
		p = keys[i]
		if weightMap[keys[i]] > 0:
			if 2 * p in possiblePair:
				possiblePair[2 * p] += weightMap[keys[i]] // 2
			else:
				possiblePair[2 * p] = weightMap[keys[i]] // 2
			ans = max(possiblePair[2 * p], ans)
		for j in range(i + 1, len(keys)):
			p = keys[i] + keys[j]
			add = min(weightMap[keys[i]], weightMap[keys[j]])
			if p in possiblePair:
				possiblePair[p] += add
			else:
				possiblePair[p] = add
			ans = max(ans, possiblePair[p])
	print(ans)


from collections import defaultdict, Counter
t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	di = dict(Counter(arr))
	m = defaultdict(set)
	for i in range(len(arr)):
		for j in range(i + 1, len(arr)):
			if arr[i] > arr[j]:
				m[arr[i] + arr[j]].add((arr[i], arr[j]))
			else:
				m[arr[i] + arr[j]].add((arr[j], arr[i]))
	ma = 0
	for (i, j) in m.items():
		tem = 0
		for ele in j:
			if ele[0] == ele[1]:
				tem += di[ele[0]] // 2
			else:
				tem += min(di[ele[0]], di[ele[1]])
		ma = max(ma, tem)
	print(ma)


for _ in range(int(input())):
	input()
	w = list(map(int, input().split()))
	weight_classes = [0 for _ in range(110)]
	visited_weight_classes = [[False for _ in range(55)] for _ in range(55)]
	for i in range(len(w)):
		for k in range(i + 1, len(w)):
			if not visited_weight_classes[i][w[k]] and (not visited_weight_classes[k][w[i]]):
				weight_classes[w[i] + w[k]] += 1
				visited_weight_classes[i][w[k]] = True
				visited_weight_classes[k][w[i]] = True
	print(max(weight_classes))


def process(w, n):
	ans = 0
	for wt in range(2, 2 * n + 1):
		cnt = 0
		i = 0
		j = n - 1
		while i < j:
			s = w[i] + w[j]
			if s == wt:
				cnt += 1
				i += 1
				j -= 1
			elif s > wt:
				j -= 1
			else:
				i += 1
		ans = max(ans, cnt)
	return ans
for t in range(int(input())):
	n = int(input())
	w = [int(k) for k in input().split()]
	w.sort()
	print(process(w, n))


from collections import defaultdict as dc

def solv():
	mp = dc(lambda : 0)
	x = int(input())
	s = list(map(int, input().split()))
	if x == 1:
		print(0)
		return
	for n in s:
		mp[n] += 1
	s.sort()
	mx = s[-1] + s[-2]
	mn = s[0] + s[1]
	res = 0
	for n in range(mn, mx + 1):
		tm = 0
		for a in range(1, n + 1):
			v = min(mp[a], mp[n - a])
			if a == n - a:
				v = mp[a]
			tm += v
		res = max(res, tm // 2)
	print(res)
for _ in range(int(input())):
	solv()


from collections import *
t = int(input())

def trry(s):
	dd = defaultdict(lambda : 0)
	c = 0
	for i in wi:
		x = s - i
		if x == i:
			if co[i] - dd[i] >= 2:
				c += 1
				dd[i] += 2
			else:
				continue
		elif x in co and dd[i] < co[i] and (dd[x] < co[x]):
			c += 1
			dd[i] += 1
			dd[x] += 1
	return c
for _ in range(t):
	n = int(input())
	wi = list(map(int, input().split()))
	if n <= 3:
		if n == 1:
			print(0)
		else:
			print(1)
	else:
		maxn = 0
		ma = 2 * max(wi)
		co = Counter(wi)
		for s in range(1, ma + 1):
			maxn = max(maxn, trry(s))
		print(maxn)


from collections import Counter
for _ in range(int(input())):
	n = int(input())
	nums = Counter(list(map(int, input().split())))
	maxnum = 0
	lol = {}
	rnd = []
	for i in nums.keys():
		rnd.append(i)
	for i in range(len(rnd)):
		try:
			lol[rnd[i] * 2] += nums[rnd[i]] // 2
		except:
			lol[rnd[i] * 2] = nums[rnd[i]] // 2
		for j in range(i + 1, len(rnd)):
			exc = min(nums[rnd[j]], nums[rnd[i]])
			try:
				lol[rnd[i] + rnd[j]] += exc
			except:
				lol[rnd[i] + rnd[j]] = exc
	pairs = 0
	for i in lol:
		pairs = max(pairs, lol[i])
	print(pairs)


import sys, bisect
input = sys.stdin.readline
T = int(input())
for testcase in range(T):
	n = int(input())
	w = list(map(int, input().split()))
	w.sort()
	res = 0
	for s in range(2, 2 * n + 1):
		used = [True] * n
		b = [0] * n
		for i in range(n):
			b[i] = w[i]
		tmp = 0
		if s % 2 == 0:
			tmp += (bisect.bisect_right(b, s // 2) - bisect.bisect_left(b, s // 2)) // 2
		for i in range(n):
			if used[i] and b[i] * 2 != s:
				k = bisect.bisect_left(b, s - b[i])
				if k < n and b[k] + b[i] == s and used[k]:
					used[i] = False
					used[k] = False
					tmp += 1
					b[k] -= 1
		res = max(res, tmp)
	print(res)


import sys

def is_in(num):
	left = 0
	right = len(weight)
	while left < right:
		mid = (left + right) // 2
		if weight[mid] < num:
			left = mid + 1
		elif weight[mid] > num:
			right = mid
		else:
			return True
	return False

def check(num):
	left = dict().fromkeys(set(weight), 0)
	team = 0
	for i in weight:
		left[i] += 1
	for now in weight:
		if left[now] < 1:
			continue
		candidate = num - now
		if candidate <= 0:
			continue
		if is_in(candidate):
			if candidate == now:
				if left[now] < 2:
					continue
				team += 1
				left[now] -= 2
			elif left[candidate] < 1 or left[now] < 1:
				continue
			else:
				team += 1
				left[candidate] -= 1
				left[now] -= 1
	return team
tc = int(sys.stdin.readline())
for _ in range(tc):
	n = int(sys.stdin.readline())
	weight = list(map(int, sys.stdin.readline().split()))
	weight.sort()
	ans = 0
	for i in range(1, 151):
		ans = max(ans, check(i))
	print(ans)


def check_pairs(a, x):
	count = 0
	start = 0
	end = n - 1
	while start < end:
		if a[start] + a[end] == x:
			count += 1
			start += 1
			end -= 1
		elif a[start] + a[end] > x:
			end -= 1
		else:
			start += 1
	return count
for _ in range(int(input())):
	n = int(input())
	a = [int(i) for i in input().split()]
	a.sort()
	b = []
	for i in range(2, 2 * n + 1):
		b.append(check_pairs(a, i))
	print(max(b))


t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	ans = 0
	arr.sort()
	for s in range(2, 105):
		i = 0
		j = n - 1
		count = 0
		while i < j:
			temp = arr[i] + arr[j]
			if temp == s:
				count += 1
				i += 1
				j -= 1
			elif temp > s:
				j -= 1
			else:
				i += 1
		ans = max(ans, count)
	print(ans)


def calc(w, n, m):
	(i, j) = (0, n - 1)
	r = 0
	while i < j:
		if w[i] + w[j] == m:
			r += 1
			i += 1
			j -= 1
		elif w[i] + w[j] < m:
			i += 1
		else:
			j -= 1
	return r
T = int(input())
for t in range(T):
	n = int(input())
	w = [int(x) for x in input().split()]
	assert len(w) == n
	w = sorted(w)
	r = max([calc(w, n, i + 1) for i in range(2 * n)])
	print(r)


for t in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	if n == 1:
		print('0')
	else:
		a.sort()
		b = [0] * (a[-1] + 1)
		m = 1
		for i in range(n):
			b[a[i]] += 1
		for s in range(a[0] + a[1], a[-1] + a[-2] + 1):
			c = 0
			for j in range(a[0], s // 2 + 1):
				k = s - j
				if k <= a[-1]:
					if k != j:
						c += min(b[j], b[k])
					else:
						c += b[j] // 2
			if c > m:
				m = c
		print(m)


from collections import defaultdict
t = int(input())
for _ in range(t):
	n = int(input())
	weights = list(map(int, input().split()))
	if n == 1:
		print(0)
		continue
	s_freq = defaultdict(int)
	for i in range(n):
		for j in range(i + 1, n):
			s = weights[i] + weights[j]
			if s not in s_freq:
				pairs = []
				for x in range(n):
					for y in range(x + 1, n):
						if weights[x] + weights[y] == s:
							if x not in pairs:
								if y not in pairs:
									pairs.append(x)
									pairs.append(y)
									s_freq[weights[i] + weights[j]] += 1
	print(max(s_freq.values()))


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	count = 0
	for i in range(2 * a[0], 2 * a[n - 1] + 1):
		check = [0 for o in range(n)]
		counti = 0
		for p in range(n):
			k = i - a[p]
			if check[p] == 0:
				for j in range(n):
					if p == j:
						continue
					else:
						if a[j] == k and check[j] == 0:
							check[j] = 1
							check[p] = 1
							counti += 1
							break
						if a[j] > k:
							break
		count = max(count, counti)
	print(count)


def pairCount(rsum, num):
	c = 0
	for i in num:
		if rsum - i > 0:
			if rsum - i in num:
				c += min(num[i], num[rsum - i])
	return c // 2
t = int(input())
for tc in range(t):
	n = int(input())
	num = [int(x) for x in input().strip().split()]
	numcount = {}
	for i in num:
		if i in numcount:
			numcount[i] += 1
		else:
			numcount[i] = 1
	minm = min(numcount.keys())
	maxm = max(numcount.keys())
	ans = 0
	for i in range(2 * minm, 2 * maxm + 1):
		ans = max(ans, pairCount(i, numcount))
	print(ans)


def most_frequent(List):
	return max(set(List), key=List.count)

def find_pairs(alist, item):
	left = 0
	right = len(alist) - 1
	pairs = []
	while left < right:
		sum = alist[left] + alist[right]
		if sum == item:
			pairs += [(alist[left], alist[right])]
			right -= 1
			left += 1
		elif sum > item:
			right -= 1
		else:
			left += 1
	return pairs
t = int(input())
for i in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	arr = sorted(arr)
	arrs = []
	ans = 0
	for i in range(2, 101):
		ans = max(ans, len(find_pairs(arr, i)))
	print(ans)


cases = int(input())
for i in range(cases):
	n = int(input())
	l2 = input().split(' ')
	arr = []
	for a in l2:
		arr.append(int(a))
	if len(arr) == 1:
		print(0)
		continue
	if len(arr) == 2 or len(arr) == 3:
		print(1)
		continue
	teams = []
	mi = min(arr)
	copy2 = arr[:]
	copy2.sort()
	ma = copy2[-1] + copy2[-2]
	for j in range(mi + 1, ma + 1):
		copy = arr[:]
		t = 0
		while copy:
			weight = copy[0]
			need = j - weight
			if weight in copy:
				copy.remove(weight)
				if need in copy:
					copy.remove(need)
					t += 1
		teams.append(t)
	print(max(teams))


ll = lambda : map(int, input().split())
t = lambda : int(input())
ss = lambda : input()
lx = lambda x: map(int, input().split(x))
for _ in range(t()):
	n = t()
	a = list(ll())
	d = {}
	v = {}
	for i in range(n):
		for j in range(i + 1, n):
			if a[i] + a[j] not in d:
				d[a[i] + a[j]] = 1
				v[a[i] + a[j]] = [(i, j)]
			else:
				flag = 1
				for k in v[a[i] + a[j]]:
					if i in k or j in k:
						flag = 0
						break
				if flag:
					v[a[i] + a[j]].append((i, j))
					d[a[i] + a[j]] += 1
	try:
		print(max(d.values()))
	except:
		print(0)


from copy import deepcopy as dc
for t in range(int(input())):
	n = int(input())
	wt = [int(y) for y in input().strip().split()]
	lb = max(wt) + min(wt)
	f = {}
	for i in range(1, n + 1):
		f[i] = wt.count(i)
	dn = set()

	def go(s):
		ff = dc(f)
		x = 0
		for j in ff:
			if s - j not in ff:
				continue
			addl = min(ff[j], ff[s - j]) if j != s - j else ff[j] // 2
			x += addl
			ff[j] -= addl
			ff[s - j] -= addl
		return x
	mx = 0
	for i in range(n):
		for j in range(n):
			if wt[i] + wt[j] not in dn:
				dn.add(wt[i] + wt[j])
				mx = max(mx, go(wt[i] + wt[j]))
	print(mx)


for tt in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	d = {}
	d1 = {}
	for i in range(n):
		for j in range(i + 1, n):
			d[l[i] + l[j]] = 0
	for i in l:
		try:
			d1[i] += 1
		except:
			d1[i] = 1
	for i in d1:
		if d1[i] >= 2:
			d[2 * i] += d1[i] // 2
	l1 = list(set(l))
	for i in range(len(l1)):
		for j in range(i + 1, len(l1)):
			d[l1[i] + l1[j]] += min(d1[l1[i]], d1[l1[j]])
	ans = 0
	for i in d.values():
		ans = max(ans, i)
	print(ans)


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	ma = 0
	for ele in range(1, 101):
		c = 0
		i = 0
		j = n - 1
		while i < j:
			if l[i] + l[j] == ele:
				c += 1
				i += 1
				j = j - 1
			elif l[i] + l[j] > ele:
				j -= 1
			else:
				i += 1
		ma = max(ma, c)
	print(ma)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	dsum = {}
	a.sort()
	for i in range(n):
		for j in range(i + 1, n):
			s = a[i] + a[j]
			if s not in dsum:
				dsum[s] = []
			if i not in dsum[s] and j not in dsum[s]:
				dsum[s].append(i)
				dsum[s].append(j)
	maxl = 0
	for i in dsum:
		maxl = max(maxl, len(dsum[i]) // 2)
	print(maxl)


t = int(input())
while t != 0:
	sums = []
	n = int(input())
	lst = list(map(int, input().split()))
	for i in range(n - 1):
		for j in range(i + 1, n):
			if lst[i] + lst[j] not in sums:
				sums.append(lst[i] + lst[j])
	lst.sort()
	maxi = 0
	for i in range(len(sums)):
		count = 0
		l = 0
		r = n - 1
		while l < r:
			if lst[l] + lst[r] > sums[i]:
				r -= 1
			elif lst[l] + lst[r] < sums[i]:
				l += 1
			else:
				count += 1
				l += 1
				r -= 1
		if i == 0:
			maxi = count
		elif maxi < count:
			maxi = count
	print(maxi)
	t -= 1


from sys import stdin, stdout
from collections import Counter
for _ in range(int(stdin.readline())):
	n = int(stdin.readline())
	f = 1
	a = list(map(int, stdin.readline().split()))
	freq = Counter(a)
	d = {}
	w = list(freq.keys())
	nn = len(w)
	for i in range(nn):
		for j in range(i + 1, nn):
			(v, v1) = (w[i], w[j])
			d[v + v1] = d.get(v + v1, 0) + min(freq[v], freq[v1])
	for (k, v) in freq.items():
		d[2 * k] = d.get(2 * k, 0) + v // 2
	ans = max((v for (k, v) in d.items()))
	print(ans)


from collections import Counter
tot = int(input().strip())
while tot > 0:
	n = int(input().strip())
	w = [int(x) for x in input().strip().split(' ')]
	mw = min(w)
	ts = sum(w)
	cnt = 0
	mt = 0
	vs = set()
	for i in range(0, n):
		for j in range(i + 1, n):
			vs.add(w[i] + w[j])
	for t in vs:
		cnt = Counter(w)
		cur = 0
		for i in range(0, n):
			if w[i] != t - w[i] and cnt[w[i]] and cnt[t - w[i]] or (w[i] == t - w[i] and cnt[w[i]] >= 2):
				cur += 1
				cnt[w[i]] -= 1
				cnt[t - w[i]] -= 1
		mt = max(cur, mt)
	print(mt)
	tot -= 1


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	result = 0
	for i in range(2, 101):
		c = 0
		lst = [0 for i in range(n)]
		for j in range(n):
			if lst[j]:
				continue
			for k in range(n):
				if k == j:
					continue
				if not lst[k] and (not lst[j]):
					if l[j] + l[k] == i:
						c += 1
						(lst[j], lst[k]) = (1, 1)
						break
			lst[j] = 1
		result = max(result, c)
	print(result)


I = input
for _ in range(int(I())):
	n = int(I())
	a = list(map(int, I().split()))
	a.sort()
	ans = 0
	d = dict()
	for i in range(n):
		for j in range(i + 1, n):
			if i == j:
				continue
			t = a[i] + a[j]
			if t in d:
				d[t] += 1
			else:
				d[t] = 1
	sums = list(d.keys())
	used = dict()
	for ts in sums:
		t = 0
		for i in range(n):
			if i in used:
				continue
			if a[i] >= ts:
				break
			for j in range(i + 1, n):
				if j in used:
					continue
				if a[j] >= ts:
					break
				if a[i] + a[j] == ts:
					used[i] = 1
					used[j] = 1
					t += 1
					break
		used.clear()
		ans = max(ans, t)
	print(ans)


def find(s, a, n):
	l = 0
	r = n - 1
	cnt = 0
	while l < r:
		if a[l] + a[r] == s:
			cnt += 1
			l += 1
			r -= 1
		elif a[l] + a[r] > s:
			r -= 1
		else:
			l += 1
	return cnt
t = int(input())
for _ in range(t):
	n = int(input())
	a = [int(x) for x in input().split()]
	if n == 1:
		print('0')
	else:
		a.sort()
		mins = a[0] + a[1]
		maxs = a[n - 2] + a[n - 1]
		ans = 0
		for i in range(mins, maxs + 1):
			ans = max(ans, find(i, a, n))
		print(ans)


import os, sys
from io import BytesIO, IOBase
from collections import Counter

def main():
	for _ in range(int(input())):
		n = int(input())
		w = Counter(map(int, input().split()))
		ans = 0
		for i in range(2, 101):
			ans1 = 0
			for x in range(1, i // 2 + 1):
				if w.get(i - x) and w.get(x):
					if 2 * x == i:
						ans1 += w[x] // 2
					else:
						ans1 += min(w[x], w[i - x])
			ans = max(ans, ans1)
		print(ans)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


import math
a = int(input())
arr = []

def find(su):
	ass = 0
	crr = arr[:]
	p1 = 0
	p2 = len(arr) - 1
	while p1 < p2:
		if crr[p2] + crr[p1] < su:
			p1 = p1 + 1
		elif crr[p2] + crr[p1] > su:
			p2 = p2 - 1
		else:
			p1 = p1 + 1
			p2 = p2 - 1
			ass = ass + 1
	return ass
for i in range(0, a):
	b = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	d = []
	for i in range(0, len(arr)):
		for j in range(i + 1, len(arr)):
			d.append(arr[i] + arr[j])
	s = set(d)
	ans = []
	for i in s:
		ans.append(find(i))
	if len(ans) == 0:
		print(0)
	else:
		print(max(ans))


t = int(input())
while t > 0:
	n = int(input())
	ar = list(map(int, input().split()))
	mp = [0] * (2 * n + 1)
	for i in ar:
		mp[i] += 1
	ans = -1
	for i in range(2, 2 * n + 1):
		curr = 0
		for j in range(1, (i - 1) // 2 + 1):
			curr += min(mp[j], mp[i - j])
		if i % 2 == 0:
			curr += mp[i // 2] // 2
		ans = max(ans, curr)
	print(ans)
	t -= 1


import sys
input = sys.stdin.readline

def name(arr, n):
	maximum2 = 0
	arr.sort()
	for ele in range(2, 101):
		count = 0
		lp = 0
		rp = len(arr) - 1
		while lp < rp:
			if arr[lp] + arr[rp] < ele:
				lp += 1
			elif arr[lp] + arr[rp] > ele:
				rp -= 1
			else:
				count += 1
				lp += 1
				rp -= 1
		if count > maximum2:
			maximum2 = count
	return maximum2

def solution():
	n = int(input())
	arr = list(map(lambda x: int(x), input().split()))
	print(name(arr, n))
t = int(input())
for i in range(0, t):
	solution()


tests = int(input())
for t in range(tests):
	n = int(input())
	arr = list(map(int, input().split()))
	arr = sorted(arr)
	poss_dict = {}
	for (idx_1, item_1) in enumerate(arr):
		poss_set = set()
		for (idx_2, item_2) in enumerate(arr):
			if idx_2 != idx_1:
				poss_set.add(item_1 + item_2)
		for item in list(poss_set):
			if item in poss_dict:
				poss_dict[item] += 1
			else:
				poss_dict[item] = 1
	max_count = 0
	arr_dict = {}
	for item in arr:
		if item in arr_dict:
			arr_dict[item] += 1
		else:
			arr_dict[item] = 1
	for total in poss_dict.keys():
		arr_dict_curr = arr_dict.copy()
		count = 0
		for item_1 in arr:
			item_2 = total - item_1
			if item_2 in arr_dict_curr:
				if item_1 == item_2:
					if arr_dict_curr[item_1] > 1:
						arr_dict_curr[item_2] -= 2
						count += 1
				elif arr_dict_curr[item_2] > 0 and arr_dict_curr[item_1] > 0:
					arr_dict_curr[item_2] -= 1
					arr_dict_curr[item_1] -= 1
					count += 1
			if count > max_count:
				max_count = count
	print(max_count)


t = int(input())
for z in range(t):
	n = int(input())
	b = list(map(int, input().split()))
	a = []
	for i in b:
		a.append([i, 0])
	s1 = sum(b)
	a.sort()
	arr = [0] * (s1 + 1)
	for i in range(n):
		for j in range(i + 1, n):
			s = 0
			s += a[i][0] + a[j][0]
			if a[i][1] != s and a[j][1] != s:
				a[i][1] = s
				a[j][1] = s
				arr[s] += 1
	print(max(arr))


from collections import defaultdict as dd
t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	if n == 1:
		print(0)
		continue
	l.sort()
	minsum = l[0] + l[1]
	maxsum = l[-1] + l[-2]
	max_list = []
	for s in range(minsum, maxsum + 1):
		count = 0
		d = dd(int)
		for i in range(n):
			d[l[i]] += 1
		for i in range(n):
			if s - l[i] in d:
				if d[l[i]] > 0:
					d[l[i]] -= 1
					if d[s - l[i]] > 0:
						d[s - l[i]] -= 1
						count += 1
		max_list.append(count)
	print(max(max_list))


import sys
read = sys.stdin.readline
write = sys.stdout.write
test_case = int(read())
for t in range(test_case):
	n = int(read())
	w = list(map(int, read().split()))
	wl = [0 for i in range(51)]
	result = 0
	for i in w:
		wl[i] += 1
	for d in range(2, 101):
		dwl = wl[:]
		cnt = 0
		for i in range(1, 51):
			for j in range(i, 51):
				if i + j != d:
					continue
				if i == j:
					cnt += dwl[i] // 2
					dwl[i] %= 2
					continue
				val = min(dwl[i], dwl[j])
				cnt += val
				dwl[i] -= val
				dwl[j] -= val
		result = max(result, cnt)
	write('{}\n'.format(result))


number_tests = int(input())
for _ in range(number_tests):
	number_participants = int(input())
	liste_weight = sorted([int(w) for w in input().split()])
	max_teams = 0
	for i0 in range(number_participants):
		for j0 in range(number_participants - 1, i0, -1):
			poids = liste_weight[i0] + liste_weight[j0]
			number_team = 1
			i = i0 + 1
			j = j0 - 1
			while i < j and (j - i) // 2 + 1 + number_team > max_teams:
				poid = liste_weight[i] + liste_weight[j]
				if poid == poids:
					i += 1
					j -= 1
					number_team += 1
				elif poid < poids:
					i += 1
				else:
					j -= 1
			if number_team > max_teams:
				max_teams = number_team
	print(max_teams)


import bisect
T = int(input())
for t in range(T):
	N = int(input())
	w = list(map(int, input().split()))
	cnt = [0] * (N + 1)
	for wi in w:
		cnt[wi] += 1
	best = 0
	for s in range(2 * max(w) + 1):
		pairs = 0
		for i in range(1, (s + 1) // 2):
			if s - i > N:
				continue
			pairs += min(cnt[i], cnt[s - i])
		if s % 2 == 0:
			pairs += cnt[s // 2] // 2
		best = max(best, pairs)
	print(best)


for _ in range(int(input())):
	n = int(input())
	cnt = [0] * 210
	for x in list(map(int, input().split())):
		cnt[x] += 1
	ans = 0
	ansc = 0
	for s in range(200):
		c = 0
		for i in range(int((s + 1) / 2)):
			c += min(cnt[i], cnt[s - i])
		if s % 2 == 0:
			c += int(cnt[int(s / 2)] / 2)
		if c > ansc:
			ans = s
			ansc = c
	print(ansc)


a = []
for _ in range(int(input())):
	input()
	a.append(list(map(int, input().split())))
for a in a:
	dict = {}
	for row in a:
		dict.setdefault(row, 0)
		dict[row] += 1
	a = list(set(a))
	res = {}
	for i in range(len(a)):
		for j in range(i, len(a)):
			res.setdefault(a[i] + a[j], 0)
			if i == j:
				res[a[i] * 2] += dict[a[i]] // 2
			else:
				res[a[i] + a[j]] += min(dict[a[i]], dict[a[j]])
	print(max(res.values()))


t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	ans = 0
	for i in range(2 * min(l), 2 * max(l) + 1):
		wd = {}
		for j in l:
			if j in wd:
				wd[j] += 1
			else:
				wd[j] = 1
		cur = 0
		for j in l:
			if i - j in wd and wd[i - j] > 0 and (wd[j] > 0):
				if j == i - j:
					if wd[j] >= 2:
						cur += 1
						wd[j] -= 2
				else:
					cur += 1
					wd[j] -= 1
					wd[i - j] -= 1
		ans = max(ans, cur)
	print(ans)


t = int(input())
for _ in range(t):
	n = int(input())
	arr = [int(i) for i in map(int, input().split())]
	arr.sort()
	ans = 0
	for i in range(n):
		for j in range(i + 1, n):
			s = arr[i] + arr[j]
			I = i
			J = j
			total = 0
			while I >= 0 and J < n:
				temp = s - (arr[I] + arr[J])
				if temp <= 0:
					I -= 1
				if temp >= 0:
					J += 1
				if temp == 0:
					total += 1
			ans = max(ans, total)
	print(ans)


for b in range(int(input())):
	n = int(input())
	w = list(map(int, input().split()))
	w2 = sorted(w)
	l = []
	for i in range(2, 2 * n + 1):
		c = 0
		t = [1 for j in range(n)]
		for j in range(n):
			if i > w[j] and t[j] == 1:
				for k in range(j + 1, n):
					if t[k] == 1 and w[k] + w[j] == i:
						t[k] = 0
						t[j] = 0
						c += 1
						break
		l.append(c)
	print(max(l))


from sys import *
input = stdin.readline
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	p = {}
	a.sort()
	d = {}
	for i in range(105):
		d[i] = {}
	for i in range(n):
		for j in range(i + 1, n):
			s = a[i] + a[j]
			if d[s].get(i, 0) == 1 or d[s].get(j, 0) == 1:
				continue
			else:
				p[s] = p.get(s, 0) + 1
				d[s][i] = 1
				d[s][j] = 1
	mx = 0
	for (i, j) in p.items():
		mx = max(mx, j)
	stdout.write(str(mx) + '\n')


from fractions import Fraction
import bisect
import os
import io
from collections import Counter
import bisect
from collections import defaultdict
import math
import random
import heapq as hq
from math import sqrt
import sys
from functools import reduce, cmp_to_key
from collections import deque
import threading
from itertools import combinations
from io import BytesIO, IOBase
from itertools import accumulate
from queue import Queue

def input():
	return sys.stdin.readline().strip()

def iinput():
	return int(input())

def tinput():
	return input().split()

def rinput():
	return map(int, tinput())

def rlinput():
	return list(rinput())
mod = int(1000000000.0) + 7

def factors(n):
	return set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0)))
t = 1
t = iinput()
for _ in range(t):
	n = iinput()
	a = sorted(rlinput())
	ans = 0
	for target in range(1, 2 * a[-1] + 1):
		found = 0
		i = 0
		j = n - 1
		while i < j:
			if a[i] + a[j] == target:
				found += 1
				i += 1
				j -= 1
			elif a[i] + a[j] < target:
				i += 1
			else:
				j -= 1
		ans = max(found, ans)
	print(ans)


import sys
t = int(sys.stdin.readline())
while t:
	n = int(sys.stdin.readline())
	w = [int(wi) for wi in sys.stdin.readline().split()]
	a = [0] * (n + 1)
	for i in w:
		a[i] += 1
	ans = 0
	for s in range(2, 2 * n + 1):
		cur = 0
		for i in range(1, (s + 1) // 2):
			if s - i > n:
				continue
			cur += min(a[i], a[s - i])
		if s % 2 == 0:
			cur += a[s // 2] // 2
		ans = max(ans, cur)
	sys.stdout.write(str(ans) + '\n')
	t -= 1


import sys
si = sys.stdin.readline

def main():
	t = int(si())
	while t:
		t -= 1
		n = int(si())
		l = [int(e) for e in si().split()]
		if n == 1:
			print(0)
			continue
		l.sort()
		m = l[0] + l[1]
		M = l[-2] + l[-1]
		vmapo = dict()
		for e in l:
			if e not in vmapo:
				vmapo[e] = 1
			else:
				vmapo[e] += 1
		ans = 0
		for v in range(m, M + 1):
			vmap = dict(vmapo)
			cnt = 0
			for i in range(1, v):
				if i in vmap and v - i in vmap:
					cnt += min(vmap[i], vmap[v - i])
			cnt //= 2
			ans = max(ans, cnt)
		print(ans)
main()


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	d = {}
	for x in a:
		if x not in d:
			d[x] = 1
		else:
			d[x] += 1
	ans = 0
	for i in range(1, 101):
		dt = d.copy()
		s = 0
		for j in a:
			if dt[j] <= 0:
				continue
			if i - j in dt and dt[i - j] > 0:
				if j == i - j:
					if dt[j] < 2:
						continue
				s += 1
				dt[i - j] -= 1
				dt[j] -= 1
		ans = max(s, ans)
	print(ans)


import math
from sys import stdin, stdout
from collections import defaultdict

def maxCountSameSUM(arr, n):
	M = defaultdict(list)
	N = defaultdict(int)
	for i in range(n - 1):
		for j in range(i + 1, n):
			if i not in M[arr[i] + arr[j]] and j not in M[arr[i] + arr[j]]:
				M[arr[i] + arr[j]].append(i)
				M[arr[i] + arr[j]].append(j)
				N[arr[i] + arr[j]] += 1
	max_count = 0
	for ele in N:
		max_count = max(max_count, N[ele])
	return max_count
for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	print(maxCountSameSUM(l, n))


for _ in range(int(input())):
	n = int(input())
	arr1 = [int(num) for num in input().split(' ')]
	arr1.sort()
	if n == 1:
		print(0)
	else:
		ans = -1
		l = arr1[0] + arr1[1]
		r = arr1[-1] + arr1[-2]
		for i in range(l, r + 1):
			arr = arr1.copy()
			x = 0
			j = 0
			while j < n:
				try:
					a = i - arr[j]
				except:
					j = j + 1
					continue
				for k in range(j + 1, n):
					if arr[k] == a:
						arr[k] = '@'
						arr[j] = '@'
						x = x + 1
						break
				j = j + 1
			ans = max(ans, x)
		print(ans)


from collections import defaultdict

def solve(N, weights):
	k = 0
	memo = defaultdict(list)
	memo1 = defaultdict(lambda : 0)
	answer = 0
	for i in range(N - 1):
		for j in range(i + 1, N):
			currentWeight = weights[i]
			nextWeight = weights[j]
			memo[currentWeight + nextWeight].append([i, j])
	for key in memo.keys():
		current = memo[key]
		temp = 0
		vis = [False] * N
		for i in range(len(current)):
			if vis[current[i][0]] == False and vis[current[i][1]] == False:
				temp += 1
				vis[current[i][0]] = True
				vis[current[i][1]] = True
		answer = max(answer, temp)
	return answer
testCases = int(input())
for case in range(testCases):
	N = int(input())
	weights = list(map(int, input().split()))
	print(solve(N, weights))


for _ in range(int(input())):
	n = int(input())
	w = list(map(int, input().split()))
	mapp = [0 for x in range(n + 1)]
	for x in w:
		mapp[x] += 1
	finalcount = 0
	for wt in range(2, 2 * n + 1):
		less = 1
		more = wt - less
		count = 0
		while less <= more:
			if more > n:
				less += 1
				more -= 1
				continue
			if less == more:
				count += mapp[less] // 2
			else:
				count += min(mapp[less], mapp[more])
			less += 1
			more -= 1
		finalcount = max(count, finalcount)
	print(finalcount)


from collections import Counter
for _ in range(int(input())):
	s = int(input())
	p = Counter(map(int, input().split()))
	t = [0] * 101
	for i in p:
		for j in p:
			t[i + j] += min(p[i], p[j])
	print(max(t) // 2)


t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	d = {}
	for i in l:
		try:
			d[i] += 1
		except:
			d[i] = 1
	ans = 0
	for i in range(2, 101):
		c = 0
		for j in range(i // 2 + 1):
			try:
				if j == i - j:
					c += d[j] // 2
				else:
					c += min(d[j], d[i - j])
			except:
				pass
		ans = max(ans, c)
	print(ans)


t = int(input())
for _ in range(t):
	n = int(input())
	list1 = list(map(int, input().strip().split()))
	list1.sort()
	x = min(list1)
	y = max(list1)
	max_team = 0
	for s in range(2 * x, 2 * y + 1):
		temp = []
		for val in list1:
			temp.append(val)
		team = 0
		while 1:
			if len(temp) == 0:
				break
			a = temp[0]
			b = s - temp[0]
			if b in temp[1:len(temp)]:
				temp.remove(a)
				temp.remove(b)
				team += 1
			else:
				temp.remove(a)
		if team > max_team:
			max_team = team
	print(max_team)


from collections import defaultdict
import itertools
import statistics
t = int(input())
for _ in range(t):
	n = int(input())
	w = list(map(int, input().split()))
	if len(w) == 1:
		print(0)
		continue
	elif len(w) == 2:
		print(1)
		continue
	w.sort()
	x = w[-1] + w[-2]
	maxi = 0
	q = len(w)
	for i in range(x + 1):
		visited = [0] * q
		ans = 0
		for j in range(q):
			for k in range(j + 1, q):
				if w[j] + w[k] == i and visited[j] == 0 and (visited[k] == 0):
					ans += 1
					visited[j] = 1
					visited[k] = 1
		maxi = max(maxi, ans)
	print(maxi)


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	d = dict()
	for i in range(n - 1):
		for j in range(i + 1, n):
			a = l[i] + l[j]
			d.setdefault(a, [])
			if i not in d[a] and j not in d[a]:
				d[a].append(i)
				d[a].append(j)
	max1 = 0
	for v in d.values():
		if len(v) // 2 > max1:
			max1 = len(v) // 2
	print(max1)


def ip():
	return int(input())

def sip():
	return input()

def mip():
	return map(int, input().split())

def lip():
	return list(map(int, input().split()))

def matip(n, m):
	lst = []
	for i in range(n):
		arr = lip()
		lst.append(arr)
	return lst
import collections
t = ip()
while t:
	t -= 1
	n = ip()
	arr = lip()
	arr.sort()
	result = collections.defaultdict(list)
	for (i, a) in enumerate(arr):
		for j in range(i + 1, n):
			if i not in result[a + arr[j]] and j not in result[a + arr[j]]:
				result[a + arr[j]].append(i)
				result[a + arr[j]].append(j)
	z = 0
	for item in result:
		v = len(set(result[item])) // 2
		if v > z:
			z = v
	print(z)


import math
t = int(input())
for _ in range(t):
	n = int(input())
	a = [0] * (n + 1)
	arr = [int(x) for x in input().split()]
	for x in arr:
		a[x] += 1
	res = 0
	for i in range(2, 2 * n + 1):
		c = 0
		for j in range(1, (i + 1) // 2):
			if i - j > n:
				continue
			c += min(a[j], a[i - j])
		if i % 2 == 0:
			c += a[i // 2] // 2
		res = max(res, c)
	print(res)


import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	n = int(input())
	w = list(map(int, input().split()))
	ww = [0] * (n + 1)
	for i in w:
		ww[i] += 1
	ans = 0
	for s in range(2, 2 * n + 1):
		cnt = 0
		for i in range(1, s):
			j = s - i
			if i > j or j > n:
				continue
			if i == j:
				cnt += ww[i] // 2
			else:
				cnt += min(ww[i], ww[j])
		ans = max(ans, cnt)
	print(ans)


def solution():
	t = int(input())
	for _ in range(t):
		n = int(input())
		result = []
		for _ in range(n + 1):
			result.append(0)
		nums = list(map(int, input().split()))
		for i in range(n):
			result[nums[i]] += 1
		maximum = 0
		for s in range(2, 2 * n + 1):
			current = 0
			j = 1
			while j < (s + 1) // 2:
				if s - j > n:
					j += 1
					continue
				current += min(result[j], result[s - j])
				j += 1
			if s % 2 == 0:
				current += result[s // 2] // 2
			maximum = max(maximum, current)
		print(maximum)
solution()


for _ in range(int(input())):
	n = int(input())
	w = list(map(int, input().split()))
	cl = [0 for i in range(max(w) + 1)]
	d = {}
	for i in w:
		cl[i] += 1
	for i in range(1, len(cl)):
		if i * 2 in d:
			d[i * 2] += cl[i] // 2
		else:
			d[i * 2] = cl[i] // 2
		for j in range(i + 1, len(cl)):
			if i + j in d:
				d[i + j] += min(cl[i], cl[j])
			else:
				d[i + j] = min(cl[i], cl[j])
	ans = 0
	for i in d:
		t = d[i]
		ans = max(ans, t)
	print(ans)


for i in range(int(input())):
	mx = 0
	n = int(input())
	w = list(map(int, input().split()))
	arr = [0] * (n + 1)
	for i in w:
		arr[i] += 1
	for sm in range(2, 2 * n + 1):
		counter = 0
		ar = arr.copy()
		for i in range(n):
			tmp = sm - w[i]
			if not 0 < tmp < n + 1:
				continue
			if ar[w[i]] == 0:
				continue
			ar[w[i]] -= 1
			if ar[tmp] > 0:
				counter += 1
				ar[tmp] -= 1
			else:
				ar[w[i]] += 1
		if counter > mx:
			mx = counter
	print(mx)


from collections import *
for item in [*open(0)][2::2]:
	c = Counter(map(int, item.split()))
	print(max((sum((min(c[x], c[s - x]) for x in c)) for s in range(101))) // 2)


import sys
import math
import itertools
import functools
import collections
import operator
import fileinput
import copy
ORDA = 97

def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return [int(i) for i in input().split()]

def lcm(a, b):
	return abs(a * b) // math.gcd(a, b)

def revn(n):
	return str(n)[::-1]

def dd():
	return collections.defaultdict(int)

def ddl():
	return collections.defaultdict(list)

def sieve(n):
	if n < 2:
		return list()
	prime = [True for _ in range(n + 1)]
	p = 3
	while p * p <= n:
		if prime[p]:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 2
	r = [2]
	for p in range(3, n + 1, 2):
		if prime[p]:
			r.append(p)
	return r

def divs(n, start=2):
	r = []
	for i in range(start, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n / i == i:
				r.append(i)
			else:
				r.extend([i, n // i])
	return r

def divn(n, primes):
	divs_number = 1
	for i in primes:
		if n == 1:
			return divs_number
		t = 1
		while n % i == 0:
			t += 1
			n //= i
		divs_number *= t

def prime(n):
	if n == 2:
		return True
	if n % 2 == 0 or n <= 1:
		return False
	sqr = int(math.sqrt(n)) + 1
	for d in range(3, sqr, 2):
		if n % d == 0:
			return False
	return True

def convn(number, base):
	new_number = 0
	while number > 0:
		new_number += number % base
		number //= base
	return new_number

def cdiv(n, k):
	return n // k + (n % k != 0)

def ispal(s):
	for i in range(len(s) // 2 + 1):
		if s[i] != s[-i - 1]:
			return False
	return True

def main():
	for _ in range(ii()):
		weights = collections.defaultdict(int)
		n = ii()
		arr = li()
		counts = collections.Counter(arr)
		keys = list(counts.keys())
		for i in range(len(keys) - 1):
			weights[keys[i] * 2] += counts[keys[i]] // 2
			for j in range(i + 1, len(keys), 1):
				m = min(counts[keys[i]], counts[keys[j]])
				weights[keys[i] + keys[j]] += m
		weights[keys[len(keys) - 1] * 2] += counts[keys[len(keys) - 1]] // 2
		srtd = sorted(weights, key=weights.get, reverse=True)
		print(weights[srtd[0]])
main()


import time, math as mt, bisect, sys
from sys import stdin, stdout
from collections import deque
from fractions import Fraction
from collections import Counter
from collections import OrderedDict
pi = 3.141592653589793

def II():
	return int(stdin.readline())

def IO():
	return stdin.readline()

def IP():
	return map(int, stdin.readline().split())

def L():
	return list(map(int, stdin.readline().split()))

def P(x):
	return stdout.write(str(x) + '\n')

def PI(x, y):
	return stdout.write(str(x) + ' ' + str(y) + '\n')

def lcm(a, b):
	return a * b // gcd(a, b)

def gcd(a, b):
	if a == 0:
		return b
	elif b == 0:
		return a
	if a > b:
		return gcd(a % b, b)
	else:
		return gcd(a, b % a)

def readTree():
	v = int(input())
	adj = [set() for i in range(v + 1)]
	for i in range(v - 1):
		(u1, u2) = In()
		adj[u1].add(u2)
		adj[u2].add(u1)
	return (adj, v)

def bfs(adj, v):
	visited = [False] * (v + 1)
	q = deque()
	while q:
		pass

def sieve():
	li = [True] * 1000001
	(li[0], li[1]) = (False, False)
	for i in range(2, len(li), 1):
		if li[i] == True:
			for j in range(i * i, len(li), i):
				li[j] = False
	prime = []
	for i in range(1000001):
		if li[i] == True:
			prime.append(i)
	return prime

def setBit(n):
	count = 0
	while n != 0:
		n = n & n - 1
		count += 1
	return count
mx = 10 ** 7
spf = [mx] * (mx + 1)

def SPF():
	spf[1] = 1
	for i in range(2, mx + 1):
		if spf[i] == mx:
			spf[i] = i
			for j in range(i * i, mx + 1, i):
				if i < spf[j]:
					spf[j] = i
	return
mod = 10 ** 9 + 7

def solve():
	n = II()
	li = L()
	li.sort()
	if n == 1:
		P(0)
		return
	sm = n * (n + 1) // 2
	best = 0
	for op in range(101):
		teams = {}
		tm = 0
		for i in range(n):
			for j in range(n):
				if i != j and li[i] + li[j] == op and (teams.get(i, -1) == -1) and (teams.get(j, -1) == -1):
					tm += 1
					teams[i] = 1
					teams[j] = 1
		if tm > best:
			best = tm
	P(best)
	return
t = II()
for i in range(t):
	solve()


import io, os
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
from collections import deque as que, defaultdict as vector
from bisect import bisect as bsearch
from heapq import *
inin = lambda : int(input())
inar = lambda : list(map(int, input().split()))
INF = float('inf')
testcase = inin()
for Case in range(testcase):
	n = inin()
	w = inar()
	sums = set()
	for i in range(n):
		for j in range(n):
			if i != j:
				sums.add(w[i] + w[j])
	mpp = vector(int)
	for i in w:
		mpp[i] += 1
	ans = 0
	for i in sums:
		temp = 0
		mp = mpp.copy()
		for j in w:
			if mp[i - j] and mp[j] and (i - j != j):
				mp[i - j] -= 1
				mp[j] -= 1
				temp += 1
			if mp[j] >= 2 and i - j == j:
				mp[i - j] -= 1
				mp[j] -= 1
				temp += 1
		ans = max(ans, temp)
	print(ans)


nnn = int(input())
for _ in range(nnn):
	n = int(input())
	arr = list(map(int, input().split()))
	l = [0] * 2 * n
	for a in arr:
		l[a - 1] += 1
	n_max = 0
	for i in range(2 * n):
		n = 0
		for j in range((i + 1) // 2):
			n += min(l[j], l[i - j])
		if i % 2 == 0:
			n += l[i // 2] // 2
		n_max = max(n, n_max)
	print(n_max)


from collections import defaultdict
for _ in range(int(input())):
	n = int(input())
	w = [*map(int, input().split())]
	sum_dict = defaultdict(lambda : 0)
	for i in range(n - 1):
		for j in range(i + 1, n):
			sum_dict[w[i] + w[j]] += 1
	final = 0
	for val in sum_dict:
		answer = 0
		x = w.copy()
		for i in range(len(x)):
			if x[i] == None:
				continue
			for k in range(i + 1, n):
				if x[k] == None:
					continue
				if x[k] + x[i] == val:
					x[k] = None
					x[i] = None
					answer += 1
					break
		final = max(answer, final)
	print(final)


def getPairsCount(arr, n, sum):
	m = [0] * 1000
	for i in range(0, n):
		m[arr[i]]
		m[arr[i]] += 1
	twice_count = 0
	for i in range(0, n):
		twice_count += m[sum - arr[i]]
		if sum - arr[i] == arr[i]:
			twice_count -= 1
	return int(twice_count / 2)
for _ in range(int(input())):
	n = int(input())
	x = list(map(int, input().split()))
	d = {}
	maxx = 0
	x.sort()
	for i in range(2, 2 * n + 1):
		d[i] = 0
	for summ in d:
		c = 0
		i = 0
		j = n - 1
		while i < n and j > i and (j > 0):
			if x[i] + x[j] == summ:
				c = c + 1
				i = i + 1
				j = j - 1
			elif x[i] + x[j] < summ:
				i = i + 1
			else:
				j = j - 1
		maxx = max(maxx, c)
	print(maxx)


import collections
for t in range(int(input())):
	n = int(input())
	s = list(map(int, input().split()))
	out = 0
	ans = [set([]) for i in range(200)]
	for i in range(len(s)):
		for j in range(i + 1, len(s)):
			val = s[i] + s[j]
			if i not in ans[val] and j not in ans[val]:
				ans[val].add(i)
				ans[val].add(j)
				out = max(out, len(ans[val]) // 2)
	print(out)


def solve():
	n = int(input())
	w = list(map(int, input().split()))
	c = [w.count(i) for i in range(n + n + 1)]
	ans = 0
	for s in range(2, n + n + 1):
		cc = 0
		for i in range(1, n + 1):
			j = s - i
			if i == j:
				cc += c[i] // 2
			elif i < j:
				cc += min(c[i], c[j])
			else:
				break
		ans = max(ans, cc)
	print(ans)
t = int(input())
for _ in range(t):
	solve()


for _ in range(int(input())):
	lens = int(input())
	weights = sorted([int(x) for x in input().split()])
	maybe = 0
	for pairs in range(2 * lens + 1):
		current = 0
		a = 0
		b = lens - 1
		while a < b:
			if weights[a] + weights[b] == pairs:
				current += 1
				a += 1
				b -= 1
				continue
			if weights[a] + weights[b] < pairs:
				a += 1
				continue
			if weights[a] + weights[b] > pairs:
				b -= 1
				continue
		maybe = max(maybe, current)
	print(maybe)


t = int(input())
for i in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	d = {i: 0 for i in range(101)}
	for i in range(n):
		if l[i] in d:
			d[l[i]] = d[l[i]] + 1
		else:
			d[l[i]] = 1
	z = float('-inf')
	for i in range(1, 101):
		s = 0
		for j in range(1, i):
			if i - j < j:
				break
			if i % 2 == 0 and 2 * j == i:
				s = s + d[j] // 2
			else:
				s = s + min(d[j], d[i - j])
		z = max(z, s)
	print(z)


t = 1
t = int(input())
for _ in range(t):
	n = int(input())
	a = sorted(list(map(int, input().split())))
	ans = 0
	for target in range(1, 2 * a[-1] + 1):
		found = 0
		i = 0
		j = n - 1
		while i < j:
			if a[i] + a[j] == target:
				found += 1
				i += 1
				j -= 1
			elif a[i] + a[j] < target:
				i += 1
			else:
				j -= 1
		ans = max(found, ans)
	print(ans)


for _ in range(int(input())):
	l = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	m = 0
	for k in range(1, 101):
		c = 0
		(i, j) = (0, len(arr) - 1)
		while i < j:
			if arr[i] + arr[j] == k:
				i += 1
				j -= 1
				c += 1
			elif arr[i] + arr[j] < k:
				i += 1
			elif arr[i] + arr[j] > k:
				j -= 1
		m = max(m, c)
	print(m)


from collections import Counter
t = int(input())
for _ in range(0, t):
	n = int(input())
	arr = list(map(int, input().strip().split(' ')))
	d = {}
	s1 = set()
	s2 = set()
	arr = [item for (items, c) in Counter(arr).most_common() for item in [items] * c]
	for i in range(0, len(arr) - 1):
		if arr[i] in s1:
			continue
		else:
			s1.add(arr[i])
		j = i + 1
		k = 0
		while j < len(arr) and arr[i] == arr[j]:
			summ = arr[i] + arr[j]
			if k % 2 == 0:
				if summ not in d.keys():
					d[summ] = 1
				else:
					d[summ] += 1
			k += 1
			j += 1
		while j < len(arr):
			summ = arr[i] + arr[j]
			if summ not in d.keys():
				d[summ] = 1
			else:
				d[summ] += 1
			j += 1
	if len(d) == 0:
		print(0)
	else:
		print(max(d.values()))


import sys
t = int(input())
for _ in range(t):
	n = int(input())
	cnt = [0] * (n + 1)
	m = 0
	for i in map(int, sys.stdin.readline().split()):
		cnt[i] += 1
		m = max(m, i)
	ans = 0
	for s in range(2, 2 * m + 1):
		c = 0
		for i in range(1, s // 2 + 1):
			if s - i > n:
				continue
			if 2 * i == s:
				c += cnt[i] // 2
			else:
				c += min(cnt[i], cnt[s - i])
		ans = max(ans, c)
	print(ans)


def ans(a, n):
	if n == 1 or n == 0:
		return 0
	elif n == 2 or n == 3:
		return 1
	a.sort()
	max_sum = 2 * a[-1]
	d = {}
	for i in a:
		if i not in d:
			d[i] = 1
		else:
			d[i] += 1
	w = list(set(a))
	arr = [0 for i in range(max_sum)]
	for i in range(len(w)):
		for j in range(i, len(w)):
			if i == j:
				arr[w[i] + w[j] - 1] += d[w[i]] // 2
			else:
				arr[w[i] + w[j] - 1] += min(d[w[i]], d[w[j]])
	return max(arr)
m = int(input())
for i in range(m):
	n = int(input())
	arr = input().split()
	a = []
	for i in arr:
		a.append(int(i))
	print(ans(a, n))


T = int(input().strip())

def num_sum(x, arr, n):
	start = 0
	end = n - 1
	ans = 0
	while start < end:
		if arr[start] + arr[end] < x:
			start += 1
		elif arr[start] + arr[end] > x:
			end -= 1
		else:
			start += 1
			end -= 1
			ans += 1
	return ans
for t in range(T):
	n = int(input())
	arr = input().strip().split()
	arr = [int(x) for x in arr]
	arr.sort()
	curr_max = 0
	ans = 0
	for i in range(2, 2 * arr[n - 1] + 1):
		curr_max = max(curr_max, num_sum(i, arr, n))
	print(curr_max)


from collections import Counter
for f in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	res = 0
	c = Counter(a)
	for i in range(2, 101):
		cont = 0
		for (j, k) in c.items():
			if i - j in c:
				cont += min(k, c[i - j])
		res = max(res, cont // 2)
	print(res)


import sys
import heapq
import collections
sys.setrecursionlimit(100000)
t = int(input())
for _ in range(t):
	m = int(input())
	arr = list(map(int, sys.stdin.readline().split()))
	result = collections.defaultdict(list)
	for (i, a) in enumerate(arr):
		for j in range(i + 1, len(arr)):
			if i not in result[a + arr[j]] and j not in result[a + arr[j]]:
				result[a + arr[j]].append(i)
				result[a + arr[j]].append(j)
	minSum = 0
	for i in result.items():
		tmp = len(i[1]) // 2
		if tmp > minSum:
			minSum = tmp
	print(minSum)


for w in range(int(input())):
	n = int(input())
	L = list(map(int, input().split()))
	a = b = 0
	for l in range(min(L) * 2, max(L) * 2 + 1):
		C = L[:]
		a = 0
		for i in range(n):
			for j in range(i + 1, n):
				if C[i] + C[j] == l:
					a = a + 1
					C[i] = 0.3
					C[j] = 0.3
					break
		if a > b:
			b = a
	print(b)


for t in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	pairs = dict()
	for i in range(n):
		for j in range(i + 1, n):
			s = a[i] + a[j]
			if s in pairs:
				flag = False
				for p in pairs[s]:
					for v in p:
						if v == i or v == j:
							flag = True
							break
					if flag:
						break
				if flag:
					continue
				pairs[s].append([i, j])
			else:
				pairs[s] = [[i, j]]
	if n == 1:
		print(0)
		continue
	ans = max(pairs, key=lambda k: len(pairs[k]))
	print(len(pairs[ans]))


t = int(input())
for test in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	if n == 1:
		print(0)
		continue
	if n == 2:
		print(1)
		continue
	counts = {}
	for i in range(len(arr)):
		for j in range(i + 1, len(arr)):
			x = arr[i]
			y = arr[j]
			if x + y not in counts:
				counts[x + y] = set([i, j])
			if i not in counts[x + y] and j not in counts[x + y]:
				counts[x + y].add(i)
				counts[x + y].add(j)
	print(max([len(x) for x in counts.values()]) // 2)


from bisect import bisect_left
import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	l = int(input())
	a = list(map(int, input().split()))
	a.sort()
	ans = 0
	for w in range(1, 2 * l + 1):
		c = 0
		used = {}
		for i in range(len(a)):
			for j in range(i + 1, len(a)):
				if a[i] + a[j] == w and i not in used and (j not in used):
					c += 1
					used[i] = 1
					used[j] = 1
		ans = max(c, ans)
	print(ans)


t = int(input())
from copy import deepcopy
for _ in range(0, t):
	n = int(input())
	a = list(map(lambda x: int(x), input().split()))
	maximum = 0
	hashmap = {}
	for k in range(0, len(a)):
		if a[k] not in hashmap:
			hashmap[a[k]] = 0
		hashmap[a[k]] += 1
	minimum_a = min(a)
	maximum_a = max(a)
	for i in range(2 * minimum_a, 2 * maximum_a + 1):
		temp = deepcopy(hashmap)
		total = 0
		for j in range(0, len(a)):
			r = i - a[j]
			if r == a[j] and temp.get(r, 0) < 2:
				continue
			if temp.get(r, 0) > 0 and temp.get(a[j], 0) > 0:
				total += 1
				temp[r] -= 1
				temp[a[j]] -= 1
		if total > maximum:
			maximum = total
	print(maximum)


import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush
from math import *
from collections import defaultdict as dd, deque, Counter as C
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
from time import perf_counter
from fractions import Fraction
import copy
mod = int(pow(10, 9) + 7)
mod2 = 998244353

def data():
	return sys.stdin.readline().strip()

def out(*var, end='\n'):
	sys.stdout.write(' '.join(map(str, var)) + end)

def L():
	return list(sp())

def sl():
	return list(ssp())

def sp():
	return map(int, data().split())

def ssp():
	return map(str, data().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(n, val) for j in range(m)]
try:
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('../output.txt', 'w')
except:
	pass
for _ in range(L()[0]):
	n = L()[0]
	A = L()
	s = set()
	for i in range(n - 1):
		for j in range(i + 1, n):
			s.add(A[i] + A[j])
	count = 0
	d = {}
	for ele in A:
		d[ele] = d.get(ele, 0) + 1
	B = copy.deepcopy(d)
	for ele in s:
		k = 0
		d = copy.deepcopy(B)
		for i in range(n):
			x = ele - A[i]
			if x <= 0:
				continue
			if d.get(x, 0):
				f = min(d.get(x, 0), d.get(A[i], 0))
				if A[i] == x:
					k += d[x] // 2
					d[x] = d[x] % 2
					continue
				k += f
				d[x] -= f
				d[A[i]] -= f
		count = max(count, k)
	print(count)


from collections import defaultdict
tests = int(input())
for _ in range(tests):
	n = int(input())
	d = defaultdict(int)
	w = list(map(int, input().split()))
	for x in w:
		if x in d.keys():
			d[x] += 1
		else:
			d[x] = 1
	best_result = 0
	for s in range(2, 101):
		result = 0
		for i in range(1, (s + 1) // 2):
			result += min(d[i], d[s - i])
		if s % 2 == 0:
			result += d[s // 2] // 2
		best_result = max(best_result, result)
	print(best_result)


import math
t = int(input())

def pos(a, we):
	t = 0
	cic = {}
	for i in a:
		try:
			cic[i] += 1
		except:
			cic[i] = 1
	for i in a:
		if we - i in cic:
			if we - i == i:
				x = cic[i] // 2
				t += x
				cic[i] -= x
				cic[i] -= x
				continue
			x = 0
			x = min(cic[i], cic[we - i])
			t += x
			cic[i] -= x
			cic[we - i] -= x
	return t
for _ in range(t):
	n = int(input())
	w = list(map(int, input().split()))
	cic = {}
	for i in w:
		try:
			cic[i] += 1
		except:
			cic[i] = 1
	w.sort()
	if n == 1:
		print(0)
		continue
	minw = w[0] + w[1]
	maxw = w[-1] + w[-2]
	ans = 0
	for i in range(minw, maxw + 1):
		ans = max(ans, pos(w, i))
	print(ans)


def merge(a, n):
	i = 0
	j = len(a) - 1
	count = 0
	while i < j:
		sum = a[i] + a[j]
		if sum == n:
			count += 1
			i += 1
			j -= 1
		elif sum > n:
			j -= 1
		else:
			i += 1
	return count
for _ in range(int(input())):
	n = int(input())
	a = [int(x) for x in input().split()]
	se = {}
	a.sort()
	for i in range(n - 1):
		for j in range(i + 1, n):
			sum = a[i] + a[j]
			if sum not in se:
				se[sum] = 0
	m = 0
	s = 0
	for k in se:
		se[k] = merge(a, k)
		if se[k] > m:
			m = se[k]
	print(m)


ii = lambda : int(input())
il = lambda : list(map(int, input().split()))
for _ in range(ii()):
	n = ii()
	a = il()
	mx = 0
	ld = 0
	for k in range(2, 101):
		c = 0
		cdpm = 0
		l = [0] * 101
		kn = 0
		for i in range(0, n):
			for j in range(i + 1, n):
				if l[i] == 0 and l[j] == 0:
					if a[i] + a[j] == k:
						c = c + 1
						tne = 0
						l[i] = l[i] + 1
						l[j] = l[j] + 1
						pnc = 0
		mx = max(mx, c)
	print(mx)
	dkc = 0


t = int(input())
for _ in range(t):
	n = int(input())
	W = list(map(int, input().split()))
	W.sort()
	ans = 0
	for s in range(2 * n + 1):
		temp = 0
		d = {}
		for w in W:
			flag = True
			if w in d:
				if d[w] > 0:
					temp += 1
					d[w] -= 1
					flag = False
			if flag:
				if s - w in d:
					d[s - w] += 1
				else:
					d[s - w] = 1
		ans = max(temp, ans)
	print(ans)


from sys import stdin
input = stdin.readline
for _ in range(int(input())):
	n = int(input())
	l = sorted(list(map(int, input().split())))
	ans = 0
	cntr = [0] * (2 * n + 1)
	for i in l:
		cntr[i] += 1
	for s in range(2, 2 * n + 1):
		temp = 0
		for i in range(1, s):
			temp += min(cntr[i], cntr[s - i]) if i != s - i else cntr[i] // 2 * 2
		ans = max(ans, temp // 2)
	print(ans)


from collections import defaultdict
tc = int(input())
for ip in range(tc):
	vis = defaultdict(lambda : 0)
	n = int(input())
	ar = list(map(int, input().split()))
	if n == 1:
		print(0)
		continue
	for i in ar:
		vis[i] += 1
	ar.sort()
	maxx = ar[-1] + ar[-2]
	minn = ar[0] + ar[1]
	ans = 0
	for cur in range(minn, maxx + 1):
		temp = 0
		for i in range(1, n + 1):
			v = min(vis[i], vis[cur - i])
			if i == cur - i:
				v = vis[i]
			temp += v
		ans = max(ans, temp // 2)
	print(ans)


t = int(input())
for _ in range(t):
	n = int(input())
	l = sorted(map(int, input().split()))
	d = {}
	for i in range(n):
		if l[i] in d:
			d[l[i]] += 1
		else:
			d[l[i]] = 1
	ans = 0
	for sm in range(1, 101):
		c = 0
		for j in set(l):
			dif = sm - j
			if dif in d:
				c += min(d[j], d[dif])
		ans = max(ans, c)
	print(ans // 2)


def check(a):
	res = {}
	m = {}
	for elem in a:
		if elem in m:
			m[elem] += 1
		else:
			m[elem] = 1
	for i in range(2, 101):
		res[i] = 0
		tem = m.copy()
		total = 0
		for elem in m.keys():
			if 2 * elem == i:
				total += m[elem]
			else:
				other = i - elem
				if other > 0 and other in tem:
					total += min(m[elem], m[other])
		res[i] = total // 2
	print(max(res.values()))
t = int(input())
for i in range(t):
	b = input()
	a = input().split(' ')
	a = list(map(int, a))
	check(a)


t = int(input())
for step in range(t):
	n = int(input())
	w_raw = [int(data) for data in input().split()]
	weights = [0 for i in range(n)]
	for item in w_raw:
		weights[item - 1] += 1
	k = 0
	s = 0
	for central in range(n):
		result = weights[central] // 2
		for j in range(1, min(central + 1, n - central)):
			result += min(weights[central + j], weights[central - j])
		if result > k:
			k = result
	for left_central in range(n - 1):
		result = 0
		for j in range(min(left_central + 1, n - left_central - 1)):
			result += min(weights[left_central + j + 1], weights[left_central - j])
		if result > k:
			k = result
	print(k)


def solve(n, k):
	maxPairs = 0
	tempPairs = 0
	k.sort()
	refer = [0] * 51
	for x in k:
		refer[x] += 1
	for nSum in range(2, 101):
		tempPairs = 0
		till = nSum // 2
		if nSum % 2 == 0:
			tempPairs += refer[till] // 2
			till -= 1
		for y in range(1, till + 1):
			big = nSum - y
			if big > 50:
				continue
			tempPairs += min(refer[y], refer[nSum - y])
		if tempPairs > maxPairs:
			maxPairs = tempPairs
	return maxPairs
n = int(input())
for x in range(n):
	x = int(input())
	seq2 = list(map(int, input().split()))
	print(solve(x, seq2))


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	s = 0
	Sum = {}
	for i in range(n):
		for j in range(i + 1, n):
			try:
				S = arr[i] + arr[j]
				is_ape = True
				for tup in Sum[S]:
					if i in tup or j in tup:
						is_ape = False
						break
				if is_ape:
					Sum[S].append((i, j))
			except:
				Sum[arr[i] + arr[j]] = [(i, j)]
	if n == 1:
		print(0)
	else:
		print(len(Sum[max(Sum, key=lambda k: len(Sum[k]))]))


z = input
for _ in range(int(z())):
	(n, l, c, a) = (int(z()), list(map(int, z().split())), [0] * 101, 0)
	for i in l:
		c[i] += 1
	for i in range(1, 101):
		t = 0
		for j in range(1, i + 1):
			t += min(c[j], c[i - j])
		t //= 2
		a = max(a, t)
	print(a)


test_cnt = int(input())
tests = []
for _ in range(test_cnt):
	n = int(input())
	w = list(map(int, input().split()))
	tests.append((n, w))
for test in tests:
	n = test[0]
	w = test[1]
	max_k = 0
	for s in range(2, 2 * n + 1):
		k = 0
		cp_w = w[:]
		while cp_w:
			x = cp_w[0]
			cp_w.remove(x)
			if s - x in cp_w:
				cp_w.remove(s - x)
				k += 1
		if k > max_k:
			max_k = k
	print(max_k)


for _ in range(int(input())):
	n = int(input())
	l = sorted(list(map(int, input().split())))
	z = 0
	for t in range(1, 101):
		count = 0
		i = 0
		j = len(l) - 1
		while i < j:
			if l[i] + l[j] == t:
				count += 1
				i += 1
				j -= 1
			elif l[i] + l[j] > t:
				j -= 1
			elif l[i] + l[j] < t:
				i += 1
		z = max(z, count)
	print(z)


for t in range(int(input())):
	n = int(input())
	L = [int(X) for X in input().split()]
	list = []
	for sum in range(2, 2 * n + 1):
		yeslist = L.copy()
		list.append(0)
		for j in range(n):
			for k in range(j + 1, n):
				if yeslist[j] + yeslist[k] == sum and yeslist[j] != 0 and (yeslist[k] != 0):
					list[-1] += 1
					yeslist[j] = 0
					yeslist[k] = 0
					break
	if len(list) == 0:
		print(0)
	else:
		print(max(list))


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	wt = 2 * max(a)
	ans = []
	for wei in range(1, 101):
		f = 0
		vis = [0] * n
		for i in range(n):
			for j in range(n):
				if i != j and a[i] + a[j] == wei and (vis[i] != 1) and (vis[j] != 1):
					f += 1
					vis[i] = 1
					vis[j] = 1
		ans.append(f)
	print(max(ans))


t = int(input(''))
arr = []
for i in range(t):
	input('')
	arr.append(list(map(int, input().split())))
for i in arr:
	i.sort()
	cnt = 0
	prevcnt = 0
	n = len(i)
	flag = 0
	maxx = i[n - 1] + i[n - 2]
	loop = 0
	cnt = [0] * (maxx + 1)
	for j in i:
		cnt[j] += 1
	for num in range(2, maxx + 1):
		sol = 0
		for j in range(int(num / 2) + 1):
			if num == 2 * j:
				sol += cnt[j] // 2
			else:
				sol += min(cnt[j], cnt[num - j])
		prevcnt = max(prevcnt, sol)
	print(prevcnt)


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	ans = 0
	if n == 1:
		print(0)
	elif n == 3 or n == 2:
		print(1)
	else:
		mn = l[0] + l[1]
		mx = l[n - 1] + l[n - 2]
		for k in range(mn, mx + 1):
			cnt = 0
			i = 0
			j = n - 1
			while i < j:
				if l[i] + l[j] == k:
					cnt += 1
					i += 1
					j -= 1
				elif l[i] + l[j] > k:
					j -= 1
				else:
					i += 1
			ans = max(ans, cnt)
		print(ans)


import bisect
import math
for xoxo in range(1):
	for _ in range(int(input())):
		n = int(input())
		a = list(map(int, input().split()))
		b = [0] * 51
		fans = 0
		for i in range(n):
			b[a[i]] += 1
		for i in range(2, 101):
			(ans, x) = (0, 0)
			if i % 2:
				x += 1
			for j in range(1, i // 2 + x):
				if i - j <= 50:
					ans += min(b[j], b[i - j])
			if i % 2 == 0:
				ans += b[i // 2] // 2
			fans = max(fans, ans)
		print(fans)


from itertools import *
from copy import copy

def f(a, b):
	return a + b
t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	s = set(list(starmap(f, list(combinations(a, 2)))))
	d = dict()
	for i in a:
		if i in d:
			d[i] += 1
		else:
			d[i] = 1
	k = list(d.keys())
	k.sort()
	ans = 0
	while s:
		n_ans = 0
		now = s.pop()
		dd = copy(d)
		i = 0
		while i < len(k) and k[i] < now:
			if now - k[i] == k[i]:
				n_ans += dd[k[i]] // 2
				dd[k[i]] %= 2
			else:
				q = dd[k[i]]
				if now - k[i] in d:
					w = dd[now - k[i]]
				else:
					w = 0
				n_ans += min(q, w)
				dd[k[i]] -= min(q, w)
				if now - k[i] in d:
					dd[now - k[i]] -= min(q, w)
			i += 1
		ans = max(n_ans, ans)
	print(ans)


t = int(input())
for _ in range(t):
	n = int(input())
	lst = list(map(int, input().split()))
	sumi = []
	for i in range(len(lst)):
		for j in range(i + 1, len(lst)):
			if lst[i] + lst[j] not in sumi:
				sumi.append(lst[i] + lst[j])
	lst.sort()
	max_count = 0
	for i in range(len(sumi)):
		left = 0
		right = len(lst) - 1
		count = 0
		while left < right:
			if lst[left] + lst[right] == sumi[i]:
				count += 1
				left += 1
				right -= 1
			elif lst[left] + lst[right] > sumi[i]:
				right -= 1
			else:
				left += 1
			if count > max_count:
				max_count = count
	print(max_count)


(z, zz, dgraphs) = (input, lambda : list(map(int, z().split())), {})
from string import *
from collections import *
from queue import *
from sys import *
from collections import *
from math import *
from heapq import *
from itertools import *
from bisect import *
from collections import Counter as cc
from math import factorial as f

def lcd(xnum1, xnum2):
	return xnum1 * xnum2 // gcd(xnum1, xnum2)

def prime(x):
	p = ceil(x ** 0.5) + 1
	for i in range(2, p):
		if x % i == 0:
			return 0
	return 1

def dfs(u, visit, graph):
	visit[u] = True
	for i in graph[u]:
		if not visit[i]:
			dfs(i, visit, graph)
num = int(z())
for _ in range(num):
	n = int(z())
	l = zz()
	cnt = [0] * 101
	ans = 0
	for i in l:
		cnt[i] += 1
	for i in range(1, 101):
		tem = 0
		for j in range(1, i + 1):
			tem += min(cnt[j], cnt[i - j])
		tem //= 2
		ans = max(ans, tem)
	print(ans)


t = int(input())
c = []
for j in range(t):
	n = int(input())
	w = [int(u) for u in input().split()]
	d = {}
	for i in w:
		if i in d:
			d[i] += 1
		else:
			d[i] = 1
	cnt = {}
	for i in range(2, 2 * n + 1):
		cnt[i] = 0
		for j in range(1, i // 2 + 1):
			if j == i / 2 and j in d:
				cnt[i] += d[j] // 2
			elif j in d and i - j in d:
				cnt[i] += min(d[j], d[i - j])
	max = 0
	for i in cnt:
		if cnt[i] > max:
			max = cnt[i]
	c.append(max)
for k in c:
	print(k)


from sys import stdin
import math
inp = lambda : stdin.readline().strip()
t = int(inp())
for _ in range(t):
	n = int(inp())
	a = [int(x) for x in inp().split()]
	if len(a) < 2:
		print(0)
		continue
	a.sort(reverse=True)
	s = a[0] + a[1]
	fAns = 0
	d = {i + 1: 0 for i in range(s - 1)}
	for i in range(n):
		d[a[i]] += 1
	for i in range(2, s + 1):
		ans = 0
		tmpD = d.copy()
		for j in range(n):
			try:
				if j + 1 == i - (j + 1):
					toBeAdded = tmpD[j + 1] // 2
				else:
					toBeAdded = min(tmpD[j + 1], tmpD[i - (j + 1)])
				ans += toBeAdded
				tmpD[j + 1] -= toBeAdded
				tmpD[i - (j + 1)] -= toBeAdded
			except KeyError:
				pass
		fAns = max(ans, fAns)
	print(fAns)


from collections import Counter
t = int(input())
for i in range(t):
	n = int(input())
	w = list(map(int, input().split()))
	c = Counter(w)
	ans = 0
	for i in range(1, 101):
		num = 0
		for (g, m) in c.items():
			if i > g:
				num += min(m, c[i - g])
		ans = max(num, ans)
	print(ans // 2)


def solve(arr, n):
	arr.sort()
	ans = 0
	for s in range(2, 2 * n + 1):
		i = 0
		j = n - 1
		la = 0
		while i < j:
			if arr[i] + arr[j] == s:
				i += 1
				j -= 1
				la += 1
			elif arr[i] + arr[j] < s:
				i += 1
			else:
				j -= 1
		ans = max(la, ans)
	return ans
t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	print(solve(arr, n))


def main():
	n = int(input())
	d = {}
	arr = list(sorted(map(int, input().split())))
	best = 0
	for s in range(101):
		c = 0
		(i, j) = (0, n - 1)
		while i < j:
			if arr[i] + arr[j] == s:
				i += 1
				j -= 1
				c += 1
			elif arr[i] + arr[j] < s:
				i += 1
			else:
				j -= 1
		best = max(best, c)
	print(best)
for _ in range(int(input())):
	main()


for t in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	ans = dict()
	for i in range(n):
		ele = arr[i]
		if ele in ans:
			ans[ele] += 1
		else:
			ans[ele] = 1
	sums = dict()
	for i in range(1, 51):
		for j in range(i, 51):
			tot = i + j
			if i == j:
				if i in ans and j in ans:
					count = ans[i] // 2
				else:
					count = 0
			elif i in ans and j in ans:
				count = min(ans[i], ans[j])
			else:
				count = 0
			if tot in sums:
				sums[tot] += count
			else:
				sums[tot] = count
	sol = 0
	for i in sums:
		sol = max(sol, sums[i])
	print(sol)


from functools import lru_cache
from sys import stdin, stdout
import sys
from math import *
for __ in range(int(input())):
	n = int(input())
	ar = list(map(int, input().split()))
	ar.sort()
	rslt = 0
	for i in range(2, 110):
		d = {}
		for j in range(n):
			if d.get(ar[j]) == None:
				d[ar[j]] = 0
			d[ar[j]] += 1
		ans = 0
		for j in range(n):
			if i > ar[j]:
				a = ar[j]
				b = i - ar[j]
				if d.get(b) != None:
					if a == b and d[a] > 1:
						d[b] -= 1
						d[a] -= 1
						ans += 1
					elif d[b] > 0 and d[a] > 0 and (b != 0) and (a != b):
						d[b] -= 1
						d[a] -= 1
						ans += 1
		rslt = max(ans, rslt)
	print(rslt)


from collections import defaultdict as ddict

def f():
	t = int(input())
	for _ in range(t):
		n = int(input())
		arr = list(map(lambda x: int(x), input().split(' ')))
		arr.sort()
		ans = 0
		for s in range(2, 2 * n + 1):
			temp = 0
			d = ddict(int)
			for i in range(n):
				if s - arr[i] > 0 and d[s - arr[i]] > 0:
					d[s - arr[i]] -= 1
					temp += 1
				else:
					d[arr[i]] += 1
			ans = max(ans, temp)
		print(ans)
f()


t = int(input())
for i in range(t):
	n = int(input())
	a = [int(v) for v in input().split()]
	a.sort()
	c = 0
	v = a[:]
	for j in range(2, 101):
		p = j
		te = 0
		k = 0
		m = 0
		a = v[:]
		while k < n:
			m = 0
			while m < n:
				if k != m and a[k] + a[m] == j:
					te = te + 1
					a[k] = -1000
					a[m] = -1000
				m = m + 1
			k = k + 1
		c = max(te, c)
	print(c)


t = int(input())
from collections import Counter
for i in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	c = Counter(l)
	ans = 0
	for j in range(2, 101):
		x = 0
		c1 = c.copy()
		for k in range(n):
			if j - l[k] != l[k]:
				if c1[j - l[k]] and c1[l[k]]:
					x += 1
					c1[j - l[k]] -= 1
					c1[l[k]] -= 1
			elif c1[l[k]] > 1:
				x += 1
				c1[l[k]] -= 2
		ans = max(ans, x)
	print(ans)


import math

def makeTeam(arr, n, w):
	l = 0
	r = n - 1
	count = 0
	while l < r:
		teamWeight = arr[l] + arr[r]
		if teamWeight == w:
			count += 1
			l += 1
			r -= 1
		elif teamWeight < w:
			l += 1
		else:
			r -= 1
	return count

def Solution(arr, n):
	if n == 1:
		print(0)
		return
	res = 0
	arr = sorted(arr)
	maxW = arr[n - 2] + arr[-1]
	for i in range(arr[0], maxW + 1):
		res = max(res, makeTeam(arr, n, i))
	print(res)
for t in range(int(input())):
	N = int(input())
	arr = list(map(int, input().split()))
	Solution(arr, N)


from collections import defaultdict

def main():
	for case in range(int(input())):
		n = int(input())
		weights = [int(x) for x in input().split()]
		ans = 0
		ans_w = -1
		for total in range(2, 101):
			k = 0
			cur = defaultdict(lambda : 0)
			for w in weights:
				if cur[w] > 0:
					k += 1
					cur[w] -= 1
				elif w < total:
					cur[total - w] += 1
			if k > ans:
				ans = k
				ans_w = total
		print(ans)
py2 = round(0.5)
if py2:
	from future_builtins import ascii, filter, hex, map, oct, zip
	range = xrange
import os, sys
from io import IOBase, BytesIO
BUFSIZE = 8192

class FastIO(BytesIO):
	newlines = 0

	def __init__(self, file):
		self._file = file
		self._fd = file.fileno()
		self.writable = 'x' in file.mode or 'w' in file.mode
		self.write = super(FastIO, self).write if self.writable else None

	def _fill(self):
		s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
		self.seek((self.tell(), self.seek(0, 2), super(FastIO, self).write(s))[0])
		return s

	def read(self):
		while self._fill():
			pass
		return super(FastIO, self).read()

	def readline(self):
		while self.newlines == 0:
			s = self._fill()
			self.newlines = s.count(b'\n') + (not s)
		self.newlines -= 1
		return super(FastIO, self).readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.getvalue())
			(self.truncate(0), self.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		if py2:
			self.write = self.buffer.write
			self.read = self.buffer.read
			self.readline = self.buffer.readline
		else:
			self.write = lambda s: self.buffer.write(s.encode('ascii'))
			self.read = lambda : self.buffer.read().decode('ascii')
			self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

class union_find:

	def __init__(self, n):
		self.n = n
		self.rank = [0] * n
		self.parent = [int(j) for j in range(n)]

	def union(self, i, j):
		i = self.find(i)
		j = self.find(j)
		if self.rank[i] == self.rank[j]:
			self.parent[i] = j
			self.rank[j] += 1
		elif self.rank[i] > self.rank[j]:
			self.parent[j] = i
		else:
			self.parent[i] = j

	def find(self, i):
		temp = i
		if self.parent[temp] != temp:
			self.parent[temp] = self.find(self.parent[temp])
		return self.parent[temp]
from math import log2, ceil
from collections import deque

def main():
	for t in range(int(input())):
		n = int(input())
		l = [int(j) for j in input().split()]
		l.sort()
		ans = 0
		for i in range(1, 2 * n + 1):
			p1 = 0
			p2 = n - 1
			tans = 0
			while p1 < p2:
				if l[p1] + l[p2] == i:
					tans += 1
					p1 += 1
					p2 -= 1
				elif l[p1] + l[p2] < i:
					p1 += 1
				else:
					p2 -= 1
			ans = max(tans, ans)
		print(ans)
main()


for i in range(int(input())):
	n = int(input())
	w = [int(i) for i in input().split()]
	max_count = 0
	for weight in range(2, 2 * n + 1):
		a = [0] * (2 * n + 1)
		count = 0
		for i in w:
			if n + 1 > weight - i > 0 and a[weight - i] > 0:
				count += 1
				a[weight - i] -= 1
			else:
				a[i] += 1
		max_count = max(max_count, count)
	print(max_count)


T = int(input())

def compute(arr, target):
	res = 0
	(l, r) = (0, len(arr) - 1)
	while l < r:
		temp = arr[l] + arr[r]
		if temp < target:
			l += 1
		elif temp > target:
			r -= 1
		else:
			res += 1
			l += 1
			r -= 1
	return res
for i in range(T):
	length = int(input())
	arr = list(map(int, input().split(' ')))
	arr.sort()
	(left, right) = (min(arr) * 2, max(arr) * 2)
	result = 0
	for j in range(left, right + 1):
		result = max(result, compute(arr, j))
	print(result)


import sys, math
input = sys.stdin.readline
t = int(input())
for r in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	maxl = max(l)
	ans = 0
	for w in range(1, 101):
		count = 0
		d = {}
		for i in l:
			try:
				d[i] += 1
			except:
				d[i] = 1
		for i in d:
			counta = d[i]
			try:
				countb = d[w - i]
				minCount = min(counta, countb)
				if i == w - i:
					minCount = minCount // 2
					d[i] = 0
				else:
					d[i] -= minCount
					d[w - i] -= minCount
				count += minCount
			except:
				pass
		if count > ans:
			ans = count
	print(ans)


t = int(input())
for i in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	if n == 1:
		print(0)
	else:
		array = []
		a = arr[0] + arr[1]
		b = arr[-1] + arr[-2]
		for j in range(a, b + 1):
			lis = [0] * n
			k = 0
			ans = 0
			while k < n:
				if lis[k] == 1:
					k += 1
				else:
					l = k + 1
					while l < n:
						if lis[l] == 1:
							l += 1
						elif arr[l] + arr[k] == j:
							lis[l] = 1
							lis[k] = 1
							ans += 1
							l = n
						else:
							l += 1
					if l == n:
						k += 1
			if k == n:
				array.append(ans)
		print(max(array))


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	cnt = [0] * (n + 1)
	for item in a:
		cnt[item] += 1
	ans = 0
	for s in range(2, 2 * n + 1):
		now = 0
		for i in range(1, (s + 1) // 2):
			if s - i > n:
				continue
			now += min(cnt[s - i], cnt[i])
		if not s & 1:
			now += cnt[s // 2] // 2
		ans = max(ans, now)
	print(ans)


from collections import Counter

def solve():
	n = int(input())
	(*a,) = map(int, input().split())
	ca = Counter(a)
	ans = 0
	for i in range(2, n * 2 + 1):
		tmp = 0
		for k in ca:
			tmp += min(ca[k], ca[i - k])
		tmp //= 2
		ans = max(ans, tmp)
	print(ans)
t = int(input())
for _ in range(t):
	solve()


import sys
import math
mod = 10 ** 9 + 7
inf = float('inf')
from collections import defaultdict

def I():
	return int(sys.stdin.readline())

def LI():
	return list(map(int, sys.stdin.readline().split()))
t = I()
for _ in range(t):
	n = I()
	w = LI()
	ans = 0
	for s in range(1, 2 * n + 1):
		d = defaultdict(lambda : 0)
		cnt = 0
		for i in range(n):
			if s - w[i] <= 0:
				continue
			if d[s - w[i]]:
				cnt += 1
				d[s - w[i]] -= 1
			else:
				d[w[i]] += 1
		ans = max(ans, cnt)
	print(ans)


t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().strip().split()))[:n]
	from collections import Counter
	store = Counter(arr)
	ans = 0
	for i in range(1, 2 * n + 1):
		total = 0
		for (a, b) in store.items():
			other = i - a
			if store[other] >= 1:
				total += min(store[other], b)
		total = total // 2
		ans = max(ans, total)
	print(ans)


from collections import *
C = Counter
for s in [*open(0)][2::2]:
	c = C(map(int, s.split()))
	a = (*c,)
	r = C()
	i = 0
	for x in a:
		for y in a[:i]:
			r[x + y] += min(c[x], c[y])
		i += 1
		r[2 * x] += c[x] // 2
	print(max(r.values()))


for t in range(int(input())):
	n = int(input())
	ls = []
	ls = list(map(int, input().split()))
	mx = max(ls)
	s = 0
	for i in range(2, mx * 2 + 1):
		c = 0
		used = []
		for j in range(n):
			if ls[j] < i:
				for k in range(n):
					if j != k and ls[j] + ls[k] == i and (j not in used) and (k not in used):
						c = c + 1
						used.append(j)
						used.append(k)
						if c > s:
							s = c
						break
	print(int(s))


t = int(input())
for T in range(t):
	n = int(input())
	w = list(map(int, input().split()))
	w = sorted(w)
	m_n = 0
	m_i = -1
	D = {}
	for i in range(101):
		D[i] = 0
	for i in range(n):
		D[w[i]] += 1
	for i in range(1, 101):
		t = 0
		for j in range(1, i):
			t += min(D[j], D[i - j])
		if t > m_n:
			m_n = t
			m_i = i
	print(m_n // 2)


from collections import Counter
for _ in range(int(input())):
	n = int(input())
	ar = [*map(int, input().split())]
	cnt = Counter(ar)
	res = 0
	for s in range(1, 101):
		pairs = 0
		for i in range(1, s // 2 + 1):
			j = s - i
			if i in cnt and j in cnt:
				if i == j:
					pairs += cnt[i] // 2
				else:
					pairs += min(cnt[i], cnt[j])
		if pairs > res:
			res = pairs
	print(res)


for ti in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	mp = {}
	cp = {}
	for i in l:
		if i not in mp:
			mp[i] = 1
		else:
			mp[i] += 1
	ans = 0
	for i in range(1, n * 2 + 1):
		cnt = 0
		foo = 0
		for j in l:
			if i % 2:
				if foo == 0:
					cp = {}
					foo += 1
				if mp.get(i - j, 0) > 0:
					mp[i - j] -= 1
					if mp.get(j, 0) > 0:
						cnt += 1
						mp[j] -= 1
					else:
						mp[i - j] += 1
				cp[j] = cp.get(j, 0) + 1
			if i % 2 == 0:
				if foo == 0:
					mp = {}
					foo += 1
				if cp.get(i - j, 0) > 0:
					cp[i - j] -= 1
					if cp.get(j, 0) > 0:
						cnt += 1
						cp[j] -= 1
					else:
						cp[i - j] += 1
				mp[j] = mp.get(j, 0) + 1
		ans = max(ans, cnt)
	print(ans)


import sys
try:
	sys.stdin = open('inputs.txt', 'r')
	sys.stdout = open('output.txt', 'w')
except:
	pass
finally:
	input = sys.stdin.readline
	print = sys.stdout.write
t = int(input())
for _ in range(t):
	n = int(input())
	w = list(map(int, input().split()))
	smin = min(w) * 2
	smax = max(w) * 2
	wset = {}
	for i in w:
		if i in wset:
			wset[i] += 1
		else:
			wset[i] = 1
	ans = 0
	for s in range(smin, smax + 1):
		t = 0
		for wt in wset.keys():
			if s - wt in wset:
				t += min(wset[wt], wset[s - wt])
		ans = max(t, ans)
	print(str(ans // 2))
	print('\n')


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	r = {}
	for i in a:
		r[i] = r.get(i, 0) + 1
	k = sorted(r.keys())
	m = len(k)
	s = {}
	ans = 0
	for i in range(m):
		for j in range(i, m):
			if i == j:
				s[k[i] + k[j]] = s.get(k[i] + k[j], 0) + r[k[i]] // 2
			else:
				s[k[i] + k[j]] = s.get(k[i] + k[j], 0) + min(r[k[i]], r[k[j]])
			ans = max(ans, s[k[i] + k[j]])
	print(ans)


for _ in range(int(input())):
	n = int(input())
	l = [int(x) for x in input().split()]
	l = sorted(l)
	d = {}
	i = 0
	while i < n:
		ct = 0
		a = l[i]
		while i < n and l[i] == a:
			ct += 1
			i += 1
		d[a] = ct
	dic = {}
	for i in d:
		for j in d:
			if i >= j:
				continue
			if dic.get(i + j):
				if i == j:
					dic[i + j] += d[i] // 2
				else:
					dic[i + j] += min(d[i], d[j])
			elif i == j:
				if d[i] // 2 != 0:
					dic[i + j] = d[i] // 2
			else:
				dic[i + j] = min(d[i], d[j])
		if dic.get(i + i):
			dic[i + i] += d[i] // 2
		elif d[i] // 2 != 0:
			dic[i + i] = d[i] // 2
	if len(dic):
		print(max(dic.values()))
	else:
		print(0)


T = int(input())
for _ in range(0, T):
	n = int(input())
	s = [int(x) for x in input().split()]
	pos = [0] * (n + 1)
	for i in range(0, len(s)):
		pos[s[i]] += 1
	ans = 0
	for i in range(0, 2 * n + 1):
		kk = []
		for j in range(0, len(pos)):
			kk.append(0)
		c = 0
		for j in range(1, len(pos)):
			if i - j >= 0 and i - j <= n and (kk[j] == 0) and (kk[i - j] == 0):
				if j == i - j:
					c += pos[j] // 2
				else:
					c += min(pos[j], pos[i - j])
				kk[j] = 1
				kk[i - j] = 1
		ans = max(ans, c)
	print(ans)


t = int(input())
for tt in range(t):
	n = int(input())
	w = [int(x) for x in input().split(' ')]
	w.sort()
	ans = 0
	for s in range(0, 150):
		dw = list(w)
		cans = 0
		for i in range(n - 1):
			for j in range(i + 1, n):
				if dw[i] + dw[j] == s and dw[i] != -1 and (dw[j] != -1):
					dw[i] = -1
					dw[j] = -1
					cans += 1
					break
		ans = max(ans, cans)
	print(ans)


for t in range(int(input())):
	n = int(input())
	W = list(map(int, input().split()))
	W.sort()
	if n <= 1:
		print(0)
		continue
	minS = W[0] + W[1]
	maxS = W[-1] + W[-2]
	maxTeams = 0
	for s in range(minS, maxS + 1):
		mp = {}
		for w in W:
			if w in mp:
				mp[w] += 1
			else:
				mp[w] = 1
		teams = 0
		for x in W:
			y = s - x
			mp[x] -= 1
			if y in mp and mp[y] > 0:
				mp[y] -= 1
				teams += 1
		maxTeams = max(maxTeams, teams)
	print(maxTeams)


t = int(input())
while t:
	t -= 1
	n = int(input())
	ar = list(map(int, input().split()))
	cnt = [0] * (n + 1)
	for i in range(n):
		cnt[ar[i]] += 1
	ans = 0
	for s in range(2, 2 * n + 1):
		cur = 0
		for i in range(1, (s + 1) // 2):
			if s - i > n:
				continue
			cur += min(cnt[i], cnt[s - i])
		if s % 2 == 0:
			cur += cnt[s // 2] // 2
		ans = max(ans, cur)
	print(ans)


for tc in range(int(input())):
	length = int(input())
	arr = sorted(list(map(int, input().split())))
	freq = {}
	copy = {}
	ans = []
	temp = []
	for x in arr:
		if x not in freq.keys():
			freq[x] = 1
		else:
			freq[x] += 1
		if x not in copy.keys():
			copy[x] = 1
		else:
			copy[x] += 1
	if length == 1:
		print(0)
	else:
		for x in range(2, arr[-1] + arr[-2] + 1):
			for z in arr:
				y = x - z
				if y > 0:
					try:
						if y == z:
							if freq[y] % 2 == 0:
								temp.append(freq[y] // 2)
								freq[y] = 0
							elif freq[y] > 1:
								temp.append((freq[y] - 1) // 2)
								freq[y] = 1
						else:
							mn = min(freq[y], freq[z])
							temp.append(mn)
							freq[y] -= mn
							freq[z] -= mn
					except KeyError:
						pass
				else:
					break
			freq = dict(copy)
			ans.append(temp)
			temp = []
		mx = 0
		for x in ans:
			mx = max(mx, sum(x))
		print(mx)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	mn = min(a)
	mx = max(a)
	ans = 0
	d = {}
	for i in a:
		d[i] = d.get(i, 0) + 1
	p = d.copy()
	for s in range(mn + mn, mx + mx + 1):
		cnt = 0
		for i in range(n):
			if s - a[i] in p.keys():
				if s - a[i] != a[i]:
					ocnt = min(p[s - a[i]], p[a[i]])
					p[a[i]] -= ocnt
					p[s - a[i]] -= ocnt
				else:
					ocnt = p[s - a[i]] // 2
					p[a[i]] = p[a[i]] % 2
				cnt += ocnt
		ans = max(ans, cnt)
		p = d.copy()
	print(ans)


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	s = list(map(lambda a: (a, l.count(a)), set(l)))
	r = [0] * (2 * n + 1)
	n = len(s)
	for i in range(n):
		x = s[i]
		r[x[0] * 2] += x[1] // 2
		for j in range(i + 1, n):
			y = s[j]
			r[x[0] + y[0]] += min(x[1], y[1])
	print(max(r))


for i in range(int(input())):
	n = int(input())
	arr = sorted(list(map(int, input().split())))
	l = []
	r = 0
	s = 0
	d = []
	for i in range(n):
		for j in range(n):
			l.append(arr[i] + arr[j])
	k = list(set(l))
	for i in k:
		r = 0
		low = 0
		high = len(arr) - 1
		while low < high:
			if arr[low] + arr[high] > i:
				high -= 1
			elif arr[low] + arr[high] < i:
				low += 1
			elif arr[low] + arr[high] == i:
				r = r + 1
				low += 1
				high -= 1
		s = max(r, s)
	print(s)


import sys
import math
from sys import stdin, stdout

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def get_list():
	return list(map(int, sys.stdin.readline().strip().split()))

def get_string():
	return sys.stdin.readline().strip()

def main():
	for t in range(int(input())):
		n = int(input())
		l = get_list()
		f = []
		for i in range(n):
			for j in range(i + 1, n):
				f.append(l[i] + l[j])
		c = 0
		l.sort()
		for o in range(len(f)):
			g = [0] * 101
			i = 0
			j = n - 1
			k = 0
			while i < j:
				if l[i] + l[j] == f[o]:
					k += 1
					i += 1
					j -= 1
				elif l[i] + l[j] > f[o]:
					j -= 1
				else:
					i += 1
			c = max(c, k)
		print(c)
py2 = round(0.5)
if py2:
	from future_builtins import ascii, filter, hex, map, oct, zip
	range = xrange
import os, sys
from io import IOBase, BytesIO
BUFSIZE = 8192

class FastIO(BytesIO):
	newlines = 0

	def __init__(self, file):
		self._file = file
		self._fd = file.fileno()
		self.writable = 'x' in file.mode or 'w' in file.mode
		self.write = super(FastIO, self).write if self.writable else None

	def _fill(self):
		s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
		self.seek((self.tell(), self.seek(0, 2), super(FastIO, self).write(s))[0])
		return s

	def read(self):
		while self._fill():
			pass
		return super(FastIO, self).read()

	def readline(self):
		while self.newlines == 0:
			s = self._fill()
			self.newlines = s.count(b'\n') + (not s)
		self.newlines -= 1
		return super(FastIO, self).readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.getvalue())
			(self.truncate(0), self.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		if py2:
			self.write = self.buffer.write
			self.read = self.buffer.read
			self.readline = self.buffer.readline
		else:
			self.write = lambda s: self.buffer.write(s.encode('ascii'))
			self.read = lambda : self.buffer.read().decode('ascii')
			self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


try:
	t = int(input())
	for _ in range(t):
		l = int(input())
		arr1 = list(map(int, input().split()))
		arr1.sort()
		ans = 0
		for k in range(1, 101):
			(i, j) = (0, l - 1)
			c = 0
			while i < j:
				if arr1[i] + arr1[j] == k:
					i += 1
					j -= 1
					c += 1
				elif arr1[i] + arr1[j] < k:
					i += 1
				else:
					j -= 1
			ans = max(ans, c)
		print(ans)
except EOFError:
	pass


test = int(input())
for _ in range(test):
	n = int(input())
	arr = list(map(int, input().split()))
	arr = sorted(arr)
	max_ = 0
	for x in range(2, 2 * n + 1):
		i = 0
		j = n - 1
		count = 0
		while i < j:
			if arr[i] + arr[j] > x:
				j -= 1
			elif arr[i] + arr[j] < x:
				i += 1
			else:
				count += 1
				(i, j) = (i + 1, j - 1)
		max_ = max(count, max_)
	print(max_)


T = int(input())
for _ in range(T):
	N = int(input())
	arr = [int(x) for x in input().split()]
	d = {}
	for a in arr:
		d[a] = d.get(a, 0) + 1
	p = set()
	for i in range(N - 1):
		for j in range(i + 1, N):
			p.add(arr[i] + arr[j])
	ans = 0
	for s in p:
		wd = d.copy()
		tot = 0
		for el in arr:
			if 2 * el == s:
				tot += wd[el] // 2
				wd[el] = 0
				continue
			tmp = min(wd.get(s - el, 0), wd[el])
			tot += tmp
			wd[s - el] = wd.get(s - el, 0) - tmp
			wd[el] -= tmp
		ans = max(tot, ans)
	print(ans)


from collections import Counter
T = int(input())
for t in range(T):
	n = int(input())
	l = list(map(int, input().split()))
	d = Counter(l)
	ans = 0
	for s in range(2, 2 * n + 1):
		curr = 0
		for i in range(1, (s + 1) // 2):
			if s - i > n:
				continue
			curr += min(d.get(i, 0), d.get(s - i, 0))
		if s % 2 == 0:
			curr += d.get(s // 2, 0) // 2
		ans = max(ans, curr)
	print(ans)


from collections import Counter
for j in range(int(input())):
	a = int(input())
	b = list(map(int, input().split()))
	b = Counter(b)
	pai = 0
	ma = float('-inf')
	for k in range(2, 2 * a + 1):
		pai = 0
		for h in b.keys():
			if k - h in b.keys():
				if h != k - h:
					pai = min(b[h], b[k - h]) + pai
				if h == k - h and b[h] > 1:
					pai = int(b[h] // 2) * 2 + pai
		if pai > ma:
			ma = pai
	print(int(ma // 2))


for t in range(int(input())):
	n = int(input())
	w = list(map(int, input().split()))
	o = [0 for i in range(101)]
	for i in range(100, 0, -1):
		ww = w.copy()
		p = 0
		pp = 0
		for now in w:
			pp = now
			try:
				ww.pop(ww.index(pp))
			except:
				continue
			if i - pp in ww:
				ww.pop(ww.index(i - pp))
				p += 1
		o.append(p)
	print(max(o))


def countSum(ar, s):
	ans = 0
	i = 0
	j = len(ar) - 1
	while i < j:
		cur = ar[i] + ar[j]
		if cur == s:
			ans += 1
			i += 1
			j -= 1
		elif cur > s:
			j -= 1
		else:
			i += 1
	return ans
t = int(input())
for l in range(t):
	n = int(input())
	ar = list(map(int, input().strip().split(' ')))
	ar.sort()
	sums = {}
	for i in range(len(ar)):
		for j in range(i + 1, len(ar)):
			s = ar[i] + ar[j]
			if s not in sums:
				sums[s] = 0
			sums[s] += 1
	ma = 0
	for i in sums:
		ma = max(ma, countSum(ar, i))
	print(ma)


t = int(input())
for _ in range(t):
	n = int(input())
	if n != 1 and n != 2:
		l1 = [int(x) for x in input().split()]
		l1.sort()
		mino = l1[0] + l1[1]
		maxo = l1[-1] + l1[-2]
		ans = 0
		j = 0
		visited = []
		for j in range(len(l1) - 1):
			for k in range(j + 1, len(l1) - 1):
				mino = l1[j] + l1[k + 1]
				temp = 0
				if mino not in visited:
					visited.append(mino)
					l2 = [mino - x for x in l1]
					for x in l1:
						if x in l2:
							l2.remove(x)
							if mino - x in l2:
								l2.remove(mino - x)
								temp += 1
							else:
								l2.append(x)
					ans = max(temp, ans)
		print(ans)
	else:
		l1 = input()
		print(int(n != 1))


nCases = int(input())
for _ in range(nCases):
	nPpl = int(input())
	Ppl = [int(x) for x in input().split()]
	weights = [0] * nPpl
	for p in Ppl:
		weights[p - 1] += 1
	counts = [0] * (nPpl * 2)
	for i in range(len(counts)):
		for j in range(int((i + 1) / 2)):
			k = i - j - 1
			if k >= nPpl:
				continue
			if j == k:
				counts[i] += int(weights[j] / 2)
			else:
				counts[i] += min(weights[j], weights[k])
	print(max(counts))


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	l1 = [0] * 103
	l2 = [0] * 103
	for i in range(n):
		l1[l[i]] += 1
	for i in range(1, 102):
		st = 1
		en = i
		temp = 0
		while st <= en:
			if st == en:
				temp += l1[st] // 2
			else:
				temp += min(l1[st], l1[en])
			st += 1
			en -= 1
		l2[i] = temp
	print(max(l2))


from sys import stdin
from collections import deque
mod = 10 ** 9 + 7
import sys
import random
sys.setrecursionlimit(10 ** 6)
from queue import PriorityQueue
from collections import Counter as cc
from bisect import bisect_right
from bisect import bisect_left
from collections import defaultdict
from math import sqrt, factorial, gcd, log2, inf, ceil
import heapq
input = lambda : sys.stdin.readline().rstrip()
from sys import stdin, stdout
from heapq import heapify, heappush, heappop
from itertools import permutations
from math import factorial as f

def ncr(n, r, p):
	num = den = 1
	for i in range(r):
		num = num * (n - i) % p
		den = den * (i + 1) % p
	return num * pow(den, p - 2, p) % p
import sys
t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	maxi = 0
	hash1 = defaultdict(set)
	hash2 = defaultdict(set)
	hash = defaultdict(int)
	l.sort()
	for i in range(n):
		for j in range(i + 1, n):
			z = l[i] + l[j]
			if i not in hash1[z] and j not in hash1[z] and (i not in hash2[z]) and (j not in hash2[z]):
				hash1[z].add(i)
				hash2[z].add(j)
				hash[z] += 1
	for i in hash:
		maxi = max(hash[i], maxi)
	print(maxi)


from collections import Counter
for _ in range(int(input())):
	n = int(input())
	w = list(map(int, input().split()))
	m = max(w)
	c = Counter(w)
	out = 0
	for i in range(2, 2 * m + 1):
		temp = 0
		for j in range(1, i // 2 + 1):
			if j != i - j:
				temp += min(c[j], c[i - j])
			else:
				temp += c[j] // 2
		out = max(out, temp)
	print(out)


for _ in range(int(input())):
	n = int(input())
	w = list(map(int, input().split()))
	ans = 0
	h = {}
	for i in w:
		if i not in h:
			h[i] = 0
		h[i] += 1
	for s in range(2, 101):
		temp = 0
		for i in h:
			if s - i in h:
				if s - i == i:
					temp += h[i] // 2 * 2
					continue
				temp += min(h[i], h[s - i])
		ans = max(ans, temp // 2)
	print(ans)


def ff(list1, n):
	list1.sort()
	mi = list1[0] + list1[1]
	ma = list1[-1] + list1[-2]
	co = 0
	for i in range(mi, ma + 1):
		su = 0
		xxxx = [0 for ii in range(n)]
		for j in range(n):
			for k in range(n):
				if list1[j] + list1[k] == i and xxxx[j] == 0 and (xxxx[k] == 0) and (k != j):
					su += 1
					xxxx[j] = 1
					xxxx[k] = 1
		if su > co:
			co = su
	return co
t = int(input())
for o in range(t):
	n = int(input())
	list1 = list(map(int, input().split()))
	list1.sort()
	if n < 2:
		print(0)
	elif n == 2 or n == 3:
		print(1)
	else:
		x = ff(list1, n)
		print(x)


from math import log2, ceil, floor
from collections import defaultdict, OrderedDict, Counter, deque
from heapq import heappush, heappop, heapify, nlargest, nsmallest, nsmallest
import re

def inp():
	return input()

def list_inp():
	return list(map(int, input().split()))

def map_inp():
	return map(int, input().split())

def int_inp():
	return int(input())

def float_int():
	return float(input())

def isprime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True
for _ in range(int_inp()):
	n = int_inp()
	w = list_inp()
	if n == 1:
		print(0)
	elif n == 2:
		print(1)
	else:
		mx = sum(nlargest(2, w))
		mn = sum(nsmallest(2, w))
		count = 0
		for s in range(mn, mx + 1):
			d = {}
			for i in w:
				if i in d:
					d[i] += 1
				else:
					d[i] = 1
			temp = 0
			for j in w:
				if d[j] > 0:
					d[j] -= 1
					if s - j in d and d[s - j] > 0:
						d[s - j] -= 1
						temp += 1
					else:
						d[j] += 1
			count = max(count, temp)
		print(count)


t = int(input())
for _ in range(t):
	n = int(input())
	arr = [int(j) for j in input().split()]
	count = [0] * 101
	for x in arr:
		count[x] += 1
	ans = 0
	for i in range(1, 101):
		temp = 0
		for j in range(1, i + 1):
			temp += min(count[j], count[i - j])
		temp //= 2
		ans = max(ans, temp)
	print(ans)


from collections import defaultdict

def get_max_teams_count(l):
	if len(l) == 1:
		return 0
	weight_count = defaultdict(int)
	for weight in l:
		weight_count[weight] += 1
	ans = 0
	for s in range(2 * min(l), 2 * max(l) + 1):
		cur_result = 0
		for lowest in range(min(l), s // 2 + 1):
			highest = s - lowest
			if highest == lowest:
				cur_result += weight_count[lowest] // 2
			else:
				cur_result += min(weight_count[lowest], weight_count[highest])
		ans = max(ans, cur_result)
	return ans

def main():
	t = int(input())
	for _ in range(t):
		input()
		l = list(map(int, input().split()))
		print(get_max_teams_count(l))
main()


from copy import deepcopy

def main(n, l):
	freq = {}
	for i in range(n):
		freq[l[i]] = freq.get(l[i], 0) + 1
	l.sort()
	if n <= 1:
		return 0
	min_sum = l[0] + l[1]
	max_sum = l[-1] + l[-2]
	sum_dict = {}
	for i in range(min_sum, max_sum + 1):
		sum_dict[i] = 0
	for keys in sum_dict.keys():
		temp_dict = deepcopy(freq)
		for i in range(n):
			temp_dict[l[i]] -= 1
			if temp_dict[l[i]] >= 0 and temp_dict.get(keys - l[i], 0) > 0:
				temp_dict[keys - l[i]] -= 1
				sum_dict[keys] += 1
	ans = float('-inf')
	for values in sum_dict.values():
		ans = max(ans, values)
	return ans
t = int(input())
for i in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	print(main(n, l))


MOD = 1000000007
ii = lambda : int(input())
si = lambda : input()
dgl = lambda : list(map(int, input()))
f = lambda : map(int, input().split())
il = lambda : list(map(int, input().split()))
ls = lambda : list(input())
from collections import defaultdict
for _ in range(ii()):
	n = ii()
	a = il()
	mx = 0
	for k in range(2, 101):
		c = 0
		l = [0] * 101
		for i in range(0, n):
			for j in range(i + 1, n):
				if l[i] == 0 and l[j] == 0:
					if a[i] + a[j] == k:
						c = c + 1
						l[i] = l[i] + 1
						l[j] = l[j] + 1
		mx = max(mx, c)
	print(mx)


t = int(input())
for _ in range(t):
	n = int(input())
	w = list(map(int, input().split()))
	m = {}
	for i in range(n):
		for j in range(i + 1, n):
			el = w[i] + w[j]
			if el in m:
				if i not in m[el][0] and j not in m[el][0]:
					m[el][0].add(i)
					m[el][0].add(j)
					m[el][1] += 1
			else:
				tempset = set()
				tempset.add(i)
				tempset.add(j)
				m[el] = [tempset, 1]
	answer = 0
	for i in m:
		if m[i][1] > answer:
			answer = m[i][1]
	print(answer)


from collections import Counter
import io, os, math
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
rr = lambda : input()
rri = lambda : int(input())
rrm = lambda : list(map(int, input().split()))
INF = float('inf')

def solve(N, A):
	best = 0
	for weight in range(1, 101):
		c = Counter(A)
		boats = 0
		for v in A:
			if v == weight - v and c[v] == 1:
				continue
			if weight - v in c and c[weight - v] > 0 and (c[v] > 0):
				c[weight - v] -= 1
				c[v] -= 1
				boats += 1
		best = max(boats, best)
	return best
t = rri()
for _ in range(t):
	N = rri()
	A = rrm()
	print(solve(N, A))


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	num = []
	if n == 1:
		print(0)
	else:
		l.sort()
		mi = l[0] + l[1]
		ma = l[-1] + l[-2]
		ans = 1
		for i in range(mi, ma + 1):
			l1 = l.copy()
			c = 0
			for j in range(n - 1, -1, -1):
				x = i - l1[j]
				if l1[j] < 51:
					l1[j] = 888
					if x in l1:
						c += 1
						ind = l1.index(x)
						l1[ind] = 999
			if c > ans:
				ans = c
		print(ans)


for _ in range(int(input())):
	s = int(input())
	y = list(map(int, input().split()))
	y.sort()
	if s == 1:
		print(0)
		continue
	sum = y[-1] + y[-2]
	ans = 0
	d = {}
	while sum > 0:
		m = [0] * s
		c = 0
		for i in range(s):
			for j in range(i + 1, s):
				if y[i] + y[j] == sum and m[i] != 1 and (m[j] != 1):
					m[i] = 1
					m[j] = 1
					c += 1
					break
		ans = max(c, ans)
		d[sum] = c
		sum -= 1
	print(ans)


import collections
test = int(input())
for _ in range(test):
	n = int(input())
	arr = list(map(int, input().split()))
	r = [0] * 101
	c = collections.Counter(arr)
	for x in c:
		for y in c:
			r[x + y] += min(c[x], c[y])
	print(max(r) // 2)


def solve():
	n = int(input())
	arr = [int(i) for i in input().split()]
	arr.sort()
	if n == 1:
		print(0)
		return
	su = arr[-2] + arr[-1]
	count = 0
	finalcount = 0
	for i in range(2, su + 1):
		mi = i
		i = 0
		j = len(arr) - 1
		count = 0
		while i < j:
			if arr[i] + arr[j] == mi:
				i += 1
				j -= 1
				count += 1
			elif arr[i] + arr[j] > mi:
				j -= 1
			else:
				i += 1
		finalcount = max(finalcount, count)
	print(finalcount)
test = int(input())
while test:
	solve()
	test -= 1


def counter(l, x):
	i = 0
	j = len(l) - 1
	count = 0
	while i < j:
		if l[i] + l[j] == x:
			count += 1
			i += 1
			j -= 1
		elif l[i] + l[j] < x:
			i += 1
		else:
			j -= 1
	return count
for _ in range(int(input())):
	n = int(input())
	l = [int(x) for x in input().split()]
	l.sort()
	maxi = 0
	for i in range(2, 2 * max(l) + 1):
		maxi = max(maxi, counter(l, i))
	print(maxi)


t = int(input())
for _ in range(t):
	n = int(input())
	w = list(map(int, input().split()))
	mc = 0
	for i in range(1, 101):
		li = list(w)
		c = 0
		while li:
			j = li[0]
			if i - j in li[1:]:
				li.pop(1 + li[1:].index(i - j))
				li.pop(0)
				c += 1
			else:
				li.pop(0)
		if c > mc:
			mc = c
	print(mc)


for _ in range(int(input())):
	n = int(input())
	ans = 0
	a = sorted([int(i) for i in input().split()])
	for s in range(2, 2 * n + 1):
		i = 0
		j = n - 1
		pairs = 0
		while i < j:
			if a[i] + a[j] == s:
				pairs += 1
				i += 1
				j -= 1
			elif a[i] + a[j] > s:
				j -= 1
			else:
				i += 1
			ans = max(ans, pairs)
	print(ans)


from sys import setrecursionlimit
setrecursionlimit(10 ** 9)
import threading
threading.stack_size(67108864)

def solution():
	n = int(input())
	w = sorted(map(int, input().split()))
	answer = 0
	sums = set()
	num2pos = dict()
	for i in range(n):
		if w[i] not in num2pos.keys():
			num2pos[w[i]] = set()
		num2pos[w[i]].add(i)
		for j in range(i + 1, n):
			ww = w[i] + w[j]
			sums.add(ww)
	used = set()
	for s in sums:
		used.clear()
		cur_ans = 0
		for i in range(n):
			if s - w[i] not in num2pos:
				continue
			for j in num2pos[s - w[i]]:
				if i != j and i not in used and (j not in used):
					cur_ans += 1
					used.add(j)
					used.add(i)
		answer = max(cur_ans, answer)
	print(answer)
t = int(input())
for _ in range(t):
	solution()


def getPairsCount(a, sum):
	n = len(a)
	done = [0] * n
	pair = 0
	for i in range(n):
		for j in range(i + 1, n):
			if a[i] + a[j] == sum and done[i] == 0 and (done[j] == 0):
				done[i] = 1
				done[j] = 1
				pair += 1
				break
	return pair
for _ in range(int(input())):
	n = int(input())
	w = list(map(int, input().split()))
	if n == 1:
		print(0)
	elif n == 2:
		print(1)
	else:
		w.sort()
		ans = []
		minw = w[0] + w[1]
		maxw = w[-1] + w[-2]
		for s in range(minw, maxw + 1):
			ans.append(getPairsCount(w, s))
		print(max(ans))


from collections import defaultdict as dd
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	lol = dd(int)
	for i in a:
		lol[i] += 1
	final = 0
	for Sum in range(2, 200):
		ans = 0
		d = lol.copy()
		for i in range(n):
			tar = Sum - a[i]
			if tar == a[i]:
				if d[tar] > 1:
					d[tar] -= 2
					ans += 1
				continue
			if tar > 0 and d[tar] > 0 and (d[a[i]] > 0):
				d[tar] -= 1
				d[a[i]] -= 1
				ans += 1
		final = max(ans, final)
	print(final)


t = int(input())
for tt in range(t):
	n = int(input())
	w = list(map(int, input().strip().split(' ')))
	w.sort()
	ws = dict()
	for x in w:
		if x not in ws:
			ws[x] = 1
		else:
			ws[x] += 1
	ans = 0
	for i in range(1, 101):
		s = 0
		for j in range(1, 51):
			if j in ws and i - j in ws:
				s += min([ws[j], ws[i - j]])
			ans = max([ans, s])
	print(ans // 2)


def pairs(s, arr):
	l = 0
	r = len(arr) - 1
	count = 0
	add = 0
	while l < r:
		add = arr[l] + arr[r]
		if add == s:
			count = count + 1
			l = l + 1
			r = r - 1
		elif add > s:
			r = r - 1
		else:
			l = l + 1
	return count
T = int(input())
for t in range(0, T):
	n = int(input())
	given = list(map(int, input().split()))
	if n == 1:
		print(0)
		continue
	given.sort()
	array = []
	for i in range(2, given[-1] + given[-2] + 1):
		array.append(pairs(i, given))
	print(max(array))


t = int(input())
for test_case in range(t):
	n = [int(x) for x in input().split()]
	n = n[0]
	res = 0
	w = []
	w = [int(y) for y in input().split()]
	if n == 1:
		res = 0
	else:
		w.sort()
		results = [0 for i in range(w[0] + w[1], w[-2] + w[-1] + 1)]
		new_arr = []
		for i in w:
			new_arr.append(i)
		for i in range(w[0] + w[1], w[-2] + w[-1] + 1):
			for j in range(n - 1):
				for m in range(j + 1, n):
					if new_arr[j] + new_arr[m] == i and new_arr[j] * new_arr[m] != 0:
						results[i - w[0] - w[1]] += 1
						new_arr[j] = 0
						new_arr[m] = 0
						break
			new_arr.clear()
			for i in w:
				new_arr.append(i)
		res = max(results)
	print()
	print(res)
	print()


from collections import Counter
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	b = dict(Counter(a))
	wt = {}
	c = list(b)
	for i in range(len(c)):
		y = b[c[i]] // 2
		x = 2 * c[i]
		wt[x] = wt.setdefault(x, 0) + y
		for e in range(i + 1, len(c)):
			x = c[i] + c[e]
			y = min(b[c[i]], b[c[e]])
			wt[x] = wt.setdefault(x, 0) + y
	print(max(wt.values()))


t = int(input())
for _ in range(t):
	n = int(input())
	w = list(map(int, input().split()))
	k = 0
	for s in range(2, 102):
		f = [0] * 104
		k_now = 0
		for i in range(n):
			if w[i] >= s:
				continue
			r = s - w[i]
			if f[r] != 0:
				k_now += 1
				f[r] -= 1
			else:
				f[w[i]] += 1
		k = max(k, k_now)
	print(k)


t = int(input())

def p(s):
	used = [False] * n
	d = {}
	ansl = 0
	for i in range(n):
		if a[i] not in d:
			d[a[i]] = 1
		else:
			d[a[i]] += 1
	for i in range(n):
		if s - a[i] in d:
			d[a[i]] -= 1
			if d[a[i]] + 1 and d[s - a[i]]:
				d[s - a[i]] -= 1
				ansl += 1
			else:
				d[a[i]] += 1
	return ansl
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	ans = 0
	for i in range(1, 2 * n + 1):
		ans = max(ans, p(i))
	print(ans)


t = int(input())
for i in range(t):
	n = int(input())
	w = []
	w[0:n] = map(int, input().split())
	maxw = max(w)
	minw = min(w)
	memo1 = [0] * (maxw + maxw)
	for j in w:
		memo1[j] += 1
	s = maxw + maxw
	total = -1
	for k in range(minw + minw, s + 1):
		temp = 0
		memo = memo1.copy()
		for j in w:
			if j < k:
				if j == k - j:
					if memo[k - j] > 1:
						temp += 1
						memo[k - j] -= 2
				elif memo[k - j] > 0 and memo[j] > 0:
					temp += 1
					memo[k - j] -= 1
					memo[j] -= 1
		if temp > total:
			total = temp
	print(total)


from collections import defaultdict
from functools import lru_cache
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	mp = defaultdict(int)
	vis = defaultdict(lambda : [0] * n)
	for i in range(n - 1):
		for j in range(i + 1, n):
			s = a[i] + a[j]
			if vis[s][i] == 0 and vis[s][j] == 0:
				mp[s] += 1
				vis[s][i] = 1
				vis[s][j] = 1
	res = 0

	@lru_cache(None)
	def rec(idx, mask, sm):
		if idx >= n:
			return 0
		while idx < n and mask >> idx & 1 != 0:
			idx += 1
		res = 0
		if mask >> idx & 1 == 0:
			for i in range(idx + 1, n):
				if mask >> i & 1 == 0 and a[idx] + a[i] == sm:
					res = max(res, 1 + rec(idx + 1, mask | 1 << idx | 1 << i, sm))
		return res
	res = 0
	for i in mp.keys():
		res = max(res, mp[i])
	print(res)


import sys
t = int(input())
for _ in range(t):
	n = int(input())
	A = [int(x) for x in input().split()]
	(fre, ans) = ([0] * 105, 0)
	for i in A:
		fre[i] += 1
	for i in range(0, 101):
		fre2 = fre.copy()
		temp = 0
		for j in A:
			if fre2[j] == 0 or i - j < 0:
				continue
			fre2[j] -= 1
			if fre2[i - j] > 0:
				temp += 1
				fre2[i - j] -= 1
		ans = max(ans, temp)
	print(ans)


def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		w = list(map(int, input().split()))
		d = {}
		for i in w:
			if i not in d:
				d[i] = 1
			else:
				d[i] += 1
		combos = set()
		for i in range(n):
			for j in range(n):
				if i == j:
					continue
				combos.add(w[i] + w[j])
		M = 0
		for s in combos:
			taken = {}
			good = 0
			for k in w:
				if k in taken and taken[k] == d[k]:
					continue
				need = s - k
				if need in d and (need not in taken or taken[need] < d[need]):
					if need == k:
						if need in taken:
							if d[k] - taken[k] == 1:
								continue
						elif d[k] == 1:
							continue
					good += 1
					if need in taken:
						taken[need] += 1
					else:
						taken[need] = 1
					if k in taken:
						taken[k] += 1
					else:
						taken[k] = 1
			M = max(M, good)
		print(M)
main()


t = int(input())
for p in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	s = set()
	for i in range(n):
		for j in range(i + 1, n):
			s.add(a[i] + a[j])
	max_cnt = 0
	for i in s:
		cnt = 0
		pair = []
		for j in range(n):
			if i - a[j] > 0:
				if i - a[j] not in pair:
					pair.append(a[j])
				else:
					cnt += 1
					pair.remove(i - a[j])
		max_cnt = max(max_cnt, cnt)
	print(max_cnt)


for _ in range(int(input())):
	n = int(input())
	w = list(map(int, input().split()))
	d = {}
	v = {}
	for i in range(n):
		if str(w[i]) in d:
			d[str(w[i])] += 1
		else:
			d[str(w[i])] = 1
			v[str(w[i])] = False
	ans = 0
	for i in range(min(w), max(w) * 2 + 1):
		vis = dict(v)
		t = 0
		m = 0
		for j in vis:
			if str(i - int(j)) in vis and vis[j] == False:
				vis[j] = True
				vis[str(i - int(j))] = True
				y = min(d[j], d[str(i - int(j))])
				if str(i - int(j)) == j:
					y = d[j] // 2
				t += y
			else:
				m = max(m, d[j])
		ans = max(ans, t, m // 2)
	print(ans)


from sys import stdin
import sys
tt = int(stdin.readline())
for loop in range(tt):
	n = int(stdin.readline())
	a = list(map(int, stdin.readline().split()))
	lis = [0] * (n * 2 + 1)
	for i in a:
		lis[i] += 1
	ans = 0
	for i in range(n * 2 + 1):
		now = 0
		for j in range(n * 2 + 1):
			if j * 2 == i:
				now += lis[j] // 2
			elif j * 2 < i:
				now += min(lis[j], lis[i - j])
		ans = max(ans, now)
	print(ans)


import sys, math
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	cur = 2
	a = sorted(a)
	ans = 1
	if n == 1:
		print(0)
		continue
	while cur <= 2 * n:
		if a[0] + a[1] > cur:
			cur += 1
			continue
		elif a[-1] + a[-2] < cur:
			cur += 1
			continue
		else:
			cc = 0
			mas = []
			for i in range(n):
				for j in range(i + 1, n):
					if a[i] + a[j] == cur and i not in mas and (j not in mas):
						cc += 1
						mas.append(i)
						mas.append(j)
			if cc > ans:
				ans = cc
			cur += 1
	print(ans)


from collections import defaultdict
for _ in range(int(input())):
	n = int(input())
	w = list(map(int, input().split()))
	wts = [0] * 51
	for i in w:
		wts[i] += 1
	sums = defaultdict(int)
	for i in range(1, 51):
		for j in range(i, 51):
			if i == j:
				sums[i + j] += wts[i] // 2
			else:
				sums[i + j] += min(wts[i], wts[j])
	m = 0
	for i in sums:
		if sums[i] > m:
			m = sums[i]
	print(m)


for i in range(int(input())):
	n = int(input())
	weights = [*map(int, input().split())]
	count = [0] * 101
	for weight in weights:
		count[weight] += 1
	ans = 0
	for i in range(1, 101):
		temp = 0
		for j in range(1, i + 1):
			temp += min(count[j], count[i - j])
		temp //= 2
		ans = max(ans, temp)
	print(ans)


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	ans = set()
	for i in range(n):
		for j in range(i + 1, n):
			ans.add(arr[i] + arr[j])
	pt = 0
	arr.sort()
	for i in ans:
		ct = 0
		t = 0
		h = n - 1
		while h > t:
			if i == arr[t] + arr[h]:
				t += 1
				h -= 1
				ct += 1
			elif i > arr[t] + arr[h]:
				t += 1
			else:
				h -= 1
		pt = max(pt, ct)
	print(pt)


def solve(lst):
	cnt = {}
	for i in lst:
		if i not in cnt:
			cnt[i] = 1
			continue
		cnt[i] += 1
	ans = 0
	for i in range(2, 2 * len(lst) + 1):
		total = 0
		for j in cnt:
			if i - j in cnt and cnt[i - j] >= 1:
				total += min(cnt[j], cnt[i - j])
		total //= 2
		ans = max(ans, total)
	print(ans)
t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split(' ')))
	solve(l)


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	ga = 0
	for i in range(1, 2 * n + 1):
		(j, k) = (0, n - 1)
		flag = True
		ans = 0
		while j < k:
			if a[j] + a[k] > i:
				k -= 1
			elif a[j] + a[k] < i:
				j += 1
			else:
				j += 1
				k -= 1
				ans += 1
		ga = max(ans, ga)
	print(ga)


from collections import defaultdict
t = int(input())
for _ in range(t):
	n = int(input())
	w = list(map(int, input().split()))
	counts = defaultdict(int)
	for x in w:
		counts[x] += 1
	m = 0
	for s in range(2, n * 2 + 1):
		count = 0
		for x in list(counts.keys()):
			xcount = counts[x]
			if x < s - x:
				c = counts[s - x]
				count += min(c, xcount)
			elif x == s - x:
				count += xcount // 2
		m = max(m, count)
	print(m)


from os import path
import sys
from heapq import heappush, heappop, heapify
from functools import cmp_to_key as ctk
from collections import deque, defaultdict as dd
from bisect import bisect, bisect_left, bisect_right, insort, insort_left, insort_right
from itertools import permutations
from datetime import datetime
from math import ceil, sqrt, log, gcd

def ii():
	return int(input())

def si():
	return input().rstrip()

def mi():
	return map(int, input().split())

def li():
	return list(mi())
abc = 'abcdefghijklmnopqrstuvwxyz'
mod = 1000000007
inf = float('inf')
vow = ['a', 'e', 'i', 'o', 'u']
(dx, dy) = ([-1, 1, 0, 0], [0, 0, 1, -1])

def b(i):
	return ord(i) - ord('a')
file = 1

def solve():
	for _ in range(ii()):
		n = ii()
		a = li()
		if n == 1:
			print(0)
			continue
		a.sort()
		mnx = a[0] + a[1]
		mx = a[n - 1] + a[n - 2]
		m = dd(int)
		for i in a:
			m[i] += 1
		ans = 0
		for i in range(mnx, mx + 1):
			cnt = 0
			vis = {}
			for j in m.keys():
				if j in vis:
					continue
				x = i - j
				if x <= 0:
					continue
				if x == j:
					cnt += m[j] // 2
				elif x in m:
					cnt += min(m[j], m[x])
					vis[x] = 1
			ans = max(ans, cnt)
		print(ans)
if file:
	if path.exists('input.txt'):
		sys.stdin = open('input.txt', 'r')
		sys.stdout = open('output.txt', 'w')
	else:
		input = sys.stdin.readline
solve()


def equipos(lista_pesos):
	sumas = {}
	conjunto = set(lista_pesos)
	lista_pesos.sort()
	for i in conjunto:
		sumas[i] = lista_pesos.count(i)
	if len(lista_pesos) == 1:
		return 0
	suma_minima = lista_pesos[0] + lista_pesos[1]
	suma_maxima = lista_pesos[-1] + lista_pesos[-2]
	repeticion = []
	for i in range(suma_minima, suma_maxima + 1):
		cada_suma = []
		for numero in conjunto:
			objetivo = i - numero
			if objetivo <= 0:
				continue
			elif objetivo == numero:
				if sumas[objetivo] == 1:
					continue
				else:
					cada_suma.append(sumas[objetivo] // 2)
			elif objetivo in sumas and objetivo != numero:
				cada_suma.append(min(sumas[objetivo], sumas[numero]) / 2)
		repeticion.append(sum(cada_suma))
	return int(max(repeticion))
tests = int(input())
for i in range(tests):
	personas = int(input())
	lista_pesos = list(map(int, input().split()))
	print(equipos(lista_pesos))


from collections import defaultdict
t = int(input())
for _ in range(t):
	n = int(input())
	d = defaultdict(int)
	w = list(map(int, input().split()))
	w.sort()
	maxcount = 0
	for i in range(n - 1):
		for j in range(i + 1, n):
			arr = w[:i] + w[i + 1:j] + w[j + 1:]
			l = 0
			r = len(arr) - 1
			target = w[i] + w[j]
			count = 1
			while l < r:
				if arr[l] + arr[r] == target:
					count += 1
					l += 1
					r -= 1
				elif arr[l] + arr[r] > target:
					r -= 1
				else:
					l += 1
			maxcount = max(count, maxcount)
	print(maxcount)


for I in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	tempdic = {}
	if n > 1:
		for num in a:
			if num not in tempdic:
				tempdic[num] = 1
			else:
				tempdic[num] += 1
		start = a[0] + a[1]
		end = a[-1] + a[-2]
		result = 0
		for lookfor in range(start, end + 1):
			dic = tempdic.copy()
			count = 0
			for i in range(n):
				if a[i] >= lookfor:
					break
				temp = lookfor - a[i]
				if temp == a[i]:
					if temp in dic and dic[temp] >= 2:
						count += 1
						dic[temp] -= 2
				elif temp in dic and dic[temp] > 0 and (dic[a[i]] > 0):
					dic[a[i]] -= 1
					dic[temp] -= 1
					count += 1
			result = max(result, count)
		print(result)
	else:
		print(0)


def solve(n, w):
	if n <= 2:
		return n // 2
	counts = {}
	for x in w:
		counts[x] = counts.get(x, 0) + 1
	max_num_work = 0
	for s in range(w[0] + w[1], w[-2] + w[-1] + 1):
		num_work = 0
		for x in counts.keys():
			if x < s / 2:
				num_work += min(counts[x], counts.get(s - x, 0))
			elif x == s / 2:
				num_work += counts[x] // 2
			else:
				break
		if num_work > max_num_work:
			max_num_work = num_work
	return max_num_work
t = int(input())
for _ in range(t):
	n = int(input())
	w = sorted(list(map(int, input().split())))
	print(solve(n, w))


import sys
from collections import deque

def solve(W):
	W.sort()
	n = len(W)
	unique_sums = range(2 * min(W), 2 * max(W) + 1)
	max_cnt = 0
	for s in unique_sums:
		cnt = 0
		st = deque(W)
		while len(st) > 1:
			if st[0] + st[-1] == s:
				cnt += 1
				st.popleft()
				st.pop()
			elif st[0] + st[-1] > s:
				st.pop()
			else:
				st.popleft()
		max_cnt = max(max_cnt, cnt)
	return max_cnt
IN = [x.strip() for x in sys.stdin.readlines()]
T = int(IN[0])
cur = 1
for ti in range(T):
	W = [int(x) for x in IN[cur + 1].split(' ')]
	print(solve(W))
	cur += 2


for t in range(int(input())):
	n = int(input())
	w = list(map(int, input().split()))
	counts = {}
	sum = 0
	for i in w:
		sum += i
		if i in counts:
			counts[i] += 1
		else:
			counts[i] = 1
	sums = {}
	keys = list(counts.keys())
	for a in range(len(keys)):
		for b in range(a, len(keys)):
			i = keys[a]
			j = keys[b]
			if i != j:
				if i + j in sums:
					sums[i + j] += min(counts[i], counts[j])
				else:
					sums[i + j] = min(counts[i], counts[j])
			elif i + j in sums:
				sums[i + j] += counts[i] // 2
			else:
				sums[i + j] = counts[i] // 2
	print(max(sums.values()))


from sys import stdin
import math

def Convert(lst):
	res_dct = {lst[i]: lst[i + 1] for i in range(0, len(lst), 2)}
	return res_dct
T = int(stdin.readline())
for _ in range(T):
	N = int(stdin.readline())
	a = [int(x) for x in stdin.readline().split()]
	a.sort()
	v = []
	for i in range(101):
		v.append(0)
	for i in range(N):
		v[a[i]] += 1
	ans = 0
	for s in range(1, 101):
		cnt = 0
		for i in range(1, int(s / 2) + 1):
			if i * 2 != s:
				cnt += min(v[i], v[s - i])
			else:
				cnt += int(v[i]) / 2
		ans = max(ans, cnt)
	print(int(ans))


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split(' ')))
	d = {i: 0 for i in range(1, 101)}
	for sumv in d:
		temp = {}
		for i in arr:
			if i in temp:
				temp[i] += 1
			else:
				temp[i] = 1
		for i in temp:
			if sumv - i in temp:
				if i != sumv - i and temp[i] > 0 and (temp[sumv - i] > 0):
					v = min(temp[i], temp[sumv - i])
					temp[i] -= v
					temp[sumv - i] -= v
					d[sumv] += v
				elif i == sumv - i and temp[i] > 1:
					v = temp[i] // 2
					temp[i] -= v
					d[sumv] += v
	print(max(d.values()))


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	ans = 0
	for s in range(2, 2 * n + 1):
		count = 0
		(i, j) = (0, n - 1)
		while i < j:
			if l[i] + l[j] == s:
				count += 1
				i += 1
				j -= 1
			elif l[i] + l[j] > s:
				j -= 1
			else:
				i += 1
		ans = max(ans, count)
	print(ans)


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	if n == 1:
		print(0)
	else:
		l.sort()
		minsum = l[0] + l[1]
		maxsum = l[n - 1] + l[n - 2]
		m = 0
		for i in range(minsum, maxsum + 1):
			s = i
			c = 0
			el = [0] * n
			for j in range(n):
				if l[j] > s or el[j] == 1:
					continue
				x = s - l[j]
				for k in range(n):
					if l[k] > s:
						break
					if l[k] == x and j != k and (el[k] == 0):
						c += 1
						el[k] = 1
						if el[j] == 0:
							el[j] = 1
						break
			m = max(m, c)
		print(m)


test_cases = int(input())
for test_case in range(test_cases):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	min = a[0]
	max = a[-1]
	count = 0
	maxm = 0
	for s in range(min, max * 2 + 1):
		x = []
		for i in a:
			x.append(i)
		while len(x) > 1:
			if x[0] + x[-1] == s:
				count += 1
				x.pop(0)
				x.pop(-1)
				if len(x) <= 1:
					break
			if x[0] + x[-1] > s:
				x.pop(-1)
				if len(x) <= 1:
					break
			if x[0] + x[-1] < s:
				x.pop(0)
				if len(x) <= 1:
					break
		if count > maxm:
			maxm = count
		count = 0
	print(maxm)


t = int(input())
while t:
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	max_sum = arr[n - 1] + arr[n - 2]
	solution = 0
	while max_sum > arr[0]:
		temp_arr = arr[:]
		count = 0
		while len(temp_arr) > 1:
			flag = False
			index = temp_arr[0]
			for i in range(1, len(temp_arr)):
				if index + temp_arr[i] == max_sum:
					count = count + 1
					del temp_arr[0]
					del temp_arr[i - 1]
					flag = True
					break
			if flag == False:
				del temp_arr[0]
		if count > solution:
			solution = count
		max_sum = max_sum - 1
		temp_arr.clear()
	print(solution)
	t = t - 1


import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush, nsmallest
from math import ceil, floor, gcd, fabs, factorial, fmod, sqrt, inf
from collections import defaultdict as dd, deque, Counter as C
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
from time import perf_counter
from fractions import Fraction
from decimal import Decimal
mod = pow(10, 9) + 7
mod2 = 998244353

def data():
	return sys.stdin.readline().strip()

def out(var):
	sys.stdout.write(str(var) + '\n')

def outa(*var, end='\n'):
	sys.stdout.write(' '.join(map(str, var)) + end)

def l():
	return list(sp())

def sl():
	return list(ssp())

def sp():
	return map(int, data().split())

def ssp():
	return map(str, data().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(n, val) for j in range(m)]
for _ in range(int(data())):
	n = int(data())
	arr = l()
	if n == 1:
		out(0)
		continue
	c = set()
	arr.sort()
	for i in range(n):
		for j in range(i + 1, n):
			c.add(arr[i] + arr[j])
	answer = 0
	for m in c:
		(i, j) = (0, n - 1)
		cnt = 0
		while i < j:
			if arr[i] + arr[j] == m:
				cnt += 1
				i += 1
				j -= 1
			elif arr[i] + arr[j] < m:
				i += 1
			else:
				j -= 1
		answer = max(cnt, answer)
	out(answer)


import collections

def count_teams(S, A):
	counts = collections.Counter()
	total_teams = 0
	for n in A:
		diff = S - n
		if diff in counts and counts[diff] > 0:
			total_teams += 1
			counts[diff] -= 1
		else:
			counts[n] += 1
	return total_teams

def solve(N, A):
	if N <= 1:
		return 0
	if N == 2:
		return 1
	A.sort()
	(L, R) = (A[0] + A[1], A[-1] + A[-2])
	max_so_far = 0
	for s in range(L, R + 1):
		max_so_far = max(max_so_far, count_teams(s, A))
	return max_so_far

def main():
	T = int(input())
	for _ in range(T):
		N = int(input())
		A = list(map(int, input().split()))
		ans = solve(N, A)
		print(ans)
main()


for i in range(int(input())):
	n = int(input())
	w = list(map(int, input().split()))
	hj = dict()
	for i in range(n):
		if w[i] in hj:
			hj[w[i]] += 1
		else:
			hj[w[i]] = 1
	maxi = 0
	wi = list(set(w))
	for jpt in range(1, 101):
		count = 0
		for i in range(len(wi)):
			if jpt - wi[i] in hj:
				count += min(hj[wi[i]], hj[jpt - wi[i]])
		maxi = max(maxi, count)
	print(maxi // 2)


def main(args):
	t = int(input())
	for i in range(t):
		n = int(input())
		arr1 = list(map(int, input().split()))
		arr1.sort()
		m = {}
		for i in arr1:
			if i in m:
				m[i] += 1
			else:
				m[i] = 1
		ma = {}
		arr1 = list(set(arr1))
		for i in m:
			if m[i] >= 2:
				ma[i * 2] = m[i] // 2
		for i in range(len(arr1) - 1):
			for j in range(i + 1, len(arr1)):
				if arr1[i] + arr1[j] in ma:
					ma[arr1[i] + arr1[j]] += min(m[arr1[i]], m[arr1[j]])
				else:
					ma[arr1[i] + arr1[j]] = min(m[arr1[i]], m[arr1[j]])
		if ma != {}:
			print(max(max(ma.values()), max(m.values()) // 2))
		else:
			print(max(m.values()) // 2)
import sys
sys.exit(main(sys.argv))


import os, sys, time, collections, math, pprint, itertools as it, operator as op, bisect as bs, functools as fn
(maxx, localsys, mod) = (1 << 60, 0, int(1000000000.0 + 7))
nCr = lambda n, r: reduce(mul, range(n - r + 1, n + 1), 1) // factorial(r)
ceil = lambda n, x: (n + x - 1) // x
(osi, oso) = ('/home/priyanshu/Documents/cp/input.txt', '/home/priyanshu/Documents/cp/output.txt')
if os.path.exists(osi):
	sys.stdin = open(osi, 'r')
	sys.stdout = open(oso, 'w')
input = sys.stdin.readline
from functools import reduce

def maps():
	return map(int, input().split())
for _ in range(int(input())):
	n = int(input())
	a = list(maps())
	d = collections.defaultdict(set)
	for i in range(n):
		for j in range(n):
			if i != j:
				x = tuple(sorted([i, j]))
				d[a[i] + a[j]].add(x)
	ans = 0
	for i in d:
		p = [1] * n
		for j in d[i]:
			if p[j[0]] > 0 and p[j[1]] > 0:
				p[j[0]] = -1
				p[j[1]] = -1
		ans = max(ans, len([i for i in p if i == -1]) // 2)
	print(ans)


from collections import defaultdict

def fast(arr):
	result = 0
	table = defaultdict(set)
	for i in range(len(arr)):
		for j in range(i + 1, len(arr)):
			S = arr[i] + arr[j]
			if i not in table[S] and j not in table[S]:
				table[S] |= set([i, j])
	if len(table) == 0:
		return 0
	maxKey = max(table, key=lambda k: len(table[k]))
	return len(table[maxKey]) // 2

def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		arr = list(map(int, input().split()))
		result = fast(arr)
		print(result)

def test():
	arr = [1]
	result = fast(arr)
	print(result)
main()


import os
import sys
from io import BytesIO, IOBase
import math

def main():
	pass
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
import os
import sys
from io import BytesIO, IOBase

def main():
	pass
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
for xyz in range(0, int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	ans = 0
	cnt = [0] * 500
	for i in l:
		cnt[i] += 1
	ans = 0
	for i in range(2, 101):
		ca = 0
		for j in range(1, 51):
			if j >= i:
				break
			if i % 2 == 0 and j == i // 2:
				ca += cnt[j] // 2
				ans = max(ans, ca)
			else:
				ca += min(cnt[j], cnt[i - j])
		ans = max(ans, ca // 2)
	print(ans)


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	t = arr[:]
	t.sort()
	if len(t) > 1:
		minn = t[0] + t[1]
		maxx = t[-1] + t[-2]
		m = 0
		for summ in range(minn, maxx + 1):
			ans = 0
			t = arr[:]
			for i in range(n - 1):
				if t[i]:
					for j in range(i + 1, n):
						if t[i] + t[j] == summ and t[i] > 0 and (t[j] > 0):
							ans += 1
							t[i] = 0
							t[j] = 0
							break
			m = max(m, ans)
		print(m)
	else:
		print(0)


import collections

def count(wt, f, w):
	cnt = 0
	for val in w:
		if val * 2 > wt:
			break
		elif val * 2 == wt:
			cnt += f[val] // 2
		elif wt - val in f:
			cnt += min(f[wt - val], f[val])
	return cnt
for _ in range(int(input())):
	n = int(input())
	w = list(map(int, input().split()))
	freq = collections.Counter(w)
	team = 0
	key = sorted(list(freq.keys()))
	for wt in range(min(key) * 2, max(key) * 2 + 1):
		team = max(team, count(wt, freq, key))
	print(team)


from collections import Counter, defaultdict
from itertools import combinations_with_replacement

def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		W = list(map(int, input().split()))
		c = Counter(W)
		S = set(W)
		ans = defaultdict(int)
		for (a, b) in combinations_with_replacement(S, 2):
			ans[a + b] += min(c[a], c[b]) if a != b else c[a] // 2
		print(max(ans.values()))
main()


for _ in range(int(input())):
	N = int(input())
	l = list(map(int, input().split()))
	d = {}
	for i in range(N - 1):
		for j in range(i + 1, N):
			a = l[i] + l[j]
			if a not in d.keys():
				d[a] = [i, j]
			elif i not in d[a] and j not in d[a]:
				d[a].append(i)
				d[a].append(j)
	c = 0
	for i in d:
		c = max(c, len(d[i]))
	print(c // 2)


from collections import defaultdict
for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	temp = defaultdict(list)
	d = dict()
	if n == 1:
		print(0)
	else:
		for i in range(n - 1):
			for j in range(i + 1, n):
				ans = arr[i] + arr[j]
				if i not in temp[ans] and j not in temp[ans]:
					temp[ans].append(i)
					temp[ans].append(j)
					d[ans] = d.get(ans, 0) + 1
		print(max(d.values()))


def fact(x):
	if x == 0:
		return 1
	else:
		return x * fact(x - 1)

def lower_bound(li, num):
	answer = len(li) - 1
	start = 0
	end = len(li) - 1
	while start <= end:
		middle = (end + start) // 2
		if li[middle] >= num:
			answer = middle
			end = middle - 1
		else:
			start = middle + 1
	return answer

def upper_bound(li, num):
	answer = -1
	start = 0
	end = len(li) - 1
	while start <= end:
		middle = (end + start) // 2
		if li[middle] <= num:
			answer = middle
			start = middle + 1
		else:
			end = middle - 1
	return answer

def abs(x):
	return x if x >= 0 else -x

def binary_search(li, val, lb, ub):
	ans = 0
	while lb <= ub:
		mid = (lb + ub) // 2
		if li[mid] > val:
			ub = mid - 1
		elif val > li[mid]:
			lb = mid + 1
		else:
			ans = 1
			break
	return ans

def sieve_of_eratosthenes(n):
	ans = []
	arr = [1] * (n + 1)
	(arr[0], arr[1], i) = (0, 0, 2)
	while i * i <= n:
		if arr[i] == 1:
			j = i + i
			while j <= n:
				arr[j] = 0
				j += i
		i += 1
	for k in range(n):
		if arr[k] == 1:
			ans.append(k)
	return ans

def nc2(x):
	if x == 1:
		return 0
	else:
		return x * (x - 1) // 2

def kadane(x):
	sum_so_far = 0
	current_sum = 0
	for i in x:
		current_sum += i
		if current_sum < 0:
			current_sum = 0
		else:
			sum_so_far = max(sum_so_far, current_sum)
	return sum_so_far

def mex(li):
	check = [0] * 1001
	for i in li:
		check[i] += 1
	for i in range(len(check)):
		if check[i] == 0:
			return i

def sumdigits(n):
	ans = 0
	while n != 0:
		ans += n % 10
		n //= 10
	return ans

def product(li):
	ans = 1
	for i in li:
		ans *= i
	return ans

def maxpower(n, k):
	cnt = 0
	while n > 1:
		cnt += 1
		n //= k
	return cnt

def knapsack(li, sumi, s, n, dp):
	if s == sumi // 2:
		return 1
	elif n == 0:
		return 0
	elif dp[n][s] != -1:
		return dp[n][s]
	else:
		if li[n - 1] <= s:
			dp[n][s] = knapsack(li, sumi, s - li[n - 1], n - 1, dp) or knapsack(li, sumi, s, n - 1, dp)
		else:
			dp[n][s] = knapsack(li, sumi, s, n - 1, dp)
		return dp[n][s]

def pref(li):
	pref_sum = [0]
	for i in li:
		pref_sum.append(pref_sum[-1] + i)
	return pref_sum
from math import *
from collections import deque
max_steps = 100005
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	dic = {}
	for i in a:
		dic[i] = 1 if i not in dic else dic[i] + 1
	ans = 0
	for i in range(2, 101):
		temp = 0
		for j in dic:
			if i - j in dic:
				temp += min(dic[j], dic[i - j])
		temp //= 2
		ans = max(ans, temp)
	print(ans)


for _ in range(int(input())):
	n = int(input())
	w = list(map(int, input().split()))
	if n == 1:
		print(0)
		continue
	cnts = {}
	for wi in w:
		if wi not in cnts:
			cnts[wi] = 1
		else:
			cnts[wi] += 1
	max_ans = 1
	for s in range(2, 2 * n + 1):
		ans = 0
		cnts_copy = dict(cnts)
		while len(cnts_copy) != 0:
			item = cnts_copy.popitem()
			if item[1] > 1:
				cnts_copy[item[0]] = item[1] - 1
			if s - item[0] in cnts_copy:
				ans += 1
				if cnts_copy[s - item[0]] == 1:
					cnts_copy.pop(s - item[0])
				else:
					cnts_copy[s - item[0]] -= 1
		max_ans = max(ans, max_ans)
	print(max_ans)


def main():
	Tquery = int(input())
	for _ in range(Tquery):
		_ = int(input())
		W = [int(i) for i in input().split()]
		cnt = [0] * 101
		for w in W:
			cnt[w] += 1
		ans = 0
		for s in range(2, 101):
			cur = 0
			for i in range(1, s // 2 + 1):
				if i != s - i:
					cur += min(cnt[i], cnt[s - i])
				else:
					cur += cnt[i] // 2
			ans = max(ans, cur)
		print(ans)
main()


def boatsCompetition(n, array):
	d = {}
	for y in array:
		if y in d:
			d[y] += 1
		else:
			d[y] = 1
	maxTeams = 0
	for x in range(2, 2 * n + 1):
		teams = 0
		for i in d:
			if i < x and x - i in d:
				teams += min(d[i], d[x - i])
		teams = teams // 2
		if teams > maxTeams:
			maxTeams = teams
	return maxTeams
t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	print(boatsCompetition(n, l))


import os
import heapq
import sys, threading
import math
import bisect
import operator
from collections import defaultdict
sys.setrecursionlimit(10 ** 5)
from io import BytesIO, IOBase

def gcd(a, b):
	if b == 0:
		return a
	else:
		return gcd(b, a % b)

def power(x, p, m):
	res = 1
	while p:
		if p & 1:
			res = res * x % m
		x = x * x % m
		p >>= 1
	return res

def inar():
	return [int(k) for k in input().split()]

def lcm(num1, num2):
	return num1 * num2 // gcd(num1, num2)

def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		arr = inar()
		ans = 0
		arr.sort()
		dic = {}
		for i in range(n):
			if arr[i] not in dic:
				dic[arr[i]] = 1
			else:
				dic[arr[i]] += 1
		dic = dict(sorted(dic.items(), key=operator.itemgetter(1), reverse=True))
		for i in range(2, 100 + 1):
			temp = 0
			take = {}
			for (key, item) in dic.items():
				if key not in take:
					if i - key == key:
						temp += dic[key] // 2
					elif i - key in dic:
						temp += min(dic[key], dic[i - key])
					take[key] = 1
					take[i - key] = 1
			ans = max(ans, temp)
		print(ans)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


mod = 10 ** 9 + 7

def f(a, sum):
	ret = 0
	l = 0
	r = len(a) - 1
	while l < r:
		if a[l] + a[r] > sum:
			r -= 1
		elif a[l] + a[r] < sum:
			l += 1
		else:
			ret += 1
			l += 1
			r -= 1
	return ret

def solve():
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	ans = 0
	for i in range(n):
		for j in range(i + 1, n):
			ans = max(ans, f(a, a[i] + a[j]))
	print(ans)
t = 1
t = int(input())
for _ in range(t):
	solve()


t = int(input())
for i in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	d = {}
	for j in range(n):
		if l[j] in d:
			d[l[j]] += 1
		else:
			d[l[j]] = 1
	maxcount = 0
	for j in range(2, 101):
		dnew = d.copy()
		count = 0
		for k in l:
			if j - k in dnew and dnew[j - k] > 0 and (dnew[k] > 0):
				if j - k != k or (j - k == k and dnew[k] > 1):
					count += 1
					dnew[k] -= 1
					dnew[j - k] -= 1
		maxcount = max(count, maxcount)
	print(maxcount)


t = int(input())
while t != 0:
	t = t - 1
	n = int(input())
	a = list(map(int, input().split()))
	max1 = max(a)
	d = dict()
	for i in a:
		if d.get(i):
			d[i] = d[i] + 1
		else:
			d[i] = 1
	max2 = 0
	for i in range(2, 2 * max1 + 1):
		d1 = d.copy()
		c = 0
		for j in a:
			if j < i and d1[j] != 0 and (d1.get(i - j) != None):
				d1[j] = d1[j] - 1
				if d1.get(i - j) != 0:
					d1[i - j] = d1[i - j] - 1
					c = c + 1
				else:
					d1[j] = d1[j] + 1
		if max2 < c:
			max2 = c
	print(max2)


import sys, math, itertools
from collections import Counter, deque, defaultdict
from bisect import bisect_left, bisect_right
from heapq import heappop, heappush, heapify, nlargest
from copy import deepcopy
mod = 10 ** 9 + 7
INF = float('inf')

def inp():
	return int(sys.stdin.readline())

def inpl():
	return list(map(int, sys.stdin.readline().split()))

def inpl_1():
	return list(map(lambda x: int(x) - 1, sys.stdin.readline().split()))

def inps():
	return sys.stdin.readline()

def inpsl(x):
	tmp = sys.stdin.readline()
	return list(tmp[:x])

def err(x):
	print(x)
	exit()
for _ in range(inp()):
	n = inp()
	a = inpl()
	c = Counter(a)
	res = 0
	for s in range(1, 2 * n + 1):
		su = 0
		for x in range(s // 2 + 1):
			y = s - x
			if x == y:
				su += c[x] // 2
			else:
				su += min(c[x], c[y])
		res = max(res, su)
	print(res)


for t in range(int(input())):
	p = int(input())
	w = list(map(int, input().split()))
	w.sort()
	res = 0
	if p > 1:
		res = 1
		for i in range(p - 2):
			for j in range(p - 1, i + 1, -1):
				s = w[i] + w[j]
				(l, r) = (i + 1, j - 1)
				res_ij = 1
				while l < r:
					if w[l] + w[r] == s:
						res_ij += 1
						l += 1
						r -= 1
					elif w[l] + w[r] > s:
						r -= 1
					else:
						l += 1
				if res_ij > res:
					res = res_ij
	print(res)


import math
from sys import stdin, stdout
import bisect
m = 10 ** 9 + 7

def inp():
	return int(stdin.readline())

def inpstr():
	return list(stdin.readline().strip())

def inpli():
	return list(map(int, input().split()))

def inpmap():
	return map(int, input().split())

def opt(n):
	stdout.write(str(n) + '\n')

def bexp(n, p):
	r = 1
	while p > 0:
		if p % 2:
			r = r * n
			p = p - 1
		else:
			n = n ** 2
			p = p // 2
	return r

def gcd(a, b):
	while b:
		a = a % b
		(b, a) = (a, b)
	return a

def sieve(limit):
	l = [1] * (limit + 1)
	l[0] = 0
	l[1] = 0
	prime = []
	for i in range(2, limit + 1):
		if l[i]:
			for j in range(i * i, limit + 1, i):
				l[j] = 0
	for i in range(2, limit + 1):
		if l[i]:
			prime.append(i)
	return prime

def segs(low, high):
	limit = int(high ** 0.5) + 1
	prime = soe(limit)
	n = high - low + 1
	l = [0] * (n + 1)
	for i in range(len(prime)):
		lowlimit = low // prime[i] * prime[i]
		if lowlimit < low:
			lowlimit += prime[i]
		if lowlimit == prime[i]:
			lowlimit += prime[i]
		for j in range(lowlimit, high + 1, prime[i]):
			l[j - low] = 1
	for i in range(low, high + 1):
		if not l[i - low]:
			if i != 1:
				print(i)

def code():
	n = inp()
	ans = 0
	l = inpli()
	for i in range(2, 101):
		c = 0
		v = [False for i in range(n)]
		for j in range(n):
			if not v[j]:
				for k in range(n):
					if not v[k]:
						if k != j:
							if l[k] + l[j] == i:
								c += 1
								v[j] = True
								v[k] = True
								break
			if not v[j]:
				v[j] = True
		ans = max(c, ans)
	print(ans)
for _ in range(inp()):
	code()


for i in range(int(input())):
	n = int(input())
	t = list(map(int, input().split()))
	f = {}
	for j in t:
		if j not in f:
			f[j] = 1
		else:
			f[j] += 1
	ans = 0
	t.sort()
	b = list(set(t))
	for j in range(2, 2 * n + 1):
		temp = 0
		for k in b:
			if k in f and j - k in f:
				temp += min(f[k], f[j - k])
		ans = max(temp, ans)
	print(ans // 2)


for _ in range(int(input())):
	n = int(input())
	w = list(map(int, input().split()))
	w.sort()
	if n == 1:
		print(0)
	else:
		real_ans = 0
		for i in range(n - 1):
			for j in range(i + 1, n):
				ans = 1
				s = w[i] + w[j]
				ii = i + 1
				jj = j - 1
				while ii < jj:
					now = w[ii] + w[jj]
					if now == s:
						ii += 1
						jj -= 1
						ans += 1
					elif now < s:
						ii += 1
					else:
						jj -= 1
				real_ans = max(real_ans, ans)
		print(real_ans)


def q661c():
	num_cases = int(input())
	for _ in range(num_cases):
		arr_size = int(input())
		arr = [int(num) for num in input().split()]
		possible_s_set = set()
		for i in range(arr_size):
			for j in range(i + 1, arr_size):
				possible_s_set.add(arr[i] + arr[j])
		max_pairs = 0
		for s in possible_s_set:
			pairs = q661c_findMaxNumberOfPairs(s, arr, arr_size)
			if pairs > max_pairs:
				max_pairs = pairs
		print(max_pairs)

def q661c_findMaxNumberOfPairs(s, arr, arr_size):
	mask_arr = [0] * arr_size
	for i in range(arr_size):
		if mask_arr[i] == 0:
			for j in range(arr_size):
				if j != i and mask_arr[j] == 0 and (arr[i] + arr[j] == s):
					mask_arr[i] = 1
					mask_arr[j] = 1
					break
	return sum(mask_arr) // 2
q661c()


import collections
t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	cnt = collections.Counter(arr)
	ans = 0
	for sums in range(2, 2 * n + 1):
		tmp = 0
		for w in range(1, sums // 2 + 1):
			if sums % 2 == 0 and w == sums // 2:
				tmp += cnt[w] // 2
			else:
				tmp += min(cnt[w], cnt[sums - w])
		ans = max(ans, tmp)
	print(ans)


t = int(input())
for _ in range(t):
	x = int(input())
	a = list(map(int, input().split()))
	c = [0] * 51
	cnt = [0] * 101
	for i in a:
		c[i] += 1
	for i in range(51):
		for j in range(i + 1, 51):
			cnt[i + j] += min(c[i], c[j])
	for i in range(51):
		cnt[i * 2] += c[i] // 2
	print(max(cnt))


t = int(input().split()[0])
for case in range(t):
	n = int(input().split()[0])
	w = list(map(int, input().split()))
	ans = 0
	for s in range(2, n * 2 + 1):
		m = {}
		for i in range(n):
			m[i + 1] = 0
		curr = 0
		for i in range(n):
			if s - w[i] < 1 or s - w[i] > n:
				m[w[i]] += 1
			elif m[s - w[i]] > 0:
				curr += 1
				m[s - w[i]] -= 1
			else:
				m[w[i]] += 1
		if curr > ans:
			ans = curr
	print(ans)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	suma = 0
	d = dict()
	for i in range(2, 101):
		ans = 0
		for j in range(n):
			if a[j] >= i or d.get(j):
				continue
			num = i - a[j]
			for k in range(j + 1, n):
				if d.get(k):
					continue
				if a[k] == num:
					ans += 1
					d[k] = 1
					break
		suma = max(suma, ans)
		d.clear()
	print(suma)


def find(x):
	start = 0
	end = n - 1
	cnt = 0
	while start < end:
		sum = a[start] + a[end]
		if sum == x:
			cnt += 1
			start += 1
			end -= 1
		elif sum < x:
			start += 1
		else:
			end -= 1
	return cnt
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	res = 0
	for i in range(2, 101):
		res = max(res, find(i))
	print(res)


t = int(input())
for i in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	maxval = 0
	for s in range(1, 101):
		total = 0
		truth = [False for j in range(n)]
		for j in range(0, n):
			for k in range(j + 1, n):
				if l[j] + l[k] == s and truth[j] != True and (truth[k] != True):
					truth[j] = True
					truth[k] = True
					total += 1
					break
		if total > maxval:
			maxval = total
	print(maxval)


from collections import *
a = int(input())
for i in range(a):
	al = defaultdict(int)
	s = int(input())
	z = list(map(int, input().split()))
	for i in range(len(z)):
		al[z[i]] += 1
	mini = min(z) * 2
	maxt = max(z) * 2
	maxa = 0
	z = list(set(z))
	for i in range(mini, maxt + 1):
		total = 0
		c1 = 0
		c2 = 0
		for j in range(len(z)):
			x = z[j]
			y = i - z[j]
			if x == y:
				c1 += al[x] // 2
			else:
				c2 += min(al[x], al[y])
		total = c1 + c2 // 2
		maxa = max(maxa, total)
	print(maxa)


from sys import stdin, stdout
import math
input = stdin.readline

def print(*args, end='\n'):
	s = []
	for i in args:
		s.append(str(i) + ' ')
	s = ''.join(s)
	stdout.write(s + end)

def solve():
	n = int(input())
	l = list(map(int, input().split()))
	maxx = 0
	d = []
	for i in range(n):
		for j in range(n):
			if i == j:
				continue
			else:
				s = l[i] + l[j]
				d.append(s)
	d = list(set(d))
	for s in d:
		used = [False] * n
		ans = 0
		for j in range(n):
			for k in range(n):
				if j == k:
					continue
				if l[j] + l[k] == s and (not used[j]) and (not used[k]):
					ans += 1
					used[j] = True
					used[k] = True
		if ans > maxx:
			maxx = ans
	print(maxx)
tt = 1
tt = int(input())
for __ in range(tt):
	solve()


import bisect
import os
import gc
import sys
from io import BytesIO, IOBase
from collections import Counter
from collections import deque
import heapq
import math
import statistics

def sin():
	return input()

def ain():
	return list(map(int, sin().split()))

def sain():
	return input().split()

def iin():
	return int(sin())
MAX = float('inf')
MIN = float('-inf')
MOD = 1000000007

def sieve(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	s = set()
	for p in range(2, n + 1):
		if prime[p]:
			s.add(p)
	return s

def readTree(n, m):
	adj = [deque([]) for _ in range(n + 1)]
	for _ in range(m):
		(u, v) = ain()
		adj[u].append(v)
		adj[v].append(u)
	return adj

def main():
	for _ in range(iin()):
		n = iin()
		l = ain()
		c = Counter(l)
		l.sort()
		if n == 1:
			print(0)
		elif n == 2 or n == 3:
			print(1)
		else:
			maxi = l[-2] + l[-1]
			mini = l[0] + l[1]
			ans = 1
			keys = set(c.keys())
			temp = 0
			for i in range(mini, maxi + 1):
				cc = c.copy()
				temp = 0
				for k in keys:
					if i - k in keys:
						if k == i - k:
							p = cc[k] // 2
							cc[k] -= p * 2
							temp += p
						else:
							p = min(cc[k], cc[i - k])
							cc[k] -= p
							cc[i - k] -= p
							temp += p
				ans = max(ans, temp)
			print(ans)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
if os.getcwd() == 'D:\\code':
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
	input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


from time import time
from random import randint

def solve(array):
	max_teams = {}
	cur_teams = 0
	if len(array) < 4:
		print(int(len(array) > 1))
		return
	for i in range(array[0] + array[1], array[-1] + array[-2] + 1):
		max_teams[i] = 0
		arr = array[:]
		l = 0
		r = 1
		while l < len(arr) - 1:
			while r < len(arr):
				if arr[l] + arr[r] == i:
					max_teams[i] += 1
					del arr[r]
					del arr[l]
					r = l + 1
				else:
					r += 1
			l += 1
			r = l + 1
	print(max(max_teams.values()))

def submit():
	start_time = time()
	for case in range(int(input())):
		input()
		array = sorted([int(e) for e in input().split()])
		solve(array)
submit()


import io
import os
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline

def get_str():
	return input().decode().strip()

def rint():
	return map(int, input().split())

def oint():
	return int(input())
t = oint()
for _ in range(t):
	n = oint()
	if n == 1:
		tmp = oint()
		print(0)
		continue
	w = list(rint())
	ww = [0] * (n + 1)
	for i in w:
		ww[i] += 1
	max_cnt = 0
	for i in range(2, 2 * n + 1):
		cnt = 0
		v = [0] * (n + 1)
		for j in range(1, n + 1):
			if v[j]:
				break
			if j == i - j:
				v[j] = 1
				cnt += ww[j] // 2
			elif 1 <= i - j <= n:
				if v[i - j]:
					continue
				v[j] = 1
				v[i - j] = 1
				cnt += min(ww[j], ww[i - j])
		max_cnt = max(cnt, max_cnt)
	print(max_cnt)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	dic = {}
	ans = 0
	a.sort()
	q = a[-1] * 2
	for i in a:
		if i not in dic:
			dic[i] = 1
		else:
			dic[i] += 1
	for j in range(a[0], q + 1):
		d = dic.copy()
		c = 0
		for i in a:
			d[i] -= 1
			if d[i] >= 0 and j - i in d and (d[j - i] > 0):
				d[j - i] -= 1
				c += 1
		ans = max(ans, c)
	print(ans)


import math
from collections import deque
import sys
sys.setrecursionlimit(10 ** 4)

def Divisors(n):
	l = []
	i = 2
	while i <= math.sqrt(n):
		if n % i == 0:
			if n // i == i:
				l.append(i)
			else:
				l.append(i)
				l.append(n // i)
		i = i + 1
	return l

def SieveOfEratosthenes(n):
	l = []
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	for p in range(2, n + 1):
		if prime[p]:
			l.append(p)
	return l

def primeFactors(n):
	l = []
	while n % 2 == 0:
		l.append(2)
		n = n / 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			l.append(i)
			n = n / i
	if n > 2:
		l.append(n)
	return l

def Factors(n):
	result = []
	for i in range(2, int(math.sqrt(n)) + 1):
		if n % i == 0:
			if i == n / i:
				result.append(i)
			else:
				result.append(i)
				result.append(n // i)
	result.append(1)
	return result

def maxSubArraySum(a):
	max_so_far = 0
	max_ending_here = 0
	size = len(a)
	for i in range(0, size):
		max_ending_here = max_ending_here + a[i]
		if max_so_far < abs(max_ending_here):
			max_so_far = max_ending_here
	return max_so_far

def longestsubarray(arr, n, k):
	current_count = 0
	max_count = 0
	for i in range(0, n, 1):
		if arr[i] % k != 0:
			current_count += 1
		else:
			current_count = 0
		max_count = max(current_count, max_count)
	return max_count

def main():
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	c = 0
	m = 0
	for i in range(0, 2 * max(l) + 1):
		c = 0
		p = 0
		q = n - 1
		while p < q:
			if l[p] + l[q] == i:
				c += 1
				p += 1
				q -= 1
			elif l[p] + l[q] > i:
				q -= 1
			elif l[p] + l[q] < i:
				p += 1
		m = max(c, m)
	print(m)
t = int(input())
for i in range(0, t):
	main()


import sys
input = sys.stdin.buffer.readline

def solution():
	n = int(input())
	l = list(map(int, input().split()))
	ans = 0
	for s in range(101):
		flag = [0] * 51
		cnt = 0
		for i in range(n):
			if flag[i] == 0:
				for j in range(i + 1, n):
					if l[i] + l[j] == s:
						if flag[j] == 0:
							cnt += 1
							flag[j] = 1
							break
		ans = max(cnt, ans)
	print(ans)
t = int(input())
for _ in range(t):
	solution()


from sys import stdin, stdout
from math import gcd
from collections import defaultdict
input = stdin.readline
print = stdout.write

def countsumsequalton(n):
	res = 0
	for i in range(1, n // 2 + 1):
		if i == n / 2:
			res += dict[i] // 2
		else:
			res += min(dict[i], dict[n - i])
	return res

def count():
	res = 0
	for i in range(2, 101):
		res = max(res, countsumsequalton(i))
	return res
t = int(input())
for i in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	dict = defaultdict(int)
	for i in l:
		dict[i] += 1
	answer = count()
	print(str(answer) + '\n')


import sys
input = sys.stdin.readline

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

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())

def solve():
	n = inp()
	a = inlt()
	if n == 1:
		return 0
	if n == 2:
		return 1
	ans = 0
	for s in range(2, 2 * n + 1):
		nums = {}
		for i in range(n):
			if a[i] not in nums:
				nums[a[i]] = 1
			else:
				nums[a[i]] += 1
		currAns = 0
		for i in range(n):
			if s - a[i] in nums:
				if nums[s - a[i]] != 0 and nums[a[i]] != 0:
					if s - a[i] != a[i]:
						currAns += 1
						nums[s - a[i]] -= 1
						nums[a[i]] -= 1
					elif nums[a[i]] > 1:
						currAns += 1
						nums[s - a[i]] -= 1
						nums[a[i]] -= 1
		ans = max(ans, currAns)
	return ans
t = inp()
while t > 0:
	print(solve())
	t -= 1


t = int(input())
for x in range(t):
	n = int(input())
	arr = list(map(int, input().split(' ')))
	arr.sort()
	points = 0
	r = arr[n - 2] + arr[n - 1]
	tally = []
	y = arr[0]
	while y < r:
		y = y + 1
		if y <= arr[0]:
			continue
		tally = []
		tot = 0
		u = 0
		v = 1
		while u <= n - 2:
			v = u + 1
			if u in tally:
				u = u + 1
				continue
			while v <= n - 1:
				if v in tally:
					v = v + 1
					continue
				s = arr[u] + arr[v]
				if s == y:
					tally.append(u)
					tally.append(v)
					tot = tot + 1
					break
				v = v + 1
			u = u + 1
		if points < tot:
			points = tot
	print(points)


from math import *
from collections import *
from functools import *
from bisect import *
from itertools import *
from heapq import *
from statistics import *
inf = float('inf')
ninf = -float('inf')
ip = input
alphal = 'abcdefghijklmnopqrstuvwxyz'
alphau = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'

def ipl():
	return list(map(int, input().split()))

def ipn():
	return int(input())

def ipf():
	return float(input())

def solve():
	(n, a) = (ipn(), ipl())
	h = Counter(a)
	r = 0
	x = sorted(h.keys())
	for s in range(2, 2 * max(a) + 1):
		t = 0
		for k in x:
			f = s - k
			if f < k:
				break
			t += h[k] // 2 if f == k else min(h[k], h[f]) if f in h else 0
		r = max(r, t)
	print(r)
for _ in range(ipn()):
	solve()


from collections import Counter
T = int(input())
for t in range(T):
	n = int(input())
	dic = Counter(map(int, input().split()))
	ans = [0] * 105
	for i in dic:
		for j in dic:
			ans[i + j] += min(dic[i], dic[j])
	print(max(ans) // 2)


t = int(input())
while t > 0:
	n = int(input())
	arr = input().split()
	arr = [int(i) for i in arr]
	arr1 = []
	for i in range(n - 1):
		for j in range(i + 1, n):
			arr1.append(arr[i] + arr[j])
	arr.sort()
	count1 = 0
	for i in arr1:
		j = 0
		k = n - 1
		count = 0
		while j < k:
			if arr[j] + arr[k] > i:
				k -= 1
			elif arr[j] + arr[k] == i:
				count += 1
				j += 1
				k -= 1
			else:
				j += 1
		if count > count1:
			count1 = count
	print(count1)
	t -= 1


def findALl(a, s):
	hashtable = {}
	count = 0
	for x in a:
		if s - x in hashtable and hashtable[s - x] > 0:
			count += 1
			hashtable[s - x] -= 1
		elif x in hashtable:
			hashtable[x] += 1
		else:
			hashtable[x] = 1
	return count
t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	sums = {}
	for i in range(n - 1):
		for j in range(i + 1, n):
			sums[a[i] + a[j]] = True
	max_teams = 0
	for s in sums:
		max_teams = max(max_teams, findALl(a, s))
	print(max_teams)


from collections import Counter
t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	c = Counter(a)
	ans = 0
	for s in range(2, 2 * n + 1):
		curr = 0
		for i in range(1, int((s + 1) // 2)):
			curr += min(c[i], c[s - i])
		if s % 2 == 0:
			curr += int(c[s // 2] // 2)
		ans = max(curr, ans)
	print(ans)


from collections import defaultdict, Counter
from math import log, ceil, floor

def solve():
	n = int(input())
	a = list(map(int, input().split()))
	v = Counter(a)
	ans = 0
	for i in range(2, 101):
		c = 0
		for j in range(n):
			if a[j] >= i:
				continue
			if a[j] * 2 != i:
				if v[a[j]] > 0 and v[i - a[j]] > 0:
					if v[i - a[j]] > 0:
						c += 1
						v[i - a[j]] -= 1
						v[a[j]] -= 1
			elif v[i - a[j]] >= 2:
				c += 1
				v[i - a[j]] -= 2
		ans = max(ans, c)
		v = Counter(a)
	print(ans)
t = 1
t = int(input())
for _ in range(t):
	solve()


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	b = []
	d = [0 for i in range(n)]
	for i in range(n):
		d[a[i] - 1] += 1
	for i in range(n - 1):
		for j in range(i + 1, n):
			if a[i] + a[j] not in b:
				b.append(a[i] + a[j])
	a.sort()
	maxi = 0
	for i in b:
		c = d[:]
		cnt = 0
		for j in range(n):
			if c[a[j] - 1] > 0:
				c[a[j] - 1] -= 1
				if i - a[j] > 0 and i - a[j] < n + 1:
					if c[i - a[j] - 1] > 0:
						c[i - a[j] - 1] -= 1
						cnt += 1
			else:
				continue
		maxi = max(maxi, cnt)
	print(maxi)


from collections import Counter as cs
t = int(input())
for i in range(t):
	ans = 0
	n = int(input())
	ls = [int(a) for a in input().split()]
	sm = max(ls) * 2
	dt = dict(cs(ls))
	for j in range(sm + 1):
		tp = 0
		for k in range(int((j + 2) / 2)):
			try:
				an = min(dt[k], dt[j - k])
			except:
				an = 0
			if j == 2 * k:
				an = int(an / 2)
			tp += an
		ans = max(ans, tp)
	print(ans)


for _ in range(int(input())):
	n = int(input().strip())
	a = list(map(int, input().strip().split()))
	a.sort()
	dic = {}
	for i in range(2, 2 * n + 1):
		dic[i] = 0
	for s in range(2, 2 * n + 1):
		bol = [0] * n
		for i in range(n):
			if bol[i]:
				continue
			for j in range(i + 1, n):
				if bol[j]:
					continue
				if a[i] + a[j] > s:
					break
				if a[i] + a[j] == s:
					dic[s] += 1
					(bol[i], bol[j]) = (1, 1)
					break
	maxval = 0
	for k in dic:
		if maxval < dic[k]:
			maxval = dic[k]
	print(maxval)


from collections import defaultdict

def default_value():
	return 0

def solve(W):
	min_w = min(W)
	max_w = max(W)
	w_counter = defaultdict(default_value)
	for w in W:
		w_counter[w] += 1
	result = 0
	for pair_sum in range(2 * min_w, 2 * max_w + 1):
		current_result = 0
		for j in range(min_w, pair_sum // 2):
			current_result += min(w_counter[j], w_counter[pair_sum - j])
		if pair_sum % 2 == 0:
			current_result += w_counter[pair_sum // 2] // 2
		else:
			current_result += min(w_counter[pair_sum // 2], w_counter[pair_sum - pair_sum // 2])
		if current_result > result:
			result = current_result
	return result
t = int(input())
for i in range(t):
	n = int(input())
	W = list(map(int, input().split()))
	print(solve(W))


from collections import Counter
for _ in range(int(input())):
	n = int(input())
	w = list(map(int, input().split()))
	amounts = Counter(w)
	mx_paired = 0
	for pw in range(2, 101):
		amounts2 = amounts.copy()
		paired = 0
		for i in range(n):
			if amounts2[w[i]]:
				need = pw - w[i]
				amounts2[w[i]] -= 1
				if amounts2[need]:
					amounts2[need] -= 1
					paired += 1
		mx_paired = max(mx_paired, paired)
	print(mx_paired)


for _ in range(int(input())):
	n = int(input())
	u = list(map(int, input().split()))
	d = [0] * n
	for i in range(n):
		d[u[i] - 1] += 1
	ans = 0
	for s in range(1, 2 * n + 1):
		d1 = d[:]
		cnt = 0
		for i in range(n):
			if 0 <= s - u[i] - 1 < n and d1[s - u[i] - 1] > 0:
				cnt += 1
				d1[s - u[i] - 1] -= 1
		ans = max(ans, cnt)
	print(ans // 2)


import sys
import math
from collections import defaultdict, Counter
input = sys.stdin.readline

def print(x):
	sys.stdout.write(str(x) + '\n')
t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	ans = 0
	for j in range(1, 2 * n + 1):
		top = 0
		end = n - 1
		curr = 0
		while top < end:
			if a[top] + a[end] == j:
				curr += 1
				top += 1
				end -= 1
			elif a[top] + a[end] < j:
				top += 1
			else:
				end -= 1
		ans = max(ans, curr)
	print(ans)


def pair(sum_arr, a, sum):
	l = 0
	r = len(a) - 1
	c = 0
	while l < r:
		if a[l] + a[r] == sum:
			c += 1
			l += 1
			r -= 1
		elif a[l] + a[r] > sum:
			r -= 1
		else:
			l += 1
	return c
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	sum_arr = [0] * (2 * n + 1)
	for i in range(len(sum_arr)):
		sum_arr[i] = pair(sum_arr, a, i)
	print(max(sum_arr))


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	d = {}
	freq = {}
	for i in range(len(l) - 1):
		for j in range(i + 1, len(l)):
			s = l[i] + l[j]
			if s not in freq:
				freq[s] = [(i, j)]
			else:
				freq[s].append((i, j))
	count = 0
	m = 0
	for i in freq:
		d = {}
		count = 0
		for j in freq[i]:
			if j[0] not in d and j[1] not in d:
				d[j[0]] = True
				d[j[1]] = True
				count += 1
		if count > m:
			m = count
	print(m)


t = int(input())
for _ in range(t):
	n = int(input())
	w = list(map(int, input().split()))
	seen = [0] * n
	wmin = w[0]
	wmax = w[0]
	for i in range(n):
		seen[w[i] - 1] += 1
		if w[i] < wmin:
			wmin = w[i]
		if w[i] > wmax:
			wmax = w[i]
	ans = 0
	for s in range(wmin * 2, wmax * 2 + 1):
		curAns = 0
		for i in range(s // 2):
			c = s - (i + 1) - 1
			if c < 0:
				break
			elif c >= n:
				continue
			if c == i:
				curAns += seen[i] // 2
			else:
				curAns += min(seen[i], seen[c])
		if curAns > ans:
			ans = curAns
	print(ans)


import collections
n = int(input())
for i in range(n):
	num = int(input())
	wei = [int(i) for i in input().split()]
	res = collections.defaultdict(list)
	for i in range(num - 1):
		for j in range(i + 1, num):
			tem = wei[i] + wei[j]
			if tem in res:
				if i in res[tem] or j in res[tem]:
					continue
				else:
					res[tem].extend([i, j])
			else:
				res[tem].extend([i, j])
	cnt = 0
	for (i, v) in res.items():
		cnt = max(cnt, len(v))
	print(cnt // 2)


from collections import Counter, defaultdict
t = int(input())
for _ in range(t):
	n = int(input())
	w = list(map(int, input().split()))
	cc = Counter(w)
	d = defaultdict(int)
	for ww in range(min(cc.keys()) * 2, max(cc.keys()) * 2 + 1):
		for i in cc.keys():
			lookup = ww - i
			if lookup in cc:
				d[ww] += min(cc[lookup], cc[i])
	print(max(d.values()) // 2)


t = int(input())
for _ in range(t):
	n = int(input())
	people = list(map(int, input().split()))
	same_people_count = {}
	weight_count = {}
	for person in people:
		if person in same_people_count:
			same_people_count[person] += 1
		else:
			same_people_count[person] = 1
	for person_1 in same_people_count:
		start = False
		for person_2 in same_people_count:
			if person_1 == person_2:
				start = True
				if person_1 + person_2 in weight_count and same_people_count[person_1] > 1:
					weight_count[person_1 + person_2] += same_people_count[person_1] // 2
				elif same_people_count[person_1] > 1:
					weight_count[person_1 + person_2] = same_people_count[person_1] // 2
			elif start == True:
				if person_1 + person_2 in weight_count:
					weight_count[person_1 + person_2] += min(same_people_count[person_1], same_people_count[person_2])
				else:
					weight_count[person_1 + person_2] = min(same_people_count[person_1], same_people_count[person_2])
	try:
		print(max(weight_count.values()))
	except:
		print(0)


from collections import Counter
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	if n < 2:
		print(0)
	else:
		a.sort()
		team = 0
		mn_s = a[0] + a[1]
		mx_s = a[-1] + a[-2]
		for i in range(mn_s, mx_s + 1):
			d = dict(Counter(a))
			res = 0
			for j in d:
				if j != i / 2:
					if d[j] != 0:
						if i - j in d:
							res += min(d[j], d[i - j])
							d[j] = 0
							d[i - j] = 0
				elif d[j] != 0:
					res += d[j] // 2
					d[j] = 0
			team = max(team, res)
		print(team)


for _ in range(int(input())):
	n = int(input())
	lis = list(map(int, input().split()))
	has = [0] * 700
	fin = ans = 0
	for i in lis:
		has[i] += 1
	for i in range(2, 110):
		tmp = has[:]
		ans = 0
		for j in range(1, i + 5):
			if j == i - j:
				ans += tmp[j] // 2
			else:
				ans += min(tmp[j], tmp[i - j])
			tmp[j] = tmp[i - j] = 0
		fin = max(fin, ans)
	print(fin)


import os
import sys, math
from io import BytesIO, IOBase

def main():
	t = int(input())
	for case in range(t):
		n = int(input())
		w = list(map(int, input().split()))
		dp = [0 for i in range(2 * n + 3)]
		for y in w:
			dp[y] += 1
		ans = -1
		for s in range(2 * n + 1):
			ct = 0
			for i in range(s // 2 + 1):
				j = s - i
				if i == j:
					ct += dp[i] // 2
				else:
					ct += min(dp[i], dp[j])
			ans = max(ans, ct)
		print(ans)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


from collections import defaultdict
t = int(input())
maxs = 102
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	set_arr = list(set(arr))
	set_arr.sort()
	ans = 0
	for s in range(2, maxs, 1):
		count = list(bytearray(102))
		for i in range(n):
			count[arr[i]] += 1
		temp_ans = 0
		for num in set_arr:
			if num >= s or count[num] == 0:
				break
			if count[num] > 0 and count[s - num] > 0:
				val = s - num
				cnt = min(count[num], count[val])
				temp_ans += cnt // 2 if val == num else cnt
				count[num] = count[num] - cnt
				count[val] = count[val] - cnt
		ans = max(ans, temp_ans)
	print(ans)


import sys, math, cmath, time
from collections import defaultdict
start_time = time.time()

def solve():
	n = inp()
	a = inlt()
	q = [dict() for i in range(n * 2)]
	w = [0] * (n * 2)
	for i in range(n - 1):
		for j in range(i + 1, n):
			if i not in q[a[i] + a[j] - 1] and j not in q[a[i] + a[j] - 1]:
				q[a[i] + a[j] - 1][i] = 1
				q[a[i] + a[j] - 1][j] = 1
				w[a[i] + a[j] - 1] = w[a[i] + a[j] - 1] + 1
	print(max(w))

def main():
	global tt
	if not ONLINE_JUDGE:
		sys.stdin = open('input.txt', 'r')
		sys.stdout = open('output.txt', 'w')
	t = 1
	t = inp()
	for tt in range(t):
		solve()
	if not ONLINE_JUDGE:
		print('Time Elapsed :', time.time() - start_time, 'seconds')
		sys.stdout.close()

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

def inlt():
	return list(map(int, input().split()))

def insr():
	return input().strip()

def invr():
	return map(int, input().split())

def counter(a):
	q = [0] * max(a)
	for i in range(len(a)):
		q[a[i] - 1] = q[a[i] - 1] + 1
	return q

def counter_elements(a):
	q = dict()
	for i in range(len(a)):
		if a[i] not in q:
			q[a[i]] = 0
		q[a[i]] = q[a[i]] + 1
	return q

def string_counter(a):
	q = [0] * 26
	for i in range(len(a)):
		q[ord(a[i]) - 97] = (q[ord(a[i]) - 97], 1)
	return q

def factors(n):
	q = []
	for i in range(1, int(n ** 0.5) + 1):
		if n % i == 0:
			q.append(i)
			q.append(n // i)
	return list(sorted(list(set(q))))

def prime_factors(n):
	q = []
	while n % 2 == 0:
		q.append(2)
		n = n // 2
	for i in range(3, int(n ** 0.5) + 1, 2):
		while n % i == 0:
			q.append(i)
			n = n // i
	if n > 2:
		q.append(n)
	return list(sorted(q))

def transpose(a):
	(n, m) = (len(a), len(a[0]))
	b = [[0] * n for i in range(m)]
	for i in range(m):
		for j in range(n):
			b[i][j] = a[j][i]
	return b
ONLINE_JUDGE = __debug__
if ONLINE_JUDGE:
	input = sys.stdin.readline
main()


t = int(input())
while t:
	t -= 1
	n = int(input())
	w = list(map(int, input().split()))
	ans = 0
	for i in range(2, 101):
		x = w[:]
		cur = 0
		while len(x):
			j = x[0]
			l = i - j
			x.remove(j)
			if l in x:
				x.remove(l)
				cur += 1
		ans = max(ans, cur)
	print(ans)


from collections import Counter
l = []
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	d = dict(Counter(a))
	c = [0] * 101
	for x in d:
		for y in d:
			c[x + y] = min(d[x], d[y]) + c[x + y]
	m = max(c) // 2
	l.append(m)
for i in l:
	print(i)


def main():
	t = int(input())
	from collections import Counter as C
	for _ in range(t):
		n = int(input())
		a = list(map(int, input().split()))
		c = C(a)
		ans = -1
		for su in range(2, 2 * n + 1):
			cnt = 0
			for i in range(1, (su + 1) // 2):
				j = su - i
				cnt += min(c[i], c[j])
			if su % 2 == 0:
				cnt += c[su // 2] // 2
			ans = max(ans, cnt)
		print(ans)
	return
main()


from collections import Counter
t = int(input())
for t_i in range(t):
	input()
	w = list(map(int, input().split()))
	unique_weight_counts = Counter(w)
	unique_weight_sums = set()
	for i1 in range(len(w)):
		for i2 in range(i1 + 1, len(w)):
			unique_weight_sums.add(w[i1] + w[i2])
	max_pair_count = 0
	for unique_weight_sum in unique_weight_sums:
		pair_count = 0
		for (unique_weight, count) in unique_weight_counts.items():
			complement = unique_weight_sum - unique_weight
			if complement == unique_weight:
				pair_count += count // 2
			elif complement > unique_weight:
				pair_count += min(count, unique_weight_counts[complement])
		max_pair_count = max(max_pair_count, pair_count)
	print(max_pair_count)


t = int(input())
while t:
	t -= 1
	n = int(input())
	a = list(map(int, input().split()))
	if n == 1:
		print(0)
		continue
	cnt = [0 for x in range(n + 1)]
	for e in a:
		cnt[e] += 1
	ans = 0
	for sum in range(2, 2 * n + 1):
		cur = 0
		for y in range(1, (sum + 1) // 2):
			if sum - y > n:
				continue
			cur += min(cnt[y], cnt[sum - y])
		if sum % 2 == 0:
			cur += int(cnt[sum // 2] / 2)
		ans = max(ans, cur)
	print(ans)


t = int(input())
while t != 0:
	t -= 1
	n = int(input())
	arr = list(map(int, input().split(' ')))
	if len(arr) <= 1:
		print(0)
	elif len(arr) < 4:
		print(1)
	else:
		res = {}
		for i in range(len(arr) - 1):
			for j in range(i + 1, len(arr)):
				summ = arr[i] + arr[j]
				if summ not in res:
					res[summ] = [i, j]
				else:
					sub = res[summ]
					if j not in sub and i not in sub:
						sub.append(i)
						sub.append(j)
					res[summ] = sub
		print(max([len(res[i]) for i in res]) // 2)


t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	count = [0] * (n + 1)
	for w in l:
		count[w] += 1
	res = 0
	for s in range(2, n * 2 + 1):
		cur = 0
		right = (s + 1) // 2
		for i in range(1, right):
			if s - i > n:
				continue
			cur += min(count[i], count[s - i])
		if s % 2 == 0:
			cur += count[s // 2] // 2
		res = max(res, cur)
	print(res)


import sys
import bisect as bi
import math
from collections import defaultdict as dd
import heapq
input = sys.stdin.readline
mo = 10 ** 9 + 7

def cin():
	return map(int, sin().split())

def ain():
	return list(map(int, sin().split()))

def sin():
	return input()

def inin():
	return int(input())
for _ in range(inin()):
	n = inin()
	a = ain()
	vi = [0] * n
	ans = 0
	for i in range(1, 101):
		vi = [0] * n
		c = 0
		for j in range(n):
			if vi[j] != 1:
				for k in range(j + 1, n):
					if a[k] + a[j] == i and vi[k] != 1:
						c += 1
						vi[k] = 1
						vi[j] = 1
						break
		if c > ans:
			ans = c
	print(ans)


import math
from bisect import bisect_left
for _ in range(int(input())):
	n = int(input())
	w = list(map(int, input().split()))
	cnt = {}
	for i in range(2 * n + 1):
		cnt[i] = 0
	for i in w:
		cnt[i] += 1
	ans = 0
	for s in range(2, 2 * n + 1):
		cur = 0
		for i in range(1, (s + 1) // 2):
			cur += min(cnt[i], cnt[s - i])
		if s % 2 == 0:
			cur += cnt[s // 2] // 2
		ans = max(ans, cur)
	print(ans)


from sys import stdin, stdout
import math
cin = stdin.readline
cout = stdout.write
mp = lambda : list(map(int, cin().split()))

def chars():
	s = cin()
	return list(s[:len(s) - 1])

def pl(a):
	for val in a:
		cout(str(val) + ' ')
	cout('\n')
from collections import Counter
(t,) = mp()
for _ in range(t):
	(n,) = mp()
	a = Counter(mp())
	r = Counter()
	for i in a:
		for j in a:
			r[i + j] += min(a[i], a[j])
	ans = max(r.values()) // 2
	cout(str(ans) + '\n')


for _ in range(int(input())):
	n = int(input())
	l = sorted(list(map(int, input().split())))
	ans = 0
	cntr = [0] * (2 * n + 1)
	for i in l:
		cntr[i] += 1
	for s in range(2, 2 * n + 1):
		temp = 0
		for i in range(1, s):
			temp += min(cntr[i], cntr[s - i]) if i != s - i else cntr[i] // 2 * 2
		ans = max(ans, temp // 2)
	print(ans)


ll = lambda : list(map(int, input().split()))
st = lambda : input()
v = lambda : map(int, input().split())
ii = lambda : int(input())
from collections import *
from math import *
from datetime import datetime
from sys import stdin, stdout

def lcm(a, b):
	return a * b // gcd(a, b)
for _ in range(ii()):
	s = ii()
	y = ll()
	y.sort()
	if s == 1:
		print(0)
		continue
	sum = y[-1] + y[-2]
	ans = 0
	d = {}
	while sum > 0:
		m = [0] * s
		c = 0
		for i in range(s):
			for j in range(i + 1, s):
				if y[i] + y[j] == sum and m[i] != 1 and (m[j] != 1):
					m[i] = 1
					m[j] = 1
					c += 1
					break
		ans = max(c, ans)
		d[sum] = c
		sum -= 1
	print(ans)


for _ in range(int(input())):
	n = int(input())
	W = list(map(int, input().split()))
	W.sort()
	ans = 0
	for s in range(2, 2 * n + 1):
		for i in range(n):
			j = n - 1
			cnt = 0
			while i <= j:
				if W[i] + W[j] == s and i != j:
					cnt += 1
					i += 1
					j -= 1
				elif W[i] + W[j] < s:
					i += 1
				else:
					j -= 1
			ans = max(ans, cnt)
	print(ans)


def makePairs(a, s):
	final = lo = 0
	hi = len(a) - 1
	while lo < hi:
		if a[lo] + a[hi] == s:
			final += 1
			lo += 1
			hi -= 1
		elif a[lo] + a[hi] < s:
			lo += 1
		else:
			hi -= 1
	return final

def array(arr, struc):
	return list(map(struc, arr.split()))
n = int(input())
for i in range(n):
	lena = int(input())
	arr = array(input(), int)
	arr.sort()
	final = 0
	for j in range(2 * arr[0], 2 * arr[-1] + 2):
		tmp = makePairs(arr, j)
		final = max(final, tmp)
	print(final)


t = int(input())
for _ in range(t):
	n = int(input())
	a = map(int, input().split())
	a = [i for i in a]
	nd = {}
	for i in a:
		if i not in nd:
			nd[i] = 0
		nd[i] += 1
	cnt = 0
	mx = max(a)
	for j in range(2, 2 * mx + 1):
		ans = 0
		d = nd.copy()
		for i in range(n):
			if a[i] in d and j - a[i] in d:
				if a[i] == j - a[i] and d[a[i]] >= 2:
					d[a[i]] -= 1
					d[j - a[i]] -= 1
					if d[a[i]] == 0:
						del d[a[i]]
					ans += 1
				elif a[i] != j - a[i]:
					d[a[i]] -= 1
					d[j - a[i]] -= 1
					if d[a[i]] == 0:
						del d[a[i]]
					if d[j - a[i]] == 0:
						del d[j - a[i]]
					ans += 1
		cnt = max(cnt, ans)
	print(cnt)


res = []
for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	if n == 1:
		res.append(0)
	elif n == 2:
		res.append(1)
	else:
		ans = 0
		for t in range(2, 101):
			(i, j, temp) = (0, n - 1, 0)
			while i < j:
				if arr[i] + arr[j] == t:
					temp += 1
					i += 1
					j -= 1
				elif arr[i] + arr[j] > t:
					j -= 1
				else:
					i += 1
			ans = max(ans, temp)
		res.append(ans)
for i in res:
	print(i)


t = int(input())
for _ in range(t):
	n = int(input())
	inp = list(map(int, input().split()))
	inp.sort()
	ans = 0
	for i in range(len(inp)):
		for j in range(i + 1, len(inp)):
			start = i
			end = j
			s = inp[start] + inp[end]
			z = 1
			start += 1
			end -= 1
			while start < end:
				if inp[start] + inp[end] > s:
					end -= 1
					continue
				if inp[start] + inp[end] < s:
					start += 1
					continue
				if inp[start] + inp[end] == s:
					z += 1
					start += 1
					end -= 1
			ans = max(ans, z)
	print(ans)


t = int(input())
for iterations in range(t):
	n = int(input())
	vec = list(map(int, input().split()))
	if n == 1:
		print(0)
		continue
	vec.sort()
	minS = vec[0] + vec[1]
	maxS = vec[n - 1] + vec[n - 2] + 1
	maxTeams = 0
	for s in range(minS, maxS):
		teams = 0
		j_max = n
		copies = 0
		used = 0
		for i in range(n):
			j = i + 1
			if i > 0 and vec[i] != vec[i - 1]:
				copies = 0
				used = 0
			while j < j_max:
				if vec[i] + vec[j] == s:
					if used == 0:
						used = 1
						copies = 1
						while j + copies < n and vec[j] == vec[j + copies]:
							copies += 1
						teams += 1
						j_max = j + copies - used
						break
					elif used < copies:
						used += 1
						if vec[i] == vec[j]:
							used += 1
						teams += 1
						j_max = j + copies - used
						break
					else:
						used = 0
						copies = 0
						j_max = j
						break
				elif vec[i] + vec[j] > s:
					j_max = j
					break
				else:
					j += 1
		if teams > maxTeams:
			maxTeams = teams
	print(maxTeams)


import math, sys, bisect, heapq
from math import *
from collections import defaultdict, Counter, deque
from itertools import groupby, accumulate
input = iter(sys.stdin.buffer.read().decode().splitlines()).__next__
ilele = lambda : map(int, input().split())
alele = lambda : list(map(int, input().split()))

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def Y(c):
	print(['NO', 'YES'][c])

def y(c):
	print(['no', 'yes'][c])

def Yy(c):
	print(['No', 'Yes'][c])
for _ in range(int(input())):
	N = int(input())
	A = alele()
	B = set()
	if N == 1:
		print(0)
	else:
		C = Counter(A)
		D = list(set(A))
		for i in range(N):
			for j in range(i + 1, N):
				B.add(A[i] + A[j])
		Ans = 0
		n = len(D)
		for i in B:
			temp = 0
			for j in range(n):
				if D[j] < i:
					temp += min(C.get(D[j], 0), C.get(i - D[j], 0))
			Ans = max(Ans, temp // 2)
		print(Ans)


def solve(n, a):
	ans = 0
	for tw in range(2, 101):
		counts = [0] * 101
		pairs = 0
		for i in a:
			if tw > i and counts[tw - i] != 0:
				counts[tw - i] -= 1
				pairs += 1
			else:
				counts[i] += 1
		ans = max(ans, pairs)
	return ans
t = int(input())
while t:
	n = int(input())
	a = list(map(int, input().split()))
	print(solve(n, a))
	t -= 1


from math import *
t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	t = a[:]
	t.sort()
	if n > 1:
		minsum = t[0] + t[1]
		maxsum = t[n - 1] + t[n - 2]
		max = 0
		for s in range(minsum, maxsum + 1):
			c = 0
			t = a[:]
			for j in range(n - 1):
				if t[j]:
					for k in range(j + 1, n):
						if t[j] + t[k] == s and t[j] != -1 and (t[k] != -1):
							c += 1
							t[j] = -1
							t[k] = -1
							break
			if max < c:
				max = c
		print(max)
	else:
		print(0)


import sys

def uno():
	return int(sys.stdin.readline().strip())

def dos():
	return sys.stdin.readline().strip()

def tres():
	return map(int, sys.stdin.readline().strip().split())

def cuatro():
	return sys.stdin.readline().strip().split()
for _ in range(uno()):
	n = uno()
	w = list(tres())
	(d, m) = ({}, 0)
	for i in w:
		if i in d:
			d[i] += 1
		else:
			d[i] = 1
	for i in range(2, 2 * n + 1):
		(d1, l) = (d.copy(), 0)
		for j in range(n):
			if w[j] in d1 and i - w[j] in d1:
				if w[j] != i - w[j] and (d1[w[j]] > 0 and d1[i - w[j]] > 0):
					l += 1
					d1[w[j]] -= 1
					d1[i - w[j]] -= 1
				elif w[j] == i - w[j] and d1[w[j]] > 1:
					l += 1
					d1[w[j]] -= 2
		m = max(l, m)
	print(m)


from sys import stdin
input = stdin.buffer.readline
for _ in range(int(input())):
	ans = 0
	n = int(input())
	(*a,) = map(int, input().split())
	cnt = [0] * (2 * n + 1)
	for i in a:
		cnt[i] += 1
	mx = 0
	for s in range(1, 2 * n + 1):
		ans = 0
		for i in range(1, s):
			if i != s - i:
				ans += min(cnt[i], cnt[s - i])
			else:
				ans += cnt[i] // 2 * 2
		mx = max(mx, ans // 2)
	print(mx)


t = int(input())
for _ in range(t):
	n = int(input())
	a = [int(i) for i in input().split()]
	d = [0] * (n + 1)
	for i in a:
		d[i] += 1
	ans = 0
	for s in range(2, 2 * n + 1):
		some_ans = 0
		for i in range(1, (s + 1) // 2):
			if s - i <= n:
				some_ans += min(d[i], d[s - i])
		if not s % 2:
			some_ans += d[s // 2] // 2
		ans = max(ans, some_ans)
	print(ans)


from __future__ import division, print_function
import sys
from atexit import register
if sys.version_info[0] < 3:
	from io import BytesIO as stream
else:
	from io import StringIO as stream
sys.stdin = stream(sys.stdin.read())
input = lambda : sys.stdin.readline().rstrip('\r\n')
sys.stdout = stream()
register(lambda : sys.__stdout__.write(sys.stdout.getvalue()))
import math

def read_int():
	return int(input())

def read_ints():
	return list(map(int, input().split(' ')))

def solve():
	N = read_int()
	A = read_ints()
	A.sort()
	max_k = 0
	for i0 in range(N):
		for j0 in range(i0 + 1, N):
			s = A[i0] + A[j0]
			k = 1
			(i, j) = (i0, j0)
			while i + 2 < j:
				if A[i + 1] + A[j - 1] > s:
					j -= 1
				elif A[i + 1] + A[j - 1] < s:
					i += 1
				else:
					k += 1
					i += 1
					j -= 1
			max_k = max(max_k, k)
	return max_k
T = read_int()
for _ in range(T):
	print(solve())


from sys import stdin

def iinput():
	return int(stdin.readline())

def minput():
	return map(int, stdin.readline().split())

def linput():
	return list(map(int, stdin.readline().split()))
from collections import Counter, defaultdict
t = iinput()
while t:
	t -= 1
	n = iinput()
	a = linput()
	if n == 1:
		print(0)
	else:
		a.sort()
		mx = 1
		poss = []
		for i in range(n):
			for j in range(i + 1, n):
				poss.append(a[i] + a[j])
		poss = list(set(poss))
		for e in poss:
			(i, j) = (0, n - 1)
			c = 0
			while i < j:
				if a[i] + a[j] == e:
					i += 1
					j -= 1
					c += 1
				elif a[i] + a[j] < e:
					i += 1
				else:
					j -= 1
			mx = max(mx, c)
		print(mx)


import sys
input = sys.stdin.readline
t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	k_max = 0
	for s in range(min(a) * 2, max(a) * 2 + 1):
		used = [True] * n
		k = 0
		for first_item in range(n):
			for second_item in range(first_item + 1, n):
				if used[first_item] and used[second_item] and (a[first_item] + a[second_item] == s):
					k += 1
					used[first_item] = False
					used[second_item] = False
				if used[first_item] == False:
					break
		if k > k_max:
			k_max = k
			if k_max == n // 2:
				break
	print(k_max)


import sys

def input():
	return sys.stdin.readline().strip()

def iinput():
	return int(input())

def rinput():
	return map(int, sys.stdin.readline().strip().split())

def get_list():
	return list(map(int, sys.stdin.readline().strip().split()))
mod = int(1000000000.0) + 7

def getPairsCount(a, sum):
	n = len(a)
	done = [0 for _ in range(n)]
	pair = 0
	for i in range(n):
		for j in range(i + 1, n):
			if a[i] + a[j] == sum and done[i] == 0 and (done[j] == 0):
				done[i] = 1
				done[j] = 1
				pair += 1
				break
	return pair
for _ in range(iinput()):
	n = iinput()
	w = get_list()
	w.sort()
	ans = []
	if n == 1:
		print(0)
	elif n == 2:
		print(1)
	else:
		minw = w[0] + w[1]
		maxw = w[-2] + w[-1]
		for s in range(minw, maxw + 1):
			a = getPairsCount(w, s)
			ans.append(a)
		print(max(ans))


cases = int(input())
for t in range(cases):
	n = int(input())
	w = list(map(int, input().split()))
	d = set()
	for i in range(n - 1):
		for j in range(i + 1, n):
			v = w[i] + w[j]
			d.add(v)
	d = list(d)
	w = sorted(w)
	mv = 0
	for s in d:
		wc = w.copy()
		p = [0] * n
		k = 0
		for i in range(n):
			if p[i] == 1:
				continue
			for j in range(i + 1, n):
				if p[i] == 0 and p[j] == 0 and (wc[i] + wc[j] == s):
					p[i] = 1
					p[j] = 1
					k += 1
					break
		mv = max(mv, k)
	print(mv)


import sys
from collections import defaultdict
t = int(input())
while t:
	n = int(input())
	arr = list(map(int, sys.stdin.readline().strip().split()))
	arr.sort()
	d = defaultdict(int)
	maxx = 0
	for i in range(n):
		for j in range(i + 1, n):
			summ = arr[i] + arr[j]
			if summ in d:
				continue
			else:
				d[summ] = 1
				start = i + 1
				end = n - 1
				while start < end:
					if start == j:
						start += 1
						continue
					if end == j:
						end -= 1
						continue
					if arr[start] + arr[end] == summ:
						d[summ] += 1
						start += 1
						end -= 1
					elif arr[start] + arr[end] < summ:
						start += 1
					else:
						end -= 1
			maxx = max(maxx, d[summ])
	print(maxx)
	t -= 1


import sys, bisect, string, math, time, functools, random, fractions
from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
from itertools import permutations, combinations, groupby
rep = range
R = range

def Golf():
	(n, *t) = map(int, open(0).read().split())

def I():
	return int(input())

def S_():
	return input()

def IS():
	return input().split()

def LS():
	return [i for i in input().split()]

def MI():
	return map(int, input().split())

def LI():
	return [int(i) for i in input().split()]

def LI_():
	return [int(i) - 1 for i in input().split()]

def NI(n):
	return [int(input()) for i in range(n)]

def NI_(n):
	return [int(input()) - 1 for i in range(n)]

def StoLI():
	return [ord(i) - 97 for i in input()]

def ItoS(n):
	return chr(n + 97)

def LtoS(ls):
	return ''.join([chr(i + 97) for i in ls])

def Ra():
	return map(int, open(0).read().split())

def GI(V, E, ls=None, Directed=False, index=1):
	org_inp = []
	g = [[] for i in range(V)]
	FromStdin = True if ls == None else False
	for i in range(E):
		if FromStdin:
			inp = LI()
			org_inp.append(inp)
		else:
			inp = ls[i]
		if len(inp) == 2:
			(a, b) = inp
			c = 1
		else:
			(a, b, c) = inp
		if index == 1:
			a -= 1
			b -= 1
		aa = (a, c)
		bb = (b, c)
		g[a].append(bb)
		if not Directed:
			g[b].append(aa)
	return (g, org_inp)

def GGI(h, w, search=None, replacement_of_found='.', mp_def={'#': 1, '.': 0}, boundary=1):
	mp = [boundary] * (w + 2)
	found = {}
	for i in R(h):
		s = input()
		for char in search:
			if char in s:
				found[char] = (i + 1) * (w + 2) + s.index(char) + 1
				mp_def[char] = mp_def[replacement_of_found]
		mp += [boundary] + [mp_def[j] for j in s] + [boundary]
	mp += [boundary] * (w + 2)
	return (h + 2, w + 2, mp, found)

def TI(n):
	return GI(n, n - 1)

def accum(ls):
	rt = [0]
	for i in ls:
		rt += [rt[-1] + i]
	return rt

def bit_combination(n, base=2):
	rt = []
	for tb in R(base ** n):
		s = [tb // base ** bt % base for bt in R(n)]
		rt += [s]
	return rt

def gcd(x, y):
	if y == 0:
		return x
	if x % y == 0:
		return y
	while x % y != 0:
		(x, y) = (y, x % y)
	return y

def YN(x):
	print(['NO', 'YES'][x])

def Yn(x):
	print(['No', 'Yes'][x])

def show(*inp, end='\n'):
	if show_flg:
		print(*inp, end=end)
mo = 10 ** 9 + 7
inf = float('inf')
FourNb = [(-1, 0), (1, 0), (0, 1), (0, -1)]
EightNb = [(-1, 0), (1, 0), (0, 1), (0, -1), (1, 1), (-1, -1), (1, -1), (-1, 1)]
compas = dict(zip('WENS', FourNb))
cursol = dict(zip('LRUD', FourNb))
l_alp = string.ascii_lowercase
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
input = lambda : sys.stdin.readline().rstrip()
show_flg = False
show_flg = True
ans = 0
show_flg = False
show_flg = True
ans = 0
for _ in range(I()):
	ans = 0
	n = I()
	w = LI()
	c = Counter(w)
	for s in range(2, 2 * n + 1):
		tmp = 0
		for i in range(1, 2 * n + 1):
			if i in c and s - i in c:
				if i < s - i:
					tmp += min(c[i], c[s - i])
				elif i == s - i:
					tmp += c[i] // 2
		ans = max(ans, tmp)
	print(ans)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	d = {}
	for i in range(0, len(a) - 1):
		for j in range(i + 1, len(a)):
			s = a[i] + a[j]
			if s not in d.keys():
				d[s] = set([i, j])
			elif i not in d[s] and j not in d[s]:
				d[s].add(i)
				d[s].add(j)
	m = 1
	for i in d:
		m = max(m, len(d[i]))
	print(m // 2)


from sys import stdin
input = stdin.readline

def help():
	n = int(input())
	arr = list(map(int, input().split(' ')))
	arr.sort()
	toret = 0
	for k in range(1, 2 * n + 1):
		start = 0
		end = n - 1
		curr = 0
		while start < end:
			if arr[start] + arr[end] > k:
				end -= 1
			elif arr[start] + arr[end] < k:
				start += 1
			else:
				start += 1
				end -= 1
				curr += 1
		toret = max(curr, toret)
	print(toret)
for _ in range(int(input())):
	help()


a = input()
for x in range(int(a)):
	c = input()
	d = input().split(' ')
	list1 = [int(i) for i in d]
	if int(c) == 1:
		print(0)
	else:
		dict = {}
		for i in range(int(c) + 1):
			dict[i] = 0
		for i in list1:
			dict[i] += 1
		list1.sort()
		ans = 0
		for i in range(1, list1[-1] + list1[-2] + 1):
			tag = 0
			list2 = []
			for j in range(1, i):
				if j in dict and i - j in dict and (i not in list2) and (i - j not in list2):
					if j != i - j:
						tag += min(dict[j], dict[i - j])
					else:
						tag += dict[j] // 2
				list2.append(j)
				list2.append(i - j)
			ans = max(tag, ans)
		print(ans)


from sys import stdin, stdout
import math
from collections import defaultdict

def arrinp():
	return [*map(int, stdin.readline().split(' '))]

def mulinp():
	return map(int, stdin.readline().split(' '))

def intinp():
	return int(stdin.readline())

def inp():
	return stdin.readline()

def solution():
	n = intinp()
	a = arrinp()
	a.sort()
	d = defaultdict(list)
	for i in range(n):
		for j in range(i + 1, n):
			val = a[i] + a[j]
			if i not in d[val] and j not in d[val]:
				d[val].append(i)
				d[val].append(j)
	ans = 0
	for i in d:
		ans = max(ans, len(d[i]) // 2)
	return ans
testcases = 1
testcases = intinp()
for _ in range(testcases):
	print(solution())


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	cnt = {}
	for x in l:
		if x not in cnt:
			cnt[x] = 0
		cnt[x] += 1
	k = 0
	for s in range(101):
		temp1 = 0
		temp2 = 0
		for x in cnt:
			if s - x in cnt:
				if s - x == x:
					temp2 += cnt[x] // 2
				else:
					temp1 += min(cnt[x], cnt[s - x])
		k = max(k, temp1 // 2 + temp2)
	print(k)


def solve(n, l):
	weights = [0] * 101
	count = [0] * 100
	for i in l:
		count[i] += 1
	for w in range(2, 101):
		pairs = 0
		countC = count.copy()
		for i in l:
			if i < w:
				i2 = w - i
				if i2 in l:
					if countC[i2] != 0:
						countC[i2] -= 1
						pairs += 1
						weights[w] = pairs // 2
	print(max(weights))
t = int(input())
for test in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	solve(n, l)


t = int(input())
from collections import *
from sys import *
from math import *

def f(arr, k, x):
	count = 0
	for il in arr:
		count += il // x
	if count >= k:
		return True
	else:
		return False
for ip in range(t):
	n = int(input())
	brr = [int(x) for x in input().strip().split()]
	aq = set(brr)
	tss = Counter(brr)
	ans = 0
	for px in range(2, 2 * n + 1):
		new = 0
		for il in range(1, px // 2 + 1):
			if il in aq and px - il in aq:
				if 2 * il != px:
					new += min(tss[il], tss[px - il])
				else:
					new += tss[il] // 2
			ans = max(ans, new)
	print(ans)


rw = int(input())
for qwe in range(rw):
	n = int(input())
	a = list(map(int, input().split()))
	k = {}
	for i in a:
		k[i] = 0
	for i in a:
		k[i] += 1
	a = set(a)
	s = {}
	for i in a:
		for j in a:
			s[i + j] = 0
	for i in a:
		for j in a:
			s[i + j] += min(k[i], k[j])
	print(max(s.values()) // 2)


n = int(input())
for _ in range(n):
	k = int(input())
	l = [int(x) for x in input().split()]
	l.sort()
	s = []
	ans = []
	for i in range(l[0], l[-1] * 2 + 10):
		m = l.copy()
		s = []
		a = 0
		for j in range(k):
			if i - m[j] in m and j != m.index(i - m[j]):
				a += 1
				m[m.index(i - m[j])] = -10 ** 7
				m[j] = -10 ** 7
		ans.append(a)
	print(max(ans))


(z, zz) = (input, lambda : list(map(int, z().split())))
(szz, dgraphs, mod) = (lambda : sorted(zz()), {}, 10 ** 9 + 7)
from string import *
from collections import *
from queue import *
from sys import *
from collections import *
from math import *
from heapq import *
from itertools import *
from bisect import *
from collections import Counter as cc
from math import factorial as f
from bisect import bisect as bs
from itertools import accumulate as ac

def lcd(xnum1, xnum2):
	return xnum1 * xnum2 // gcd(xnum1, xnum2)

def prime(x):
	p = ceil(x ** 0.5) + 1
	for i in range(2, p):
		if x % i == 0 and x != 2:
			return 0
	return 1

def dfs(u, visit, graph):
	visit[u] = True
	for i in graph[u]:
		if not visit[i]:
			dfs(i, visit, graph)
num = int(z())
for _ in range(num):
	n = int(z())
	l = zz()
	li = []
	ans = 0
	li = [0] * 101
	for i in l:
		li[i] += 1
	for i in range(1, 101):
		t = 0
		for j in range(1, i + 1):
			t += min(li[j], li[i - j])
		t //= 2
		ans = max(ans, t)
	print(ans)


from collections import Counter, defaultdict as dft

def mp():
	return map(int, input().split())

def ml():
	return list(map(int, input().split()))

def solve():
	n = int(input())
	arr = ml()
	mx = 0
	dct = Counter(arr)
	ans = 0
	for w in range(2, 101):
		res = 0
		for num in dct.keys():
			if num >= w:
				continue
			if w - num not in dct:
				continue
			if num == w - num:
				res += dct[num] // 2
			else:
				res += min(dct[num], dct[w - num]) / 2
		if res > mx:
			mx = res
			ans = w
	print(int(mx))
t = int(input())
for _ in range(t):
	solve()


def get_w(w_cur):
	ans = 0
	i = 0
	while arr[i] < (w_cur + 1) // 2:
		if w_cur - arr[i] in w:
			ans += min(w[arr[i]], w[w_cur - arr[i]])
		i += 1
	if arr[i] == w_cur // 2:
		ans += w[arr[i]] // 2
	return ans
for test_i in range(int(input())):
	n = int(input())
	w = dict()
	arr = []
	for wi in map(int, input().split()):
		if wi in w:
			w[wi] += 1
		else:
			w[wi] = 1
			arr.append(wi)
	arr.sort()
	if len(arr) == 1:
		print(n // 2)
	else:
		ans = 0
		w_cur = arr[0] * 2 if w[arr[0]] > 1 else arr[0] + arr[1]
		w_max = arr[-1] * 2 if w[arr[-1]] > 1 else arr[-1] + arr[-2]
		while w_cur < w_max:
			ans = max(ans, get_w(w_cur))
			w_cur += 1
		ans = max(ans, get_w(w_max))
		print(ans)


for _ in range(int(input())):
	n = int(input())
	w = list(map(int, input().strip().split(' ')))
	ma = [0] * (n + 1)
	for i in range(n):
		ma[w[i]] += 1
	ans = 0
	for i in range(2, 2 * n + 1):
		res = 0
		for l in range(1, (i + 1) // 2):
			h = i - l
			if h > n:
				continue
			res += min(ma[l], ma[h])
		if i % 2 == 0:
			res += ma[i // 2] // 2
		ans = max(res, ans)
	print(ans)


T = int(input())
for t in range(T):
	n = int(input())
	a = list(map(int, input().split()))
	ans = 1
	if n == 1:
		print(0)
		continue
	if n < 4:
		print(1)
		continue
	ss = 2 * n
	for i in range(2, ss + 1):
		d = n
		an = 0
		p = a[:]
		while 1:
			if d < 2:
				break
			tm = i - p[0]
			p.remove(p[0])
			d -= 1
			if tm in p:
				d -= 1
				p.remove(tm)
				an += 1
		if an > ans:
			ans = an
	print(ans)


count = 0

def check(l, res):
	global count
	p1 = 0
	p2 = len(l) - 1
	while p1 < p2:
		if l[p1] + l[p2] == res:
			count += 1
			p1 += 1
			p2 -= 1
		elif l[p1] + l[p2] > res:
			p2 -= 1
		else:
			p1 += 1
test = int(input())
for _ in range(test):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	s = []
	for i in range(n - 1):
		for j in range(i + 1, n):
			s.append(l[i] + l[j])
	s = list(set(s))
	answer = 0
	for i in s:
		check(l, i)
		answer = max(answer, count)
		count = 0
	print(answer)


from collections import defaultdict
t = int(input())
for test in range(t):
	n = int(input())
	arr = [int(x) for x in input().split()]
	arr.sort()
	lst = [0 for x in range(n)]
	final = defaultdict(lambda : 0)
	for i in range(n):
		cd = {}
		temp = lst[:]
		for j in range(i + 1, n):
			curr = arr[i] + arr[j]
			if curr in cd:
				continue
			if temp[j] != curr and temp[i] != curr:
				cd[curr] = 1
				lst[j] = curr
				final[curr] += 1
	maxval = max(lst)
	try:
		ele = max(final, key=final.get)
		print(final[ele])
	except:
		print(0)


t = int(input())
while t:
	n = int(input())
	arr = list(map(int, input().split()))
	res = 0
	for w in range(2, 101):
		cnt = [0] * 101
		pairs = 0
		for i in arr:
			if w > i and cnt[w - i] != 0:
				cnt[w - i] -= 1
				pairs += 1
			else:
				cnt[i] += 1
		res = max(pairs, res)
	print(res)
	t -= 1


def performOperations(arr):
	if n == 1:
		print('0')
		return
	if n == 2:
		print('1')
		return
	arr.sort()
	maximum = arr[-1] + arr[-2]
	maximum_team = 0
	i = 0
	while maximum != arr[0] + arr[1] - 1:
		team = 0
		brr = arr.copy()
		while len(brr):
			if maximum - brr[-1] in brr[:-1]:
				team += 1
				brr.remove(maximum - brr[-1])
				brr.pop()
			else:
				brr.pop()
		else:
			if team > maximum_team:
				maximum_team = team
			maximum -= 1
	print(maximum_team)
t = int(input())
for i in range(t):
	n = int(input())
	arr = list(map(int, input().strip().split()))
	performOperations(arr)


from sys import stdin
t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, stdin.readline().split()))
	pos = [[] for i in range(2501)]
	for i in range(n):
		for j in range(i + 1, n):
			s = a[i] + a[j]
			pos[s].append([i, j])
	ans = 0
	for i in range(1, 2501):
		inside = set()
		for (aa, bb) in pos[i]:
			if aa not in inside and bb not in inside:
				inside.add(aa)
				inside.add(bb)
		ans = max(ans, len(inside) // 2)
	print(ans)


def f(A, x, n):
	b = [0] * (n + 1)
	ans = 0
	for i in range(n):
		b[A[i]] = b[A[i]] + 1
	for i in range(1, n + 1):
		if b[i] != 0 and x - i <= n and (x - i >= 1):
			if b[x - i] != 0 and x - i != i:
				ans = ans + min(b[i], b[x - i])
				b[x - i] = 0
			if x - i == i:
				ans = ans + b[i] // 2
	return ans
t = int(input())
while t > 0:
	t = t - 1
	n = int(input())
	a = input()
	A = list(map(int, list(a.split())))
	m = 2 * min(A)
	ma = 2 * max(A)
	table = [0] * 101
	for i in range(m, ma + 1):
		table[i] = f(A, i, n)
	print(max(table))


import sys
T = int(sys.stdin.readline())
for _ in range(T):
	n = int(sys.stdin.readline())
	list_w = list(map(int, sys.stdin.readline().split()))
	if n == 1:
		print(0)
		continue
	list_w.sort()
	res = 0
	list_check = [0] * n
	for key in range(list_w[0] + list_w[1], list_w[-2] + list_w[-1] + 1):
		now_res = 0
		for i in range(n - 1):
			if list_check[i] == key:
				continue
			if list_w[i] * 2 > key:
				break
			for j in range(n):
				if j == i or list_check[j] == key:
					continue
				if list_w[i] + list_w[j] == key:
					now_res += 1
					list_check[j] = key
					list_check[i] = key
					break
		res = max(now_res, res)
	print(res)


import sys
for _ in range(int(sys.stdin.readline().rstrip())):
	n = int(sys.stdin.readline().rstrip())
	w = list(map(int, sys.stdin.readline().rstrip().split()))
	w.sort()
	target = []
	for i in range(n):
		for j in range(i + 1, n):
			if w[i] + w[j] not in target:
				target.append(w[i] + w[j])
	re = 0
	for i in target:
		a = w.copy()
		cnt = 0
		while True:
			if len(a) == 0:
				break
			first = a.pop(0)
			try:
				idx = a.index(i - first)
				a.pop(idx)
				cnt += 1
			except ValueError:
				pass
		re = max(re, cnt)
	print(re)


def Input():
	Str = input('')
	List = Str.split(' ')
	for i in range(len(List)):
		List[i] = int(List[i])
	return List

def Freq(List):
	Values = []
	Freq = [0] * 100
	for a in range(0, len(List) - 1):
		for b in range(a + 1, len(List)):
			Freq[List[a] + List[b] - 1] += 1
	Max = max(Freq)
	for i in range(len(Freq)):
		if Freq[i] == Max:
			Values.append(i + 1)
	return Values

def Remove(List, Index):
	Done = False
	for a in range(len(List) - 1):
		for b in range(a + 1, len(List)):
			if List[a] + List[b] == Index:
				Done = True
				A = a
				B = b
				break
		if Done == True:
			break
	if Done == True:
		List.pop(A)
		List.pop(B - 1)
		return List
	else:
		return False

def Det(List):
	Original = list(List)
	Values = []
	for i in range(2, 101):
		Values.append(i)
	Counters = [0] * len(Values)
	for i in range(len(Values)):
		List = Original.copy()
		Done = False
		Index = Values[i]
		Counter = 0
		while Done == False:
			Result = Remove(List, Index)
			if Result != False:
				List = Result
				Counter = Counter + 1
			if Result == False:
				Done = True
		Counters[i] = Counter
	return max(Counters)
trials = int(input(''))
for i in range(trials):
	input('')
	List = Input()
	print(Det(List))


import sys
import math

def II():
	return int(sys.stdin.readline())

def LI():
	return list(map(int, sys.stdin.readline().split()))

def MI():
	return map(int, sys.stdin.readline().split())

def SI():
	return sys.stdin.readline().strip()
t = II()
for q in range(t):
	n = II()
	a = sorted(LI())
	d = []
	for i in range(n):
		for j in range(i + 1, n):
			d.append(a[i] + a[j])
	ans = 0
	ind = 0
	for i in d:
		l = 0
		r = n - 1
		count = 0
		while l < r:
			if a[l] + a[r] == i:
				l += 1
				r -= 1
				count += 1
			elif a[l] + a[r] > i:
				r -= 1
			else:
				l += 1
		if count > ans:
			ans = count
	print(ans)


from itertools import combinations
from functools import lru_cache
from copy import deepcopy

def fast_calc(n, s, a):
	tmp_sum = 0
	i = 0
	while i < n:
		tmp = a[i]
		i += 1
		while n > i and a[n - 1] > s - tmp:
			n -= 1
		if n > i and a[n - 1] == s - tmp:
			n -= 1
			tmp_sum += 1
	return tmp_sum

def calc(n, a):
	a = sorted(a)
	k = 0
	list_s = sorted(list(set([x[0] + x[1] for x in combinations(a, 2)])))
	for s in list_s:
		while min(a) + max(a) < s:
			a.remove(min(a))
			n = len(a)
		tmp_sum = fast_calc(n, s, a)
		if tmp_sum > k:
			k = tmp_sum
	return k

def main():
	t = int(input())
	for i in range(t):
		n = int(input())
		a = list(map(lambda x: int(x), input().split()))
		print(calc(n, a))
main()


from collections import Counter
t = int(input())
for _ in range(t):
	n = int(input())
	ar = list(map(int, input().split()))
	m = 0
	check = Counter()
	for i in range(n - 1):
		for j in range(i + 1, n):
			s = ar[i] + ar[j]
			if check[s] > 0:
				pass
			else:
				count = 0
				a1 = ar.copy()
				c = Counter(a1)
				v = Counter()
				for (key, value) in c.items():
					a = key
					b = s - key
					if v[b] == 0 and v[a] == 0:
						if a == b:
							count += value // 2
						else:
							count += min(c[a], c[b])
						v[a] = 1
						v[b] = 1
				if count > m:
					m = count
				check[s] += 1
	print(m)


from collections import Counter

def read_nums():
	return [int(x) for x in input().split()]

def get_num_teams(weights, total_weight):
	res = 0
	for (w, count) in weights.items():
		res += min(count, weights[total_weight - w])
	return res // 2

def solve():
	_ = read_nums()
	weights = Counter(read_nums())
	num_teams = [get_num_teams(weights, total_weight) for total_weight in range(1, 101)]
	print(max(num_teams))

def main():
	(t,) = read_nums()
	for _ in range(t):
		solve()
main()


from sys import stdin, stdout
import math, sys
from itertools import permutations, combinations
from collections import defaultdict, deque, OrderedDict
from os import path
import bisect as bi
import heapq, random

def yes():
	print('YES')

def no():
	print('NO')
if path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

	def I():
		return int(input())

	def In():
		return map(int, input().split())
else:

	def I():
		return int(stdin.readline())

	def In():
		return map(int, stdin.readline().split())

def dict(a):
	d = {}
	for x in a:
		if d.get(x, -1) != -1:
			d[x] += 1
		else:
			d[x] = 1
	return d

def find_le(a, x):
	i = bi.bisect_right(a, x)
	if i:
		return i - 1
	else:
		return -1

def main():
	try:
		n = I()
		l = list(In())
		d = defaultdict(list)
		for x in range(1, n + 1):
			for y in range(x, n + 1):
				temp = x + y
				d[temp].append([x, y])
		d1 = dict(l)
		ans = 0
		for x in d1:
			ans = max(ans, d1[x] // 4)
		for x in d:
			temp = d[x]
			m = 0
			for y in temp:
				(a, b) = (y[0], y[1])
				if d1.get(a, -1) != -1 and d1.get(b, -1) != -1:
					if a != b:
						m += min(d1[a], d1[b])
					elif a == b:
						m += d1[a] // 2
			ans = max(ans, m)
		print(ans)
	except:
		pass
M = 998244353
P = 1000000007
for _ in range(I()):
	main()


def ppr(l, n):
	m = 0
	for k in range(1, 101):
		lo = 0
		h = n - 1
		c = 0
		while lo < h:
			s = l[lo] + l[h]
			if s == k:
				c += 1
				m = max(m, c)
				lo += 1
				h -= 1
			elif s < k:
				lo += 1
			else:
				h -= 1
	print(m)
t = int(input())
for q in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	ppr(l, n)


t = int(input())
for r in range(t):
	n = int(input())
	l = [int(x) for x in input().split()]
	sum1 = []
	for i in range(n):
		for j in range(i + 1, n):
			sum1.append(l[i] + l[j])
	sum1 = list(set(sum1))
	count = [0]
	for k in range(len(sum1)):
		l1 = []
		l1.extend(l)
		count1 = 0
		for i in range(n - 1):
			for j in range(i + 1, n):
				if l1[i] + l1[j] == sum1[k]:
					l1[i] = 1000
					l1[j] = 1000
					count1 += 1
					break
		count.append(count1)
	print(max(count))


for _ in range(int(input())):
	n = int(input())
	w = list(map(int, input().split()))
	c = [w.count(x) for x in range(111)]
	rec = 1
	for i in range(2, 111):
		tmp = 0
		for j in range(1, i):
			tmp += min(c[j], c[i - j]) if j != i - j else c[j]
		rec = max(rec, tmp)
	print(rec // 2)


import sys
from sys import stdin
import math
from collections import Counter

def iinput():
	return int(input())

def minput():
	return map(int, input().split())

def linput():
	return list(map(int, input().split()))

def fiinput():
	return int(stdin.readline())

def fminput():
	return map(int, stdin.readline().strip().split())

def flinput():
	return list(map(int, stdin.readline().strip().split()))
for _ in range(fiinput()):
	n = fiinput()
	list1 = flinput()
	dict1 = {}
	for i in range(n):
		if list1[i] in dict1:
			dict1[list1[i]] += 1
		else:
			dict1[list1[i]] = 1
	dict2 = dict1.copy()
	cc = 0
	for i in range(1, 101):
		s = i
		c = 0
		dict1 = dict2.copy()
		for j in dict1:
			x = dict1[j]
			ss = s - j
			if ss in dict1:
				y = dict1[ss]
				if j != ss:
					c += min(x, y)
				else:
					c += x // 2
				dict1[j] = 0
				dict1[ss] = 0
		if c > cc:
			cc = c
	print(cc)


from collections import defaultdict
t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	if n == 1:
		print(0)
		continue
	a.sort()
	e = a[0] + a[1]
	d = a[-1] + a[-2]
	count = 0
	for k in range(e, d + 1):
		c = 0
		m = defaultdict(bool)
		for i in range(n - 1):
			for j in range(i + 1, n):
				if a[i] + a[j] == k and m[i] == 0 and (m[j] == 0):
					c += 1
					m[i] = 1
					m[j] = 1
		count = max(c, count)
	print(count)


t = int(input())
for _ in range(0, t):
	n = int(input())
	aa = [int(i) for i in input().split()]
	wws = [0] * 101
	for i in aa:
		wws[i] += 1
	ss = 0
	for s in range(2, 101):
		pp = 0
		for i in range(1, s + 1):
			pp += min(wws[i], wws[s - i])
		ss = max(ss, pp // 2)
	print(ss)


from collections import Counter
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	c = 0
	for sm in range(2, 101):
		s = set()
		temp = 0
		for i in range(n):
			for j in range(i + 1, n):
				if a[i] + a[j] == sm and i not in s and (j not in s):
					s.add(i)
					s.add(j)
					temp += 1
		c = max(c, temp)
	print(c)


def pairs_count(arr, n, sum):
	ans = 0
	(i, j) = (0, n - 1)
	while i < j:
		if arr[i] + arr[j] < sum:
			i += 1
		elif arr[i] + arr[j] > sum:
			j -= 1
		else:
			ans += 1
			i += 1
			j -= 1
	return ans
t = int(input())
from collections import Counter
for i in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	if n == 1:
		print(0)
	else:
		su = []
		l.sort()
		for j in range(n):
			x = l[j]
			for k in range(j + 1, n):
				su.append(x + l[k])
		m = Counter(su)
		ans = 0
		for j in m:
			z = pairs_count(l, n, j)
			if z > ans:
				ans = z
		print(ans)


t = int(input())
for ts in range(t):
	ln = int(input())
	a = [int(i) for i in input().split()]
	a.sort()
	sol = {-1: 0}
	for i in range(0, ln - 1):
		for j in range(ln - 1, i, -1):
			pairs = 0
			aim = a[i] + a[j]
			if aim in sol:
				continue
			l = i
			r = j
			while l < r:
				if a[l] + a[r] == aim:
					pairs += 1
					l += 1
					r -= 1
				elif a[l] + a[r] < aim:
					l += 1
				else:
					r -= 1
			sol[aim] = pairs
	print(max(list(sol.values())))


for _ in [0] * int(input()):
	n = int(input())
	arr = [int(a) for a in input().split()]
	arr.sort()
	(ans, pair_list) = (0, [])
	for i in range(n):
		for j in range(n - i):
			if i != i + j:
				pair = arr[i] + arr[i + j]
				if pair not in pair_list:
					pair_list.append(pair)
	ans = 0
	for p in pair_list:
		i = 0
		j = n - 1
		ct = 0
		while i < j:
			np = arr[i] + arr[j]
			if np == p:
				i += 1
				j -= 1
				ct += 1
			elif np > p:
				j -= 1
			elif np < p:
				i += 1
		if ct > ans:
			ans = ct
	print(ans)


T = int(input())
for _ in range(T):
	n = int(input())
	a = list(map(int, input().split()))
	a = sorted(a)
	if n == 1:
		ans = 0
	else:
		mins = a[0] + a[1]
		maxs = a[-1] + a[-2]
		ans = 0
		for s in range(mins, maxs + 1):
			i = 0
			j = n - 1
			cnt = 0
			while i < j:
				if a[i] + a[j] == s:
					cnt += 1
					i += 1
					j -= 1
				elif a[i] + a[j] < s:
					i += 1
				elif a[i] + a[j] > s:
					j -= 1
			ans = max(ans, cnt)
	print(ans)


for _ in range(int(input())):
	n = int(input())
	a = sorted(list(map(int, input().split())))
	ans = 0
	for k in range(2, 2 * n + 1):
		count = 0
		i = 0
		j = len(a) - 1
		while i < j:
			if a[i] + a[j] == k:
				count += 1
				i += 1
				j -= 1
				continue
			elif a[i] + a[j] < k:
				i += 1
				continue
			elif a[i] + a[j] > k:
				j -= 1
				continue
		ans = max(ans, count)
	print(ans)


from sys import stdin, stdout
from collections import defaultdict as dd
input = stdin.readline
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	ans = 0
	for i in range(2 * n + 1):
		m = 0
		d = dd(int)
		for j in range(n):
			d[a[j]] += 1
		for j in a:
			if j != i - j:
				x = min(d[j], d[i - j])
				d[j] -= x
				d[i - j] -= x
			else:
				x = d[j] // 2
				d[j] = d[j] % 2
			m += x
		ans = max(ans, m)
	stdout.write(str(ans) + '\n')


from collections import Counter, defaultdict
from itertools import combinations_with_replacement

def tc():
	n = int(input())
	w = list(map(int, input().split()))
	if n == 1:
		print(0)
		return
	elif n < 4:
		print(1)
		return
	w.sort()
	minw = w[0] + w[1]
	maxw = w[0] + w[-1]
	c = Counter(w)
	teams = defaultdict(int)
	for (a, b) in combinations_with_replacement(c, 2):
		if a == b:
			teams[a + b] += c[a] // 2
		else:
			teams[a + b] += min(c[a], c[b])
	print(max(teams.values()))
T = int(input())
for _ in range(T):
	tc()


from sys import stdin, stdout
input = stdin.readline
print = stdout.write
from collections import Counter
for _ in range(int(input())):
	n = int(input())
	w = list(map(int, input().split()))
	d = Counter(w)
	maxi = 0
	for s in range(2, 101):
		pairs = 0
		for ele in d:
			if s - ele in d:
				pairs += min(d[ele], d[s - ele])
		pairs >>= 1
		maxi = max(pairs, maxi)
	print(str(maxi) + '\n')


import collections
import itertools

def find_number_of_teams(count_members, whole_members):
	poss_subset_of_members = [[] for i in range(101)]
	for comb in itertools.combinations(whole_members, 2):
		poss_subset_of_members[sum(comb)].extend(comb)
		if poss_subset_of_members[sum(comb)].count(comb[0]) > count_members[comb[0]] or poss_subset_of_members[sum(comb)].count(comb[1]) > count_members[comb[1]]:
			poss_subset_of_members[sum(comb)] = poss_subset_of_members[sum(comb)][:-2]
	return max([round(len(subset) / 2) for subset in poss_subset_of_members])
answers = []
t = int(input())
for _ in range(t):
	not_needed_input = input()
	whole_members = [int(i) for i in input().split(' ')]
	count_members = collections.Counter(whole_members)
	answers.append(find_number_of_teams(count_members=count_members, whole_members=whole_members))
for answer in answers:
	print(answer)


t = int(input())
for i in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	k = sorted(l, reverse=True)
	res = []
	if n != 1:
		for j in range(2, k[0] + k[1] + 1):
			c = 0
			w = []
			for a in range(n - 1):
				for b in range(a + 1, n):
					if l[a] + l[b] == j and (not a in w) and (not b in w):
						c += 1
						w.append(a)
						w.append(b)
			res.append(c)
	else:
		res.append(0)
	print(max(res))


def solve(a):
	dic = dict()
	for i in a:
		if not dic.__contains__(i):
			dic[i] = 1
		else:
			dic[i] += 1
	ans = 0
	for s in range(1, 101):
		used = {}
		cnt = 0
		for (k, v) in dic.items():
			if not used.__contains__(k) and dic.__contains__(s - k):
				used[k] = 1
				used[s - k] = 1
				if s - k == k:
					cnt += dic[k] // 2
				else:
					cnt += min(dic[k], dic[s - k])
		ans = max(ans, cnt)
	return ans
T = int(input())
while T > 0:
	T -= 1
	n = int(input())
	a = list(map(int, input().split()))
	print(solve(a))


from sys import stdin, setrecursionlimit, stdout
from collections import deque
from math import sqrt, floor, ceil, log, log2, log10, pi, gcd, sin, cos, asin
from heapq import heapify, heappop, heappush, heapreplace, heappushpop
from bisect import bisect_right, bisect_left

def ii():
	return int(stdin.readline())

def fi():
	return float(stdin.readline())

def mi():
	return map(int, stdin.readline().split())

def fmi():
	return map(float, stdin.readline().split())

def li():
	return list(mi())

def si():
	return stdin.readline().rstrip()

def lsi():
	return list(si())
mod = 1000000007
res = ['NO', 'YES']

def tot(s):
	c = 0
	(l, r) = (0, n - 1)
	while l < r:
		if a[l] + a[r] < s:
			l += 1
		elif a[l] + a[r] > s:
			r -= 1
		else:
			c += 1
			l += 1
			r -= 1
	return c
(test, test_case) = (0, 1)
test_case = ii()
while test < test_case:
	test += 1
	n = ii()
	a = li()
	if n == 1:
		print(0)
		continue
	a.sort()
	fr = a[0] + a[1]
	to = a[-1] + a[-2]
	ans = 1
	for i in range(fr, to + 1):
		ans = max(ans, tot(i))
	print(ans)


from collections import Counter
for _ in range(int(input())):
	n = int(input())
	arr1 = list(map(int, input().split()))
	arr1.sort()
	m = {}
	for i in arr1:
		if i in m:
			m[i] += 1
		else:
			m[i] = 1
	ma = {}
	arr1 = list(set(arr1))
	for i in m:
		if m[i] >= 2:
			ma[i * 2] = m[i] // 2
	for i in range(len(arr1) - 1):
		for j in range(i + 1, len(arr1)):
			if arr1[i] + arr1[j] in ma:
				ma[arr1[i] + arr1[j]] += min(m[arr1[i]], m[arr1[j]])
			else:
				ma[arr1[i] + arr1[j]] = min(m[arr1[i]], m[arr1[j]])
	if ma != {}:
		print(max(max(ma.values()), max(m.values()) // 2))
	else:
		print(max(m.values()) // 2)


def sol(w):
	w = sorted(w)
	best = 0
	for i in range(2, 2 * len(w) + 1):
		l = 0
		r = len(w) - 1
		c = 0
		while l < r:
			if w[l] + w[r] == i:
				c += 1
				l += 1
				r -= 1
				continue
			if w[l] + w[r] < i:
				l += 1
				continue
			if w[l] + w[r] > i:
				r -= 1
				continue
		best = max(c, best)
	return best
cases = input()
for i in range(int(cases)):
	input()
	w = [int(x) for x in input().split()]
	print(sol(w))


import sys
import collections
exec("try:sys.stdin=open('in.txt','r');sys.stdout=open('out.txt','w')\nexcept:pass")

def input():
	return sys.stdin.readline().rstrip('\r\n')

def Num():
	return int(input())

def List():
	return list(map(int, input().split()))

def solve():
	n = Num()
	a = List()
	a.sort()
	d = collections.defaultdict(set)
	for i in range(n):
		for j in range(n):
			if i != j:
				x = a[i] + a[j]
				if i not in d[x] and j not in d[x]:
					d[x].add(i)
					d[x].add(j)
	ans = 0
	for (k, v) in d.items():
		ans = max(ans, len(v))
	print(ans // 2)
for _ in range(Num()):
	solve()


t_case = int(input())
for _ in range(t_case):
	n = int(input())
	arr = list(map(int, input().split()))
	s = []
	for i in range(n):
		for j in range(i + 1, n):
			s.append(arr[i] + arr[j])
	st = [0 for i in range(101)]
	k = list(set(s))
	for i in k:
		visited = [False for j in range(51)]
		for j in range(n):
			for k in range(j + 1, n):
				if arr[j] + arr[k] == i and (not visited[k]) and (not visited[j]):
					st[i] += 1
					visited[k] = True
					break
	print(max(st))


def solve(arr, n):
	l = max(arr)
	freq = [0 for i in range(l + 1)]
	for x in arr:
		freq[x] += 1
	arr = sorted(arr)
	res = 0
	for s in range(2, 2 * l + 1):
		count = 0
		(i, j) = (0, n - 1)
		while i < j:
			if arr[i] + arr[j] == s:
				count += 1
				i += 1
				j -= 1
			elif arr[i] + arr[j] < s:
				i += 1
			else:
				j -= 1
		res = max(count, res)
	return res
t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	print(solve(arr, n))


def count(a, s):
	c = 0
	i = 0
	j = n - 1
	while i < j:
		if a[i] + a[j] == s:
			c += 1
			i += 1
			j -= 1
		elif a[i] + a[j] < s:
			i += 1
		else:
			j -= 1
	return c
t = int(input())
while t > 0:
	n = int(input())
	a = [int(x) for x in input().split()]
	b = []
	a.sort()
	for i in range(2, 2 * n + 1):
		b.append(count(a, i))
	print(max(b))
	t -= 1


def solve(l, n):
	ans = -1000000000000
	for k in range(101):
		i = 0
		j = n - 1
		c = 0
		while i < j:
			if l[i] + l[j] == k:
				c += 1
				i += 1
				j -= 1
			elif l[i] + l[j] > k:
				j -= 1
			else:
				i += 1
		ans = max(ans, c)
	return ans
t = int(input())
for itr in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	print(solve(l, n))


t = int(input())
for i in range(t):
	n = int(input())
	a = [int(x) for x in input().split()]
	G = {}
	for k in a:
		if k in G:
			G[k] += 1
		else:
			G[k] = 1
	index = []
	for k in G:
		index.append(k)
	G2 = {}
	for k in range(0, len(index)):
		for l in range(k + 1, len(index)):
			min1 = min(G[index[k]], G[index[l]])
			if index[k] + index[l] in G2:
				G2[index[k] + index[l]] += min1
			else:
				G2[index[k] + index[l]] = min1
		if index[k] + index[k] in G2:
			G2[index[k] + index[k]] += int(G[index[k]] / 2)
		else:
			G2[index[k] + index[k]] = int(G[index[k]] / 2)
	max1 = 0
	for k in G2:
		if G2[k] > max1:
			max1 = G2[k]
	print(max1)


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, copy, functools
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
mod2 = 998244353
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return list(map(int, sys.stdin.readline().split()))

def LLI():
	return [list(map(int, l.split())) for l in sys.stdin.readlines()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def pf(s):
	return print(s, flush=True)

def pe(s):
	return print(str(s), file=sys.stderr)

def JA(a, sep):
	return sep.join(map(str, a))

def JAA(a, s, t):
	return s.join((t.join(map(str, b)) for b in a))

def IF(c, t, f):
	return t if c else f

def main():
	t = I()
	rr = []
	for _ in range(t):
		n = I()
		a = LI()
		c = collections.Counter(a)
		ca = list(c.items())
		l = len(ca)
		r = collections.defaultdict(int)
		for i in range(l):
			(k, v) = ca[i]
			r[k * 2] += v // 2
			for j in range(i + 1, l):
				(kk, vv) = ca[j]
				r[k + kk] += min(v, vv)
		rr.append(max(r.values()))
	return JA(rr, '\n')
print(main())


final = []
for i in range(int(input())):
	n = int(input())
	l = [int(x) for x in input().split()]
	dicti = {}
	for j in range(1, n + 1):
		dicti[j] = 0
	for j in range(len(l)):
		dicti[l[j]] += 1
	flag = 0
	for j in range(2, 2 * n + 1):
		num_of_cases = 0
		s = j
		if s % 2 != 0:
			for k in range(1, (s + 1) // 2):
				smallestweight = k
				largestweight = s - k
				if s - k <= n:
					num_of_cases += min(dicti[k], dicti[s - k])
			if num_of_cases > flag:
				flag = num_of_cases
		else:
			for k in range(1, s // 2 + 1):
				smallestweight = k
				largestweight = s - k
				if k != s - k:
					if s - k <= n:
						num_of_cases += min(dicti[k], dicti[s - k])
				elif s - k <= n:
					num_of_cases += min(dicti[k], dicti[s - k]) // 2
			if num_of_cases > flag:
				flag = num_of_cases
	print(flag)


t = int(input())
while t > 0:
	n = int(input())
	arr = [int(i) for i in input().split()]
	li = [0 for i in range(101)]
	for i in range(n):
		li[arr[i]] += 1
	ans = 0
	for i in range(2, 101):
		a = 0
		for j in range(1, i // 2 + 1):
			if i - j == j:
				a += li[j] // 2
			else:
				a += min(li[i - j], li[j])
		if a >= ans:
			ans = a
	print(ans)
	t -= 1


from collections import Counter
for _ in range(int(input())):
	n = int(input())
	nums = list(map(int, input().split()))
	fre = {}
	answer = 0
	s = 0
	count = list(Counter(nums).items())
	for index in range(len(count)):
		if count[index][1] > 1:
			fre[2 * count[index][0]] = count[index][1] // 2 + fre.get(2 * count[index][0], 0)
			if answer < fre[2 * count[index][0]]:
				s = 2 * count[index][0]
				answer = max(answer, fre[2 * count[index][0]])
		for ind in range(index + 1, len(count)):
			summ = count[index][0] + count[ind][0]
			get = min(count[index][1], count[ind][1])
			fre[summ] = get + fre.get(summ, 0)
			if answer < fre[summ]:
				s = summ
				answer = max(answer, fre[summ])
	seen = {}
	count = 0
	for item in nums:
		if s - item in seen and seen[s - item] > 0:
			count += 1
			seen[s - item] -= 1
		else:
			seen[item] = 1 + seen.get(item, 0)
	print(count)


import sys
import math
from math import *
from collections import defaultdict
import os
from io import BytesIO, IOBase
from collections import deque

def main():
	d = defaultdict(lambda : 0)
	n = int(input())
	arr = list(map(int, input().split()))
	for i in arr:
		d[i] += 1
	if len(d) == 1:
		print(d[arr[0]] // 2)
		return
	res = []
	k = []
	mx = 0
	for (i, j) in d.items():
		res.append(j)
		k.append(i)
	res.sort(reverse=True)
	mx = max(res[0] // 2, res[1])
	e = defaultdict(lambda : 0)
	for i in range(len(k)):
		e[2 * k[i]] += d[k[i]] // 2
		for j in range(i + 1, len(k)):
			e[k[i] + k[j]] += min(d[k[i]], d[k[j]])
	for (i, j) in e.items():
		mx = max(mx, j)
	print(mx)
for i in range(int(input())):
	main()


def solve(n, a, s):
	st = [0] * n
	ans = 0
	for i in range(n):
		if st[i] == 0:
			for j in range(i + 1, n):
				if a[i] + a[j] == s and st[j] == 0:
					ans += 1
					st[j] = 1
					break
	return ans
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	if n == 1:
		print(0)
	elif n == 2:
		print(1)
	else:
		ans = 1
		for i in range(2, 2 * n + 1):
			ss = solve(n, a, i)
			ans = max(ans, ss)
		print(ans)


t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	l = sorted(l)
	if n == 1:
		print(0)
	else:
		left = l[0] + l[1]
		right = l[-1] + l[-2]

		def countSums(l, s):
			ans = 0
			left = 0
			right = len(l) - 1
			while left < right:
				if l[left] + l[right] == s:
					ans += 1
					left += 1
					right -= 1
				elif l[left] + l[right] > s:
					right -= 1
				else:
					left += 1
			return ans
		ans = 0
		for i in range(left, right + 1):
			ans = max(ans, countSums(l, i))
		print(ans)


t = int(input())
ans = []
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	count = [0 for _ in range(51)]
	for x in arr:
		count[x] += 1
	mx = 0
	for s in range(2, 2 * n + 1):
		(end, total) = ((s + 1) // 2, 0)
		for no in range(1, end):
			if s - no <= n:
				total += min(count[no], count[s - no])
		if s % 2 == 0:
			total += count[s // 2] // 2
		mx = max(mx, total)
	ans.append(mx)
for val in ans:
	print(val)


def makeTeams(n, w):
	w.sort()
	tried = set()

	def checkTeams(w, start, end):
		nonlocal tried
		if start >= end:
			return 0
		target = w[start] + w[end]
		(left, right) = (start + 1, end - 1)
		teams = 1
		while left < right:
			if w[left] + w[right] == target:
				tried.add((left, right))
				teams += 1
				left += 1
				right -= 1
			elif w[left] + w[right] < target:
				left += 1
			else:
				right -= 1
		return teams
	k = 0
	for l in range(n - 1):
		for r in range(n - 1, l, -1):
			if (l, r) not in tried:
				k = max(k, checkTeams(w, l, r))
				tried.add((l, r))
	return k
t = int(input())
for i in range(t):
	n = int(input())
	w = list(map(int, input().split()))
	print(makeTeams(n, w))


import math
t = int(input())
for _ in range(t):
	n = int(input())
	w = list(map(int, input().split()))
	array = [0] * (n + 1)
	for i in w:
		array[i] += 1
	ans = 0
	for s in range(2, 2 * n + 1):
		cur = 0
		for i in range(1, (s + 1) // 2):
			if s - i > n:
				continue
			cur += min(array[i], array[s - i])
		if s % 2 == 0:
			cur += array[s // 2] // 2
		ans = max(ans, cur)
	print(ans)


t = int(input())
for j in range(t):
	n = int(input())
	A = list(map(int, input().split()))
	counter = []
	for i in range(2 * min(A), 2 * max(A) + 1):
		B = []
		for e in A:
			B.append(e)
		s = 0
		while len(B) > 0:
			Bj = B[0]
			B.pop(0)
			for el in B:
				if Bj + el == i:
					s += 1
					B.pop(B.index(el))
					break
		counter.append(s)
	print(max(counter))


from collections import Counter

def main():
	for _ in range(int(input())):
		n = int(input())
		a = Counter(map(int, input().split()))
		ans = 0
		for s in range(2, 2 * n + 1):
			tmp = 0
			for i in range(1, (s + 1) // 2):
				if s - i > n:
					continue
				tmp += min(a[i], a[s - i])
			if not s & 1:
				tmp += a[s // 2] // 2
			ans = max(ans, tmp)
		print(ans)
main()


from collections import defaultdict
t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split(' ')))
	if n == 1:
		print(0)
		continue
	alpos = []
	for x in range(n):
		for y in range(x + 1, n):
			alpos.append(a[x] + a[y])
	dic = defaultdict(lambda : 0)
	a.sort()
	for x in set(alpos):
		i = 0
		j = n - 1
		while i < j:
			if a[i] + a[j] > x:
				j = j - 1
			elif a[i] + a[j] == x:
				dic[x] += 1
				i = i + 1
				j = j - 1
			elif a[i] + a[j] < x:
				i = i + 1
	if len(dic.values()) == 0:
		print(1)
	else:
		print(max(dic.values()))