Maria is the most active old lady in her house. She was tired of sitting at home. She decided to organize a ceremony against the coronavirus.

She has $n$ friends who are also grannies (Maria is not included in this number). The $i$-th granny is ready to attend the ceremony, provided that at the time of her appearance in the courtyard there will be at least $a_i$ other grannies there. Note that grannies can come into the courtyard at the same time. Formally, the granny $i$ agrees to come if the number of other grannies who came earlier or at the same time with her is greater than or equal to $a_i$.

Grannies gather in the courtyard like that.  Initially, only Maria is in the courtyard (that is, the initial number of grannies in the courtyard is $1$). All the remaining $n$ grannies are still sitting at home. On each step Maria selects a subset of grannies, none of whom have yet to enter the courtyard. She promises each of them that at the time of her appearance there will be at least $a_i$ other grannies (including Maria) in the courtyard. Maria can call several grannies at once. In this case, the selected grannies will go out into the courtyard at the same moment of time. She cannot deceive grannies, that is, the situation when the $i$-th granny in the moment of appearing in the courtyard, finds that now there are strictly less than $a_i$ other grannies (except herself, but including Maria), is prohibited. Please note that if several grannies appeared in the yard at the same time, then each of them sees others at the time of appearance. 

Your task is to find what maximum number of grannies (including herself) Maria can collect in the courtyard for the ceremony. After all, the more people in one place during quarantine, the more effective the ceremony!

Consider an example: if $n=6$ and $a=[1,5,4,5,1,9]$, then:  at the first step Maria can call grannies with numbers $1$ and $5$, each of them will see two grannies at the moment of going out into the yard (note that $a_1=1 \le 2$ and $a_5=1 \le 2$);  at the second step, Maria can call grannies with numbers $2$, $3$ and $4$, each of them will see five grannies at the moment of going out into the yard (note that $a_2=5 \le 5$, $a_3=4 \le 5$ and $a_4=5 \le 5$);  the $6$-th granny cannot be called into the yard  — therefore, the answer is $6$ (Maria herself and another $5$ grannies). 


-----Input-----

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

The first line of a test case contains a single integer $n$ ($1 \le n \le 10^5$) — the number of grannies (Maria is not included in this number).

The second line contains $n$ integers $a_1, a_2, \ldots, a_n$ ($1 \le a_i \le 2\cdot10^5$).

It is guaranteed that the sum of the values $n$ over all test cases of the input does not exceed $10^5$.


-----Output-----

For each test case, print a single integer $k$ ($1 \le k \le n + 1$) — the maximum possible number of grannies in the courtyard.


-----Example-----
Input
4
5
1 1 2 2 1
6
2 3 4 5 6 7
6
1 5 4 5 1 9
5
1 2 3 5 6

Output
6
1
6
4



-----Note-----

In the first test case in the example, on the first step Maria can call all the grannies. Then each of them will see five grannies when they come out. Therefore, Maria and five other grannies will be in the yard.

In the second test case in the example, no one can be in the yard, so Maria will remain there alone.

The third test case in the example is described in the details above.

In the fourth test case in the example, on the first step Maria can call grannies with numbers $1$, $2$ and $3$. If on the second step Maria calls $4$ or $5$ (one of them), then when a granny appears in the yard, she will see only four grannies (but it is forbidden). It means that Maria can't call the $4$-th granny or the $5$-th granny separately (one of them). If she calls both: $4$ and $5$, then when they appear, they will see $4+1=5$ grannies. Despite the fact that it is enough for the $4$-th granny, the $5$-th granny is not satisfied. So, Maria cannot call both the $4$-th granny and the $5$-th granny at the same time. That is, Maria and three grannies from the first step will be in the yard in total.

Difficulty: EASY
Tags: Sorting

Greedy algorithms
Skill types: Sorting

Greedy algorithms

Starter code:

Solutions:
for s in [*open(0)][2::2]:
	print(max((i * (x <= i) for (i, x) in enumerate(sorted(map(int, s.split())), 1))) + 1)


for _ in range(int(input())):
	n = int(input())
	a = sorted(map(int, input().split()))
	a.insert(0, 0)
	cnt = ans = 0
	for i in range(n + 1):
		if a[i] <= cnt:
			ans = i
		cnt += 1
	print(ans + 1)


n = int(input())
for i in range(n):
	g = int(input())
	a = input().split()
	for i in range(len(a)):
		a[i] = int(a[i])
	a.sort(reverse=True)
	g += 1
	for i in a:
		if int(i) >= g:
			g -= 1
	print(g)


import sys
input = sys.stdin.readline
for f in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	mx = 1
	for i in range(n):
		if a[i] <= i + 1:
			mx = i + 2
	print(mx)


import sys
import math
import collections
from collections import deque
from functools import reduce
from sys import stdin, stdout, setrecursionlimit
setrecursionlimit(2 ** 20)

def factors(n):
	return list(set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0))))
for _ in range(int(stdin.readline())):
	n = int(stdin.readline())
	a = list(map(int, stdin.readline().split()))
	a.sort()
	ans = 1
	for i in range(n - 1, -1, -1):
		if i + 1 >= a[i]:
			ans += i + 1
			break
	print(ans)


T = int(input())
for _ in range(T):
	N = int(input())
	A = list(map(int, input().split()))
	A.sort()
	ans = 0
	for i in range(N):
		if A[i] - i - 1 <= 0:
			ans = max(ans, i + 1)
	print(ans + 1)


import sys
readline = sys.stdin.readline
ns = lambda : readline().rstrip()
ni = lambda : int(readline().rstrip())
nm = lambda : map(int, readline().split())
nl = lambda : list(map(int, readline().split()))

def solve():
	n = ni()
	a = nl() + [0]
	a.sort()
	for i in range(n, -1, -1):
		if a[i] <= i:
			print(i + 1)
			break
	return
T = int(input())
for _ in range(T):
	solve()


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	result = 1
	for i in range(n - 1, -1, -1):
		if a[i] <= i + 1:
			result = i + 2
			break
	print(result)


t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	a = [int(i) for i in input().split()]
	a.sort()
	ans = 1
	for i in range(n):
		if a[i] <= i + 1:
			ans = i + 2
	print(ans)


import io, os
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
import sys
from bisect import bisect_right

def solve(n, A):
	ans = 1
	for a in A:
		cnt = bisect_right(A, a)
		if cnt - 1 >= a:
			ans = max(ans, cnt)
	return ans

def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		A = [1] + list(map(int, input().split()))
		A.sort()
		ans = solve(n, A)
		sys.stdout.write(str(ans) + '\n')
main()


sc = map(int, open(0).read().split())
ni = lambda : next(sc)
T = ni()
for _ in range(T):
	N = ni()
	A = sorted((ni() for _ in range(N)))
	res = 0
	for (i, a) in enumerate(A, 1):
		if a <= i:
			res = i
	print(res + 1)


for t in range(int(input())):
	n = int(input())
	l = sorted(map(int, input().split()))
	f = 0
	for i in range(n - 1, -1, -1):
		if l[i] <= i + 1:
			print(i + 2)
			f = 1
			break
	if f == 0:
		print(1)


ipo = int(input())
for jkl in range(ipo):
	ghf = int(input())
	xcv = list(map(int, input().split()))
	xcv.sort()
	zxnm = 1
	qwer = -1
	for jkl in range(ghf):
		if zxnm >= xcv[jkl]:
			qwer = jkl
		zxnm = zxnm + 1
	print(qwer + 2)


for _ in range(int(input())):
	n = int(input())
	a = sorted(map(int, input().split()))
	while a and a[-1] > len(a):
		a.pop()
	print(1 + len(a))


for num in range(int(input())):
	an = int(input())
	al = list(map(int, input().split()))
	al.sort()
	temp = 1
	gc = 1
	for i in range(len(al) - 1):
		if gc >= al[i]:
			gc += 1
			temp += 1
		else:
			temp += 1
			if temp >= al[i + 1]:
				gc = temp
	if gc >= al[-1]:
		gc += 1
	print(gc)


from sys import stdin
from math import ceil

def func():
	return
for _ in range(int(input())):
	n = int(input())
	arr = sorted(list(map(int, stdin.readline().split())))
	m = 0
	for i in range(n):
		if arr[i] <= i + 1:
			m = i + 1
	print(m + 1)


t = int(input())
for ck in range(t):
	n = int(input())
	if n == 0:
		print(1)
	else:
		array = list(map(int, input().split()))
		array.sort()
		array = [0] + array
		ans = 1
		for i in range(n + 1):
			if array[i] <= i:
				ans = i + 1
		print(ans)


import os
import sys
from io import BytesIO, IOBase
import math
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 _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	f = True
	for i in range(n - 1, -1, -1):
		if l[i] <= i + 1:
			print(i + 2)
			f = False
			break
	if f:
		print('1')


t = int(input())
for x in range(t):
	N = int(input())
	n = list(map(int, input().split()))
	n.sort()
	j = N - 1
	max_grannies = 1
	while j >= 0:
		if n[j] <= j + 1:
			max_grannies = j + 2
			break
		j -= 1
	print(max_grannies)


for i in range(int(input())):
	g = input()
	list = [x for x in map(int, input().split())]
	list.sort()
	list = list[::-1]
	for (i, j) in enumerate(list):
		if j <= len(list) - i:
			print(len(list) - i + 1)
			break
	else:
		print(1)


T = int(input())
for _ in range(T):
	n = int(input())
	a = list(map(int, input().split()))
	a.append(0)
	a.sort()
	fl = True
	for i in range(n, -1, -1):
		if a[i] <= i:
			break
	print(i + 1)


from functools import reduce

def solve():
	n = int(input())
	a = sorted(map(int, input().split()))
	print(reduce(lambda cnt, i: i + 2 if a[i] < i + 2 else cnt, range(n), 1))
for _ in range(int(input())):
	solve()


import collections
for i in range(0, int(input())):
	m = int(input())
	l = list(map(int, input().split()))
	c = 1
	d1 = collections.Counter(l)
	d = sorted(d1.items())
	g = [0]
	g1 = {}
	for i in d:
		g.append(g[-1] + i[1])
		g1.setdefault(i[0], g[-1])
	c = 1
	ma = 0
	for i in d:
		if g1[i[0]] >= i[0]:
			c = g1[i[0]] + 1
	print(c)


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


for _ in range(int(input())):
	n = int(input())
	A = set()
	D = {}
	for i in input().split():
		i = int(i)
		A.add(i)
		try:
			D[i] += 1
		except:
			D[i] = 1
	A = list(A)
	A.sort()
	result = 1
	temp = 1
	for i in A:
		temp += D[i]
		if i < temp:
			result = temp
	print(result)


from math import ceil, log, floor, sqrt
import math
k = 1

def mod_expo(n, p, m):
	result = 1
	while p != 0:
		if p % 2 == 1:
			result = result * n % m
		p //= 2
		n = n * n % m
	return result

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

def find_sum(n, a):
	a.insert(0, 0)
	for i in range(1, n + 1):
		prev = a[i] & a[i - 1]
		cur = a[i] | a[i - 1]
		a[i - 1] = prev
		a[i] = cur
	return sum((m * m for m in a))

def prin_abc(x, y, z):
	l = [x, y, z]
	l.sort()
	if l[1] < l[2]:
		print('NO')
		return
	a = b = l[0]
	c = l[2]
	print('YES')
	print(a, b, c)

def get_scores(n, vals):
	l = 0
	r = n - 1
	turn = 0
	sereja = 0
	dima = 0
	while l <= r:
		if vals[l] > vals[r]:
			cur = vals[l]
			l += 1
		else:
			cur = vals[r]
			r -= 1
		if turn == 0:
			sereja += cur
		else:
			dima += cur
		turn = not turn
	print(sereja, dima)

def count_lamps(n, m):
	return (n * m + 1) // 2

def find_count(n, gran):
	gran.sort()
	for i in range(n - 1, -1, -1):
		if i + 1 >= gran[i]:
			return i + 2
	return 1
t = 1
t = int(input())
while t:
	t = t - 1
	points = []
	n = int(input())
	a = list(map(int, input().strip().split()))[:n]
	print(find_count(n, a))


T = int(input())
for t in range(T):
	N = int(input())
	M = [int(s) for s in input().split()]
	M = sorted(M)
	i = len(M) - 1
	while i >= 0 and M[i] > i + 1:
		i -= 1
	print(i + 2)


t = int(input())
for u in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	g = n
	for i in range(n - 1, -1, -1):
		if g < l[i]:
			g = g - 1
		else:
			break
	print(g + 1)


for _ in range(int(input())):
	n = int(input())
	A = list(map(int, input().split()))
	A.sort()
	ans = 0
	i = n - 1
	while i >= 0:
		if A[i] <= i + 1:
			ans = i + 1
			break
		i -= 1
	print(ans + 1)


def solve():
	n = int(input())
	arr = list(map(int, input().split()))
	ans = 1
	arr.sort()
	for i in range(n - 1, -1, -1):
		if arr[i] <= i + 1:
			ans += i + 1
			break
	print(ans)

def main():
	T = int(input())
	while T:
		solve()
		T -= 1
main()


t = int(input())
for i in range(t):
	n = int(input())
	i = list((int(num) for num in input().strip().split()))[:n]
	i.sort()
	c = 1
	for j in range(len(i)):
		if i[j] <= c:
			c = j + 2
			continue
		if i[j] > j + 1:
			continue
		else:
			c = j + 2
	print(c)


for loop in range(int(input())):
	n = int(input())
	(*a,) = map(int, input().split())
	a.sort()
	for i in range(n):
		a[i] = i + 1 - a[i]
	a.reverse()
	ans = 1
	for i in range(n):
		if a[i] >= 0:
			ans = n - i + 1
			break
	print(ans)


for _ in range(int(input())):
	n = int(input())
	arr = sorted(list(map(int, input().split())))
	ans = 1
	for i in range(n - 1, -1, -1):
		if arr[i] <= i + 1:
			ans = i + 2
			break
	print(ans)


t = int(input())
for x in range(t):
	n = int(input())
	grannies = list(map(int, input().split()))
	grannies.sort(reverse=True)
	answer = 0
	counter = 0
	notdone = True
	for y in range(len(grannies)):
		if len(grannies) - counter >= grannies[y]:
			print(len(grannies[y:]) + 1)
			notdone = False
			break
		else:
			counter += 1
	if notdone:
		print(1)


T = int(input())
for t in range(T):
	n = int(input())
	A = sorted([int(i) for i in input().split()])
	while len(A) > 0 and A[-1] > len(A):
		A.pop()
	print(len(A) + 1)


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	_ = input()
	a = list(map(int, input().split()))
	a.sort()
	ans = 0
	for (i, ai) in enumerate(a, 1):
		if ai <= i:
			ans = i
	print(ans + 1)


for i in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	c = 1
	i = n - 1
	a.sort()
	while i >= 0:
		if c + i >= a[i]:
			c += i + 1
			break
		i -= 1
	print(c)


import math
t = int(input())
ans = []
for x in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	maxgrannies = 1
	a.sort()
	for x in range(n):
		if x + 1 >= a[x]:
			maxgrannies = x + 2
		else:
			continue
	ans.append(maxgrannies)
for a in ans:
	print(a)


import sys
input = sys.stdin.readline
from collections import *
t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	for i in range(n - 1, -1, -1):
		if a[i] <= i + 1:
			print(i + 2)
			break
	else:
		print(1)


import math
for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	x = 0
	for i in range(n - 1, -1, -1):
		if arr[i] <= i + 1:
			x = i + 1
			break
	print(x + 1)


tc = int(input())
while tc > 0:
	n = int(input())
	ans = 1
	for (k, v) in enumerate(sorted(map(int, input().split()))):
		if v <= k + 1:
			ans = k + 2
	print(ans)
	tc -= 1


def solve():
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	for i in range(n - 1, -1, -1):
		if a[i] <= i + 1:
			return i + 2
	return 1
for t in range(0, int(input())):
	print(solve())


from math import ceil
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a = sorted(a)
	av = 1
	count = 0
	for i in a:
		count += 1
		if av + count - 1 > i - 1:
			av += count
			count = 0
	print(av)


import math
import random
mod = 1000000007
r1 = lambda : int(input())
rm = lambda : map(int, input().split())
rls = lambda : list(rm())
test = int(input())
while test:
	test -= 1
	n = r1()
	ls = rls()
	ls.sort()
	ans = 0
	for i in range(n):
		if i + 1 >= ls[i]:
			ans = i + 1
	print(ans + 1)


T = int(input())
for _ in range(0, T):
	n = int(input())
	s = [int(x) for x in input().split()] + [200005]
	s.sort()
	ans = 1
	i = 0
	while i < len(s):
		temp = 0
		for j in range(i, len(s)):
			if j + 1 >= s[j]:
				i = j + 1
				ans = max(ans, j + 2)
				temp = 1
				break
		if temp == 0:
			break
	print(ans)


def main():
	n = int(input())
	arr = list(sorted(map(int, input().split())))
	for i in range(n - 1, -1, -1):
		if i + 1 >= arr[i]:
			print(i + 2)
			return
	print('1')
for _ in range(int(input())):
	main()


from pprint import pprint
import sys
input = sys.stdin.readline
import collections
q = int(input())
for _ in range(q):
	n = int(input())
	dat = list(map(int, input().split()))
	dat.sort()
	res = -1
	for i in range(n):
		c = i + 1
		if c >= dat[i]:
			res = c
	if res == -1:
		print(1)
	else:
		print(res + 1)


def find(a, cur, n):
	x = 0
	for i in range(n):
		if cur >= a[i]:
			x = i
			cur += 1
	return x + 1

def main():
	t = int(input())
	for j in range(t):
		n = int(input())
		a = sorted([int(i) for i in input().split()])
		cur = 1
		cur1 = 1
		for i in range(n):
			if cur >= a[i]:
				cur1 = cur + 1
			cur += 1
		print(cur1)
main()


from math import *
from copy import *
from string import *
from random import *
from sys import stdin
from sys import maxsize
from operator import *
from itertools import *
from collections import Counter
import math
import math
import time

def bin1(l, r, k, t, b, val, ans):
	if l > r:
		return ans
	else:
		mid = (l + r) // 2
		v = k ** mid
		if v == val:
			return v
		elif v > val:
			ans = mid
			return bin1(mid + 1, r, k, t, b, val, ans)
		else:
			return bin1(l, mid - 1, k, t, b, val, ans)

def bin2(l, r, k, t, b, val, ans):
	if l > r:
		return ans
	else:
		mid = (l + r) // 2
		v = t * k ** mid + b * mid
		if v == val:
			return v
		elif v > val:
			ans = mid
			return bin2(l, mid - 1, k, t, b, val, ans)
		else:
			return bin2(mid + 1, r, k, t, b, val, ans)

def SieveOfEratosthenes(n):
	prime = [-1 for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == -1:
			for i in range(p * p, n + 1, p):
				prime[i] = p
		p += 1
	l1 = []
	for i in range(2, n + 1):
		if prime[i] == -1:
			l1.append(i)
	return l1

def bin(l, r, ll, val):
	if l > r:
		return -1
	else:
		mid = (l + r) // 2
		if val >= ll[mid][0] and val <= ll[mid][1]:
			return mid
		elif val < ll[mid][0]:
			return bin(l, mid - 1, ll, val)
		else:
			return bin(mid + 1, r, ll, val)

def deci(n):
	s = ''
	while n != 0:
		if n % 2 == 0:
			n = n // 2
			s = '0' + s
		else:
			n = n // 2
			s = '1' + s
	return s

def diff(s1, s2):
	if len(s1) < len(s2):
		v = len(s1)
		while v != len(s2):
			s1 = '0' + s1
			v = v + 1
	else:
		v = len(s2)
		while v != len(s1):
			s2 = '0' + s2
			v = v + 1
	c = 0
	for i in range(len(s1)):
		if s1[i:i + 1] != s2[i:i + 1]:
			c = c + 1
	return c
from sys import stdin, stdout

def fac(a, b):
	v = a
	while a != b:
		v *= a - 1
		a = a - 1
	return v

def bino(l, r, n):
	if l > r:
		return -1
	else:
		mid = (l + r) // 2
		val1 = math.log(n / mid + 1, 2)
		val2 = int(val1)
		if val1 == val2:
			return val1
		elif val1 < 1.0:
			return bino(l, mid - 1, n)
		else:
			return bino(mid + 1, r, n)

def binary(l, r, val, ans):
	if l > r:
		return -1
	else:
		mid = (l + r) // 2
		v = val ** 5 - mid ** 5
		print(v)
		if v == ans:
			print('HOHOHOH')
			return mid
		elif v < ans:
			return binary(mid + 1, r, val, ans)
		else:
			return binary(l, mid - 1, val, ans)

def check(n):
	v = 1
	while n != 0:
		if n % 10 == 0 or n % 10 == 1:
			n = n // 10
		else:
			v = 0
			break
	return v

def stairs(n, m, val, c, l):
	if val > n:
		return 100000
	elif val == n:
		if l[val] != -1:
			return l[val]
		elif c % m == 0:
			l[val] = c
			return l[val]
		else:
			l[val] = 100000
			return l[val]
	else:
		l[val] = min(stairs(n, m, val + 1, c + 1, l), stairs(n, m, val + 2, c + 1, l))
		return l[val]

def fact(n):
	if n == 0 or n == 1:
		return 1
	else:
		return n * fact(n - 1)

def some(n):
	s = 0
	while n != 0:
		s += fact(n % 10)
		n //= 10
	return s

def bin(ll, l, r, val, ans):
	if l > r:
		return ans
	else:
		mid = (l + r) // 2
		if ll[mid] <= val:
			ans = mid
			return bin(ll, mid + 1, r, val, ans)
		else:
			return bin(ll, l, mid - 1, val, ans)

def fn(n):
	c = -1
	for i in range(2, int(sqrt(n)) + 1):
		if n % 2 == 0:
			c = i
			break
	if c == -1:
		c = n
	return c

def check(n):
	val = 0
	while n != 0:
		if n % 10 > 1:
			val = -1
			break
		n = n // 10
	return val

def gcd(a, b):
	if b == 0:
		return a
	else:
		return gcd(b, a % b)
t = int(input())
for i in range(t):
	n = int(input())
	l = list(map(int, input().split(' ')))
	l.sort()
	maxa = 1
	c = 1
	for j in range(n):
		c += 1
		if c - 1 >= l[j]:
			if maxa < c:
				maxa = c
	print(maxa)


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().strip().split()))
	ng = 1
	a.sort()
	for j in range(n):
		if j + 1 >= a[j]:
			ng = j + 2
	print(ng)


from math import *
from collections import *
from operator import itemgetter
import bisect
from heapq import *
i = lambda : input()
ii = lambda : int(input())
iia = lambda : list(map(int, input().split()))
isa = lambda : list(input().split())
I = lambda : list(map(int, input().split()))
chrIdx = lambda x: ord(x) - 96
idxChr = lambda x: chr(96 + x)
t = ii()
for _ in range(t):
	n = ii()
	a = iia()
	a.sort()
	d = dict(Counter(a))
	g = 1
	ex = 0
	ey = 0
	for i in a:
		if g + ex >= i:
			g += 1
			g += ey
			ex = 0
			ey = 0
		else:
			ex += 1
			ey += 1
	print(g)


t = int(input())
res = []
for i in range(t):
	n = int(input())
	a = sorted([int(ai) for ai in input().split()])
	currGrannies = 1
	while currGrannies <= n + 1:
		newGrannies = -1
		for j in reversed(range(currGrannies - 1, n)):
			if a[j] <= j + 1:
				newGrannies = j + 2
				break
		if newGrannies == -1:
			break
		else:
			currGrannies = newGrannies
	res.append(currGrannies)
for r in res:
	print(r)


def task(n, a):
	table = {}
	for aa in a:
		if not aa in table:
			table[aa] = 0
		table[aa] += 1
	g = 1
	nxt = 0
	for i in sorted(table.keys()):
		if table[i] > 0:
			if g + nxt + table[i] > i:
				g += nxt + table[i]
				nxt = 0
			else:
				nxt += table[i]
	print(g)
t = int(input())
for i in range(0, t):
	n = int(input())
	a = list(map(int, input().split()))
	task(n, a)


from sys import stdin, stdout

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

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

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

def op(ans):
	return stdout.write(str(ans) + '\n')
t = ip()
while t:
	t -= 1
	n = ip()
	li = ai()
	li.sort()
	li = [1] + li
	count = 0
	ans = 0
	for i in range(1, n + 1):
		if li[i] <= i:
			ans = i
	op(ans + 1)


import sys
TEST = 0
if TEST == 1:
	input_file = open('inputB.txt', 'r')
	input_from_file = input_file.readlines()

def read_int():
	if TEST:
		return int(input_from_file.pop(0))
	else:
		return int(sys.stdin.readline())

def read_ints():
	if TEST:
		return list(map(int, input_from_file.pop(0).rstrip().split()))
	else:
		return list(map(int, sys.stdin.readline().split()))

def read_str_to_list():
	if TEST:
		in1 = input_from_file.pop(0).rstrip()
	else:
		in1 = sys.stdin.readline()
	return in1
t = read_int()
for test in range(t):
	N = read_int()
	a = read_ints()
	a.sort()
	ans = 1
	for (i, a_i) in enumerate(a):
		if a_i <= i + 1:
			ans = i + 1 + 1
	print(ans)


t = int(input())
for i in range(t):
	n = int(input())
	nGrany = 1
	A = [int(x) for x in input().split()]
	A.sort()
	for j in range(n):
		if A[j] < j + 2:
			nGrany = j + 2
	print(nGrany)


from math import *
from collections import *
from itertools import *
from bisect import *
from heapq import *
from operator import *
from sys import *
setrecursionlimit(1000000)
d = defaultdict(lambda : 0, {})

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

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

def o():
	return int(input())

def r(x):
	if type(x) == int:
		return range(x)
	else:
		return range(len(x))

def kl(con, x=0):
	if x == 0:
		print('Yes') if con else print('No')
	elif x == 1:
		print('yes') if con else print('no')
	elif x == 2:
		print('YES') if con else print('NO')
MOD = 1000000007
MAX = float('inf')
MIN = -float('inf')
p = input
for _ in range(o()):
	n = o()
	l = op()
	l.sort()
	c = 1
	for i in reversed(r(l)):
		if l[i] <= i + 1:
			print(i + 2)
			break
	else:
		print(1)


import sys
input = sys.stdin.buffer.readline

def prog():
	for _ in range(int(input())):
		n = int(input())
		grannies = list(map(int, input().split()))
		grannies.sort()
		ans = 0
		for i in range(n):
			if grannies[i] <= i + 1:
				ans = i + 1
		print(ans + 1)
prog()


for _ in range(int(input())):
	n = int(input())
	a = sorted(map(int, input().split()))
	ans = 1
	i = 0
	while i < n:
		if ans >= a[i]:
			ans += 1
			i += 1
			continue
		ct = 1
		j = i
		while j < n and ct + ans <= a[j]:
			j += 1
			ct += 1
		if j == len(a):
			break
		else:
			i = j
			ans += ct
		i += 1
	print(ans)


from sys import stdin
from math import gcd, sqrt
input = stdin.readline
R = lambda : map(int, input().split())
I = lambda : int(input())
S = lambda : input().rstrip('\n')
for _ in range(I()):
	n = I()
	a = sorted(R())
	ans = 1
	l = 0
	for i in range(n):
		l += 1
		if a[i] <= ans + l - 1:
			ans += l
			l = 0
	print(ans)


a = int(input())
store = [1] * a
for i in range(a):
	number = int(input())
	b = input()
	count = 1 + number
	c = [int(x) for x in b.split()]
	c.sort()
	for j in range(len(c)):
		k = -(j + 1)
		if c[k] >= count:
			count = count - 1
		elif count == 1 or c[k] < count:
			store[i] = count
			break
for i in range(a):
	print(store[i])


import sys
input = sys.stdin.readline

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

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

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 = 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:
		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:
			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(1000000.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 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 = 1
	count = 0
	for i in a:
		if i <= ans + count:
			ans += 1
			ans += count
			count = 0
		else:
			count += 1
	print(ans)


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().rstrip().split()))
	a.sort()
	ng = 1
	for i in range(len(a) - 1, -1, -1):
		if i + 1 >= a[i]:
			ng += i + 1
			break
	print(ng)


t = int(input())
for _ in range(t):
	n = int(input())
	lst = input().split()
	lst = [int(i) for i in lst]
	dct = {}
	for i in lst:
		dct[i] = dct.get(i, 0) + 1
	mx = 1
	ans = 1
	for i in sorted(dct.keys()):
		ans += dct[i]
		if ans - 1 >= i:
			mx = max(mx, ans)
	print(mx)


t = int(input())
for j in range(t):
	n = int(input())
	array = sorted(list(map(int, input().split())))
	rama = [[0, 0]]
	for i in range(n):
		rama.append([array[i], i + 1])
	rama = rama[::-1]
	for i in rama:
		if i[0] <= i[1]:
			break
	print(i[1] + 1)


t = int(input())
for _ in range(t):
	input()
	a = list(map(int, input().split()))
	a.sort()
	last_k = 1
	for (i, n) in enumerate(a, start=2):
		if n < i:
			last_k = i
	print(last_k)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	g = 1
	(i, j, k) = (0, 0, 0)
	d = 1
	while i < n:
		if a[i] <= d:
			d += 1
			if k == 0:
				g += 1
			else:
				g += j + 1
				j = 0
			k = 0
		else:
			j += 1
			d += 1
			k = 1
		i += 1
	print(g)


import math
t = int(input())
for i in range(t):
	tot = 1
	p = 0
	i = 0
	n = int(input())
	m = [int(x) for x in input().split()]
	m.sort()
	while i != n:
		if m[i] <= i - p + tot:
			tot += i - p + 1
			i += 1
			p = i
		else:
			i += 1
	print(tot)


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())
from collections import Counter
for i in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	c = Counter(l)
	l1 = []
	for j in c:
		l1.append(j)
	l1.sort()
	ans = 1
	x = 1
	j = 0
	while j < len(l1):
		if x + c[l1[j]] - 1 >= l1[j]:
			x += c[l1[j]]
			ans = x
			j += 1
		else:
			x += c[l1[j]]
			j += 1
	print(ans)


t = int(input())
for a in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	c = 1
	k = 1
	i = 0
	while i < n:
		if c >= l[i]:
			i += 1
			c += 1
			k += 1
		elif k >= l[i]:
			k += 1
			c = k
			i += 1
		else:
			k += 1
			i += 1
	print(c)


for test in range(int(input())):
	n = int(input()) + 1
	x = [int(x) for x in input().split()]
	x.sort()
	person = n
	for i in range(len(x) - 1, -1, -1):
		if x[i] >= person:
			n = n - 1
			person = n
		else:
			n = i
	print(person)


import sys
input = sys.stdin.readline
t = int(input())
for q in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	rst = 1
	curcount = 0
	for x in range(n):
		if a[x] > n + 1:
			break
		else:
			cur = a[x]
			if rst < cur:
				curcount += 1
				if rst + curcount > cur:
					rst += curcount
					curcount = 0
			else:
				rst += 1
	print(rst)


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
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)]
for _ in range(l()[0]):
	n = l()[0]
	A = l()
	A.sort()
	ans = 1
	for i in range(n - 1, -1, -1):
		if 1 + i >= A[i]:
			ans = i + 2
			break
	print(ans)


def solve():
	n = int(input())
	lst = [int(i) for i in input().split()]
	lst.sort()
	ans = 1
	for i in range(n):
		if lst[i] <= i + 1:
			ans = i + 2
	return ans
for _ in range(int(input())):
	print(solve())


for _ in range(int(input())):
	N = int(input())
	A = list(map(int, input().split()))
	A.sort()
	count = 0
	for i in range(N):
		if A[i] <= i + 1:
			count = i + 1
	print(count + 1)


t = int(input())
for _ in range(t):
	n = int(input())
	a = sorted(list(map(int, input().split())))
	count = 1
	mc = 0
	c = 0
	for i in range(n):
		c += 1
		mc = max(mc, a[i])
		if count + c - 1 >= mc:
			count += c
			c = 0
			mc = 0
	print(count)


for _ in range(int(input())):
	n = int(input())
	a = sorted(list(map(int, input().split())))
	ans = 0
	for (i, x) in enumerate(a):
		ans = max(ans, (i + 1) * (x <= i + 1))
	else:
		print(ans + 1)


t = int(input())
for _ in range(t):
	n = int(input())
	l = [int(x) for x in input().split()]
	l.sort()
	i = n - 1
	flag = 0
	while i >= 0:
		if l[i] <= i + 1:
			print(i + 2)
			flag = 1
			break
		i -= 1
	if flag == 0:
		print(1)


for _ in range(int(input())):
	n = int(input())
	ar = sorted(list(map(int, input().split())))
	z = 0
	for i in range(n):
		if ar[i] <= i + 1:
			z = i + 1
	print(z + 1)


t = int(input())
for _ in range(t):
	n = int(input())
	cnt = 1
	a = sorted(map(int, input().split()))
	cur_cnt = 1
	for i in a:
		if i <= cur_cnt:
			cur_cnt += 1
			cnt = cur_cnt
		else:
			cur_cnt += 1
	print(cnt)


t = int(input())
for g in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	a = 1
	c = 1
	for i in range(n):
		d = l[i] - c
		c = c + 1
		if d <= 0:
			a = c
	print(a)


t = int(input())
while t:
	t -= 1
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	l.append(-1)
	lis = []
	lis.append(l[0])
	fre = []
	k = 1
	contain = 0
	for i in range(1, n + 1):
		contain += 1
		if l[i] != l[i - 1]:
			lis.append(l[i])
			fre.append(k)
			k = 1
		else:
			k += 1
	contain += 1
	i = len(lis) - 2
	while i >= 0:
		if contain > lis[i]:
			break
		else:
			contain -= fre[i]
			i -= 1
	print(contain)


from sys import stdin, stdout
from math import *
from heapq import *
from collections import *

def main():
	ntest = int(stdin.readline())
	for testcase in range(ntest):
		n = int(stdin.readline())
		a = [int(z) for z in stdin.readline().split()]
		a.sort()
		res = 1
		for (i, x) in enumerate(a, 2):
			if x < i:
				res = i
		stdout.write('%d\n' % res)
	return 0
main()


import sys
input = sys.stdin.readline
from collections import Counter
t = int(input())
for _ in range(t):
	n = int(input())
	a = [int(item) for item in input().split()]
	cnt = Counter(a)
	items = []
	for (k, v) in cnt.items():
		items.append((k, v))
	items.sort()
	total = 0
	ans = 0
	for (k, v) in items:
		total += v
		if total >= k:
			ans = total
	print(ans + 1)


for k in range(int(input())):
	b = int(input())
	a = list(map(int, input().split()))
	a.sort()
	p = 1
	for i in range(b):
		if a[i] <= i + 1:
			p = i + 2
	print(p)


import sys
input = sys.stdin.readline
I = lambda : list(map(int, input().split()))
(t,) = I()
for i in range(t):
	(n,) = I()
	l = [0] + sorted(I())
	an = 0
	r = 0
	v = 1
	for i in range(1, n + 1):
		if l[i - 1] == l[i]:
			v += 1
		elif an + v + r - 1 >= l[i - 1]:
			an += v + r
			r = 0
			v = 1
		else:
			r += v
			v = 1
	if an + v + r - 1 >= l[n]:
		an += v + r
	print(an)


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	count = 1
	x = 0
	for i in range(n):
		if l[i] <= count:
			count += 1
		else:
			x += 1
			if l[i] == i + 1:
				count += x
				x = 0
	print(count)


t = input()
t = int(t)
l = []
for i in range(t):
	s = 1
	su = 0
	n = input()
	n = int(n)
	a = [int(x) for x in input().split(' ')]
	a.sort()
	for j in a:
		if j > su + s:
			su += 1
		else:
			s += 1
			s += su
			su = 0
	l.append(s)
for i in l:
	print(i)


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()))
	a = sorted(a)
	ans = 0
	for i in range(n):
		if a[i] <= i + 1:
			ans = i + 1
	print(ans + 1)


for i in range(int(input())):
	m = int(input())
	n = list(map(int, input().split()))
	n.sort()
	a = 0
	for i in range(m):
		if n[i] <= i + 1:
			a = i + 1
	print(a + 1)


n = int(input())
for _ in range(n):
	b = int(input())
	lis = list(map(int, input().split()))
	lis.sort()
	tes = [i + 1 for i in range(len(lis) + 1)]
	a = len(lis)
	ans = 1
	for i in range(len(lis)):
		if lis[a - i - 1] <= tes[a - i - 1]:
			ans += a - i
			break
	print(ans)


n = int(input())
for i in range(0, n):
	q = int(input())
	a = list(map(int, input().split()))
	a.sort()
	count = 1
	k = q
	for j in range(q - 1, -1, -1):
		if k >= a[j]:
			break
		else:
			k -= 1
	print(k + 1)


t = int(input())
for i in range(t):
	n = int(input())
	a = sorted([int(i) for i in input().split()])
	num_grandmas = 1
	for j in range(n):
		if a[j] <= j + 1:
			num_grandmas = j + 2
	print(num_grandmas)


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
for t in range(ii()):
	n = ii()
	arr = list(mi())
	arr = sorted(arr)
	grannies = 1
	cnt = 1
	for i in range(n):
		if cnt >= arr[i]:
			grannies = cnt + 1
		cnt += 1
	print(grannies)


t = int(input())
for i in range(t):
	n = int(input())
	output = 1
	list = [int(i) for i in input().split()]
	k = list.count(1)
	list.sort()
	output += k
	i = 0
	a = k
	for i in range(k, n):
		if output + (a - k) >= list[i]:
			output += a - k + 1
			a = k
			continue
		a += 1
	print(output)


t = int(input())
for i in range(t):
	n = int(input())
	a = [int(s) for s in input().split()]
	a.sort()
	a.reverse()
	m = False
	for j in range(n):
		if a[j] <= n - j:
			print(n - j + 1)
			m = True
			break
	if not m:
		print(1)


for _ in range(int(input())):
	n = int(input())
	arr = [int(s) for s in input().split()]
	arr.sort()
	count = 0
	mask = [i + 1 for i in range(n)]
	for i in range(n - 1, -1, -1):
		if mask[i] >= arr[i]:
			count = mask[i]
			break
	print(count + 1)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	t = n
	p = 1
	for i in range(n - 1, -1, -1):
		if t >= a[i]:
			p += t
			break
		t -= 1
	print(p)


from collections import Counter

def solve(g):
	c = list(sorted(Counter(g).items()))
	max_grannies = 1
	current_grannies = 1
	for (k, v) in c:
		current_grannies += v
		if current_grannies > k:
			max_grannies = current_grannies
	return max_grannies
T = int(input())
for _ in range(T):
	n = int(input())
	g = [int(_) for _ in input().split()]
	print(solve(g))


tests = int(input())
for i in range(tests):
	n = int(input())
	line = list(map(int, input().split()))
	granniesOK = False
	line.sort()
	for j in range(n - 1, -1, -1):
		if line[j] <= j + 1:
			print(j + 2)
			granniesOK = True
			break
	if not granniesOK:
		print(1)


import io
import os
import functools
import itertools
import math
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
t = int(input())
while t:
	t -= 1
	n = int(input())
	a = sorted([int(x) for x in input().split()])
	k = 0
	for i in range(len(a)):
		if a[i] <= i + 1:
			k = i + 1
	print(k + 1)


t = int(input())
for test in range(t):
	n = int(input())
	nums = [int(x) for x in input().split()]
	ans = 1
	nums.sort()
	rem = n
	for i in range(n - 1, -1, -1):
		if nums[i] <= rem:
			break
		else:
			rem -= 1
	print(rem + 1)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	ans = n + 1
	for i in range(n - 1, -1, -1):
		if a[i] >= ans:
			ans -= 1
	print(ans)


from collections import defaultdict

def main():
	t = int(input())
	for i in range(t):
		solve()

def solve():
	n = int(input())
	arr = sorted(list(map(int, input().split(' '))))
	amount = 1
	index = 0
	while index < len(arr):
		if arr[index] <= index + 1:
			amount = index + 2
		index += 1
	print(amount)
main()


for _ in range(int(input())):
	n = int(input())
	ar = list(map(int, input().split()))
	ans = 1
	ar.sort()
	i = 0
	flag = 0
	while i < n:
		if ar[i] <= ans:
			ans += 1
			flag = 0
		elif ar[i] <= ans + flag:
			ans += flag + 1
			flag = 0
		else:
			flag += 1
		i += 1
	print(ans)


n = int(input())
for y in range(n):
	l = int(input())
	a = list(map(int, input().split()))
	a.sort()
	cnt = 1
	cnt1 = 0
	ans = 1
	flag = 0
	x = 1
	for i in range(l):
		if cnt - a[i] >= 0 and flag == 0:
			cnt += 1
			ans += 1
			x = ans
		if cnt - a[i] < 0:
			if flag == 0:
				x = i + 1
			cnt1 += 1
			cnt += 1
			flag = 1
		elif x + cnt1 == a[i] and cnt - a[i] >= 0 and (flag == 1):
			cnt += 1
			ans += cnt1 + 1
			x = ans
			cnt1 = 0
			flag = 0
	print(x)


t = int(input())
for i in range(t):
	n = int(input())
	arr = list(map(int, input().strip().split()))
	arr.sort()
	count = 1
	for j in range(n):
		if arr[j] <= j + 1:
			count = j + 2
	print(count)


import sys, bisect
tc = int(sys.stdin.readline())
for _ in range(tc):
	n = int(sys.stdin.readline())
	arr = list(map(int, sys.stdin.readline().split()))
	arr.sort()
	find = -1
	for i in range(n - 1, -1, -1):
		idx = bisect.bisect_right(arr, arr[i])
		if idx >= arr[i]:
			find = idx + 1
			break
	if find > 0:
		print(find)
	else:
		print(1)


import math
from collections import deque
t = int(input())
rez = []
for i in range(t):
	n = int(input())
	a = input().split()
	k = 1
	k1 = 0
	for j in range(n):
		a[j] = int(a[j])
	a.sort()
	for j in range(n):
		if a[j] <= k + j:
			k1 = j + 1
	rez.append(k + k1)
for i in range(len(rez)):
	print(rez[i])


a = int(input())
for _ in range(a):
	b = int(input())
	t = sorted(list(map(int, input().split())))
	max = 0
	for i in range(b):
		if t[i] <= i + 1:
			max = i + 1
	print(max + 1)


t = int(input())
for _ in range(t):
	n = int(input())
	ls = sorted(list(map(int, input().split())))
	call = n - 1
	ans = 0
	while call >= 0:
		if ls[call] <= call + 1:
			ans = call + 1
			break
		else:
			call -= 1
	if ans == 0:
		print(1)
	else:
		print(ans + 1)


def readintlst():
	return list(map(int, input().split(' ')))
n = int(input())
for _ in range(n):
	_ = input()
	arr = readintlst()
	arr.sort()
	for i in range(len(arr) - 1, -1, -1):
		if i + 1 >= arr[i]:
			break
	else:
		print(i + 1)
		continue
	print(i + 2)


def fn():
	n = int(input())
	l = list(map(int, input().split()))
	l.sort(reverse=True)
	for i in range(n):
		if n - i >= l[i]:
			return n - i + 1
	return 1
for _ in range(int(input())):
	print(fn())


import sys
n = int(input())
for i in range(n):
	o = []
	i = int(input())
	k = list(map(int, input().split()))
	k.sort()
	u = 1
	p = -1
	for g in range(len(k)):
		if len(k) - u + 1 >= k[p]:
			print(len(k[0:p]) + 2)
			o.append('a')
			break
			sys.exit()
		u += 1
		p -= 1
	if o:
		continue
	else:
		print(1)


from math import ceil

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

def multiple_input():
	return map(int, input().split())
for _ in range(int(input())):
	n = int(input())
	a = list_input()
	a.sort()
	check = 1
	i = 0
	ans = 0
	while i < n:
		if a[i] <= check:
			ans = i + 1
		check += 1
		i += 1
	print(ans + 1)


import sys, math, os
from io import BytesIO, IOBase
from bisect import bisect_left as bl, bisect_right as br, insort
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')
sys.setrecursionlimit(100000)
INF = float('inf')
mod = int(1000000000.0) + 7

def main():
	for i in range(int(data())):
		n = int(data())
		A = mdata()
		cnt1 = 1
		cnt2 = 1
		A.sort()
		for i in range(n):
			if A[i] <= cnt2:
				cnt2 += 1
				cnt1 = cnt2
			else:
				cnt2 += 1
		out(cnt1)

def __starting_point():
	main()
__starting_point()


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	count = 1
	temp = 0
	for i in range(n):
		if a[i] <= count:
			temp = i + 1
		count += 1
	print(temp + 1)


def solve():
	n = int(input())
	nums = [0] + list(sorted(map(int, input().split())))
	last = 0
	for i in range(n + 1):
		if nums[i] <= i:
			last = i + 1
	print(last)
t = int(input())
for _ in range(t):
	solve()


T = int(input())
for t in range(T):
	input()
	arr = sorted([int(i) for i in input().split()])
	l = len(arr)
	while l > 0 and arr[-1] > l:
		arr.pop()
		l -= 1
	print(l + 1)


from collections import Counter
for t in range(int(input())):
	n = int(input())
	a = [int(i) for i in input().split()]
	cnt = Counter(a)
	cur = 1
	possible = 0
	for i in sorted(cnt.keys()):
		if i <= cur + cnt[i] - 1 + possible:
			cur += cnt[i] + possible
			possible = 0
		else:
			possible += cnt[i]
	print(cur)


for _ in range(int(input())):
	n = int(input())
	f = sorted(list(map(int, input().split())))
	i = 0
	m = 1
	while i < len(f):
		if i + 1 >= f[i]:
			m = max(i + 2, m)
		i += 1
	print(m)


def check(m, a):
	if a[m - 1] > m:
		return False
	return True
t = int(input())
for _ in range(t):
	n = int(input())
	a = [int(x) for x in input().split()]
	a.sort()
	(l, r) = (0, n)
	ans = 0
	for i in range(n + 1):
		if check(i, a):
			ans = i
	print(ans + 1)


t = int(input())
while t:
	t -= 1
	n = int(input())
	a = [int(x) for x in input().split()]
	s = sorted(list(set(a)))
	d = {}
	for x in s:
		d[x] = 0
	for i in a:
		d[i] = d[i] + 1
	s = 0
	c = 0
	for k in d.keys():
		s = s + d[k]
		if s >= k:
			c = 0
		else:
			c += d[k]
	print(n - c + 1)


t = int(input())
for a in range(t):
	n = int(input())
	bt = list(map(int, input().split()))
	bt.sort()
	if bt[0] >= 1:
		ans = 1
		temp = 1
		for a in bt:
			temp += 1
			if temp > a:
				ans = temp
		print(ans)
	else:
		print(1)


t = int(input())
for test in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	people = list(range(1, n + 1))
	attandees = n + 1
	for i in range(n - 1, -1, -1):
		if arr[i] <= people[i]:
			break
		else:
			attandees -= 1
	print(attandees)


def solve():
	n = int(input())
	arr = sorted([int(v) for v in input().split()])
	ans = 1
	for i in range(n):
		if i + 1 >= arr[i]:
			ans = i + 2
	print(ans)
t = int(input())
for _ in range(t):
	solve()


def solve():
	n = int(input())
	s = [int(x) for x in input().split()]
	s.sort()
	ans = 1
	compute = []
	last = s[0]
	count1 = 1
	for i in range(1, n):
		if s[i] == last:
			count1 += 1
		else:
			compute.append([s[i - 1], count1])
			count1 = 1
		last = s[i]
	else:
		compute.append([last, count1])
	ans = 1
	count = 0
	for i in range(len(compute)):
		count += compute[i][1]
		if compute[i][0] < count + ans:
			ans += count
			count = 0
	print(ans)
nums = int(input())
for _ in range(1, nums + 1):
	solve()


import math
t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	count = 1
	ans = 1
	for i in range(n):
		if arr[i] <= count:
			count += 1
			ans = count
		else:
			count += 1
	print(ans)


import queue
import math
t = int(input())
while t:
	n = int(input())
	a = input().split()
	a = [int(x) for x in a]
	a.sort()
	ans = 1
	for i in range(n + 1, 1, -1):
		if a[i - 2] < i:
			ans = i
			break
	print(ans)
	t -= 1


def gran(n, a):
	a.sort()
	for i in range(n - 1, -1, -1):
		if a[i] > i + 1:
			pass
		else:
			return i + 2
	return 1
for i in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	print(gran(n, a))


t = int(input())
for i in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	ans = 1
	for j in range(n - 1, -1, -1):
		if arr[j] <= j + 1:
			ans = j + 2
			break
	print(ans)


t = int(input())
for _ in range(t):
	grannies = int(input())
	a = sorted([int(o) for o in input().split()])
	total = 1
	currCounter = 1
	for i in range(len(a) - 1, -1, -1):
		if a[i] <= i + 1:
			print(i + 2)
			break
		if i == 0:
			print(1)


from collections import Counter
for _ in range(int(input())):
	input()
	c = Counter(map(int, input().split()))
	(result, cnt) = (1, 0)
	for k in sorted(c.keys()):
		cnt += c[k]
		if cnt >= k:
			result = cnt + 1
	print(result)


t = int(input())
result = []
for i in range(t):
	n = int(input())
	n = n + 1
	a = [int(x) for x in input().split(' ')]
	a.sort()
	a.reverse()
	for x in a:
		if x >= n:
			n = n - 1
		else:
			break
	result.append(n)
for x in result:
	print(x)


t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	c = 1
	k = 0
	l.sort()
	for i in range(n):
		if c + k >= l[i]:
			if k == 0:
				c += 1
			else:
				c += k + 1
			k = 0
		else:
			k += 1
	print(c)


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 *
for _ in range(ii()):
	n = ii()
	a = il()
	a.sort()
	c = 0
	for i in range(0, n):
		if a[i] <= i + 1:
			c = i + 1
	print(c + 1)


for _ in range(int(input())):
	n = int(input())
	s = list(map(int, input().split()))
	ans = 1
	k = 1
	s.sort()
	for i in range(n):
		if s[i] <= i + 1:
			ans = i + 2
	print(ans)


t = int(input())
for _ in range(t):
	n = int(input())
	a = [int(x) for x in input().split()]
	a.sort()
	cumu = n
	broken = False
	for i in range(n - 1, -1, -1):
		if a[i] <= cumu:
			broken = True
			break
		cumu -= 1
	if broken:
		print(i + 2)
	else:
		print(1)


from collections import Counter

def check(arr):
	d = Counter(arr)
	b = list(set(arr))
	b.sort()
	p = 0
	m = 0
	ans = 0
	for i in b:
		p += d[i]
		if p >= i:
			m = i
	for i in b:
		if i <= m:
			ans += d[i]
	return ans
t = int(input())
while t:
	n = int(input())
	arr = list(map(int, input().split()))
	print(check(arr) + 1)
	t -= 1


for t in range(int(input())):
	n = int(input())
	a = sorted([int(i) for i in input().split()])
	ans = 1
	for i in range(n):
		if a[i] <= i + 1:
			ans = max(ans, i + 2)
	print(ans)


for _ in range(int(input())):
	n = int(input())
	ar = list(map(int, input().split()))
	ar.sort()
	ans = 1
	tem = 0
	for i in range(n):
		tem += 1
		if ar[i] <= i + 1:
			ans += tem
			tem = 0
	print(ans)


for _ in range(int(input())):
	n = int(input())
	l = sorted(list(map(int, input().split())))
	(temp, cnt, ans) = (0, 1, 0)
	for i in l:
		if i <= cnt:
			temp = cnt
		ans = max(ans, temp)
		cnt += 1
	print(ans + 1)


from sys import stdin
for t in range(int(input())):
	n = int(input())
	arr = list(map(int, stdin.readline().split()))
	arr.sort()
	ct = 1
	rem = 0
	for i in range(n):
		if ct + rem >= arr[i]:
			ct += rem + 1
			rem = 0
		else:
			rem += 1
	print(ct)


for t in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	count = 0
	grannies = 1
	i = 0
	while i < n:
		if a[i] <= grannies:
			count = i + 1
			grannies += 1
			i += 1
			continue
		else:
			grannies += 1
			i += 1
	print(count + 1)


t = int(input())
for i in range(t):
	n = int(input())
	gra = [int(i) for i in input().split()]
	gra.sort()
	for i in range(len(gra)):
		if gra[-1] > n:
			gra.pop()
			n -= 1
		else:
			break
	print(n + 1)


t = int(input())
for i in range(t):
	k = 1
	n = int(input())
	a = list(map(int, input().split()))
	a.sort(reverse=True)
	ind = 0
	for element in a:
		if element > n:
			n -= 1
		else:
			break
	k += n
	print(k)


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	res = 1
	for i in range(n):
		if 1 + i >= a[i]:
			res = max(res, i + 2)
	print(res)


def correct(n, granny):
	k = sorted(granny)
	max = 1
	for i in range(n - 1, -1, -1):
		if k[i] <= i + 1:
			max = i + 2
			break
	print(max)
t = int(input())
i = 0
while i < t:
	n = int(input())
	granny = list(map(int, input().split()))
	correct(n, granny)
	i = i + 1


T = int(input())

def main():
	n = int(input())
	arr = sorted(list(map(int, input().split())), reverse=True)
	for i in range(n):
		ppl_inside = n - i
		if ppl_inside >= arr[i]:
			return ppl_inside + 1
	return 1
for _ in range(T):
	print(main())


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort(reverse=False)
	ans = 0
	for i in range(n - 1, -1, -1):
		if a[i] <= i + 1:
			ans = i + 1
			break
	print(ans + 1)


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	arr = []
	for i in range(1, n + 1):
		arr.append([a[i - 1], i])
	ans = 0
	i = len(arr) - 1
	while i >= 0:
		if arr[i][0] <= arr[i][1]:
			ans = i + 1
			break
		i -= 1
	print(ans + 1)


t = int(input())
for i in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort(reverse=True)
	v = 0
	for j in range(len(l)):
		if l[j] > n - v:
			v += 1
	print(n + 1 - v)


for __ in range(int(input())):
	n = int(input())
	arr = [int(x) for x in input().split()]
	m1 = {}
	s = []
	for x in arr:
		if x in m1:
			m1[x] += 1
		else:
			m1[x] = 1
			s.append(x)
	s = sorted(s)
	ans = 0
	temp = 0
	for x in s:
		k = m1[x]
		temp += k
		if temp >= x:
			ans = temp
	ans += 1
	print(ans)


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	ans = 1
	for i in range(n):
		if a[i] <= i + 1:
			ans = i + 2
	print(ans)


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	res = 1
	l.sort()
	d = {}
	for i in l:
		try:
			d[i] += 1
		except:
			d[i] = 1
	x = l[:]
	x = list(set(x))
	c = 1
	dadhique = []
	quepool = 0
	for i in x:
		if d[i] + c > i:
			c += d[i]
		else:
			dadhique.append(i)
			quepool += d[i]
		if len(dadhique):
			if c + quepool > max(dadhique):
				dadhique = []
				c += quepool
				quepool = 0
	print(c)


tc = int(input())
for _ in range(tc):
	n = int(input())
	a = [int(f) for f in input().split()]
	a.sort()
	cnt = 1
	g = 1
	for i in range(n):
		if cnt + g - 1 < a[i]:
			g += 1
			continue
		cnt += g
		g = 1
	print(cnt)


def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		a = list(map(int, input().split()))
		a = list(enumerate(sorted(a), 1))
		a.reverse()
		i = 0
		ans = 0
		while i < len(a):
			(x, y) = a[i]
			if x < y:
				i += 1
			else:
				break
		else:
			ans = 1
		if ans == 1:
			print(ans)
		else:
			ans = a[i][0] + 1
			print(ans)
main()


for i in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	c = 1
	temp = 0
	for j in range(len(l)):
		if l[j] <= c:
			temp = j + 1
		c += 1
	print(temp + 1)


for i in range(int(input())):
	a = int(input())
	b = list(map(int, input().strip().split()))[:a]
	b.sort()
	d = 0
	for j in range(len(b)):
		if b[j] <= j + 1:
			d = j + 1
	print(d + 1)


t = int(input())
import math
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	aa = set(a)
	aa = [i for i in aa]
	d = {i: 0 for i in aa}
	k = 1
	for i in a:
		d[i] += 1
	for j in range(len(aa)):
		i = aa[j]
		if d[i] - 1 + k >= i:
			k += d[i]
		elif j < len(aa) - 1:
			d[aa[j + 1]] += d[aa[j]]
	print(k)


import sys
try:
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
except:
	pass
input = sys.stdin.readline
for tt in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	g = 1
	aux = 0
	for i in range(n):
		if l[i] <= g + aux:
			g += aux + 1
			aux = 0
		else:
			aux += 1
	print(g)


from sys import stdin, stdout
for case in range(int(stdin.readline())):
	n = int(stdin.readline())
	grannies = sorted([int(x) for x in stdin.readline().split()], reverse=True)
	total = len(grannies)
	for g in grannies:
		if total < g:
			total -= 1
	print(total + 1)


for _ in range(int(input())):
	n = int(input())
	ar = list(map(int, input().split()))
	ar.sort()
	count = 1
	i = 0
	while i < n:
		if count >= ar[i]:
			count += 1
		else:
			x = count
			while i < n:
				if x >= ar[i]:
					while i < n and x >= ar[i]:
						x += 1
						i += 1
					count = x
				x += 1
				i += 1
		i += 1
	print(count)


t = int(input())
for i in range(t):
	n = int(input())
	ls = [int(a) for a in input().split()]
	ls.sort()
	an = 1
	for j in range(n):
		if ls[j] <= j + 1:
			an = j + 2
	print(an)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	dic = {}
	for i in range(n):
		if a[i] not in dic:
			dic[a[i]] = 0
		dic[a[i]] += 1
	(ans, t) = (0, 0)
	for i in sorted(dic.keys()):
		if i <= ans + dic[i] + t:
			ans += dic[i] + t
			t = 0
		else:
			t += dic[i]
	print(ans + 1)


q = int(input())
for _ in range(q):
	n = int(input())
	a = sorted([int(i) for i in input().split()])
	res = 1
	for i in range(n):
		if a[i] <= i + 1:
			res = i + 2
	print(res)


for ttt in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	l.reverse()
	s = n
	for i in l:
		if i <= s:
			break
		else:
			s -= 1
	print(s + 1)


for iota in range(int(input())):
	n = int(input())
	granny = [int(x) for x in input().split()]
	answer = 1
	granny.sort()
	i = 0
	temp = 0
	while i < n:
		if granny[i] <= answer:
			answer += 1
			i += 1
		elif i < n - 1:
			temp += 1
			i += 1
			if granny[i] <= answer + temp:
				answer += temp
				temp = 0
		else:
			i += 1
	print(answer)


for i in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	z = 0
	for j in range(n):
		if a[n - 1 - j] <= n - j:
			print(n - j + 1)
			z = 1
			break
	if z == 0:
		print(1)


t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	arr = sorted(arr)
	for j in range(n - 1, -2, -1):
		if arr[j] <= j + 1:
			break
	print(j + 2)


kl = int(input())
for l in range(kl):
	n = int(input())
	a = [int(i) for i in input().split()]
	a.sort()
	pr = 0
	for i in range(n - 1, -1, -1):
		if a[i] <= i + 1:
			pr = 1
			break
	if pr:
		print(i + 2)
	else:
		print(1)


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

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

def solve():
	n = read_int()
	a = read_ints()
	a.sort()
	M = 1
	Q = 0
	for i in range(n):
		Q += 1
		if a[i] <= M + (Q - 1):
			M += Q
			Q = 0
	return M
T = read_int()
for _ in range(T):
	print(solve())


for i in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	c = 1
	c1 = 0
	f = 0
	for i in range(n):
		if l[i] <= c + c1:
			c += c1 + 1
			f = 0
			c1 = 0
		elif f == 1:
			c1 += 1
		else:
			c1 = 1
			f = 1
	print(c)


import math
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	c = 1
	i = 0
	while i < n:
		if a[i] <= i + 1:
			c = i + 2
		i += 1
	print(c)


import sys
input = sys.stdin.readline
import heapq
import copy
import math

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

class Node:

	def _init_(self, val):
		self.data = val
		self.left = None
		self.right = None

class fen_tree:

	def __init__(self, list):
		self.array = [0] + list
		for idx in range(1, len(self.array)):
			idx2 = idx + (idx & -idx)
			if idx2 < len(self.array):
				self.array[idx2] += self.array[idx]

	def prefix_query(self, idx):
		result = 0
		while idx:
			result += self.array[idx]
			idx -= idx & -idx
		return result

	def prints(self):
		print(self.array)
		return

	def range_query(self, from_idx, to_idx):
		return self.prefix_query(to_idx) - self.prefix_query(from_idx - 1)

	def update(self, idx, add):
		while idx < len(self.array):
			self.array[idx] += add
			idx += idx & -idx

def pre_sum(arr):
	p = [0]
	for i in arr:
		p.append(p[-1] + i)
	p.pop(0)
	return p

def pre_back(arr):
	p = [0]
	for i in arr:
		p.append(p[-1] + i)
	p.pop(0)
	return p

def bin_search(arr, l, r, val):
	if arr[r] <= val:
		return r + 1
	if r - l < 2:
		if arr[l] > val:
			return l
		else:
			return r
	mid = int((l + r) / 2)
	if arr[mid] <= val:
		return bin_search(arr, mid, r, val)
	else:
		return bin_search(arr, l, mid, val)

def search_leftmost(arr, val):

	def helper(arr, l, r, val):
		print(l, r)
		if arr[l] == val:
			return l
		if r - l <= 1:
			if arr[r] == val:
				return r
			else:
				print('not found')
				return
		mid = int((r + l) / 2)
		if arr[mid] >= val:
			return helper(arr, l, mid, val)
		else:
			return helper(arr, mid, r, val)
	return helper(arr, 0, len(arr) - 1, val)

def search_rightmost(arr, val):

	def helper(arr, l, r, val):
		print(l, r)
		if arr[r] == val:
			return r
		if r - l <= 1:
			if arr[l] == val:
				return r
			else:
				print('not found')
				return
		mid = int((r + l) / 2)
		if arr[mid] > val:
			return helper(arr, l, mid, val)
		else:
			return helper(arr, mid, r, val)
	return helper(arr, 0, len(arr) - 1, val)

def preorder_postorder(root, paths, parent, left, level):
	l = 0
	queue = [root]
	while queue != []:
		node = queue[-1]
		flag = 0
		for i in paths[node]:
			if i != parent[node] and level[i] == sys.maxsize:
				parent[i] = node
				level[i] = level[node] + 1
				flag = 1
				queue.append(i)
		if flag == 0:
			left[parent[node]] += 1 + left[node]
			queue.pop()
	return [parent, left, level]

def pr_list(a):
	print(*a, sep=' ')

def main():
	tests = inp()
	mod = 1000000007
	limit = 10 ** 18
	for test in range(tests):
		n = inp()
		a = inlt()
		a.sort()
		curr = 1
		comming = 0
		itr = 0
		while itr < n:
			while itr < n:
				if a[itr] <= curr + comming:
					curr = curr + comming + 1
					comming = 0
					itr = itr + 1
					break
				else:
					itr = itr + 1
					comming = comming + 1
		print(curr)
main()


for i in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	inside = 1
	l = 0
	r = l
	a.sort()
	while l < n:
		if inside >= a[l]:
			inside += 1
		else:
			tmp = inside
			high = a[r]
			while r < n and tmp <= high:
				high = max(high, a[r])
				r += 1
				tmp += 1
			if tmp > high:
				inside = tmp
				l = r - 1
			else:
				l = r - 1
		l += 1
		r = l
	print(inside)


tc = int(input())
for _ in range(tc):
	n = int(input())
	arr1 = list(map(int, input().split()))
	arr = [0]
	arr.extend(arr1)
	arr.sort()
	cnt = [j for j in range(1, n + 2)]
	ans = 1
	for i in range(len(arr) - 1, 0, -1):
		if arr[i] <= cnt[i - 1]:
			ans = max(ans, cnt[i - 1] + 1)
	print(ans)


t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	c = 1
	k = 1
	for i in range(n):
		if l[i] <= c:
			k = k + 1
			c = c + 1
		elif l[i] <= i + 1:
			k = i + 2
	print(k)


import sys
import math
import collections
from sys import stdin, stdout, setrecursionlimit
import bisect as bs
setrecursionlimit(2 ** 20)
M = 10 ** 9 + 7

def solve():
	n = int(stdin.readline())
	a = list(map(int, stdin.readline().split()))
	a.sort()
	b = []
	i = 0
	while i < n:
		j = i
		while j < n and a[j] == a[i]:
			j += 1
		x = j - i
		b.append([a[i], x])
		i = j
	ans = 0
	inside = 1
	i = 0
	sz = len(b)
	while i < sz:
		j = i
		loc = b[j][1]
		req = b[j][0]
		while j + 1 < sz and loc + inside - 1 < req:
			j += 1
			loc += b[j][1]
			req = b[j][0]
		if loc + inside - 1 >= req:
			ans += loc
			inside += loc
		i = j + 1
	print(ans + 1)
t = 1
t = int(stdin.readline())
for _ in range(t):
	solve()


from collections import defaultdict

def solve():
	n = int(input())
	d = defaultdict(int)
	for x in input().split():
		d[int(x)] += 1
	ans = 1
	for k in d:
		ans += d[k]
	for k in sorted(d, reverse=True):
		v = d[k]
		if ans - 1 < k:
			ans -= v
		else:
			break
	print(ans)
t = int(input())
for _ in range(t):
	solve()


t = int(input())
for _ in range(t):
	m = int(input())
	a = list(map(int, input().split(' ')))
	a.sort()
	res = 1
	for i in range(1, m + 1):
		if i >= a[i - 1]:
			res = i + 1
	print(res)


from math import sqrt
t = int(input())
for qq in range(t):
	n = int(input())
	L = [int(i) for i in input().split()]
	L.sort()
	s = 0
	for i in range(len(L)):
		if L[i] <= i + 1:
			s = i + 1
	print(s + 1)


t = int(input())
for _ in range(t):
	N = int(input())
	A = list(map(int, input().split()))
	A.sort()
	ans = 0
	for (i, a) in enumerate(A):
		if i + 1 >= a:
			ans = i + 1
	print(ans + 1)


for _ in range(int(input())):
	n = int(input())
	l = list(sorted(map(int, input().split())))
	ans = 0
	s = []
	for i in range(n):
		s.append(l[i])
		if s[-1] <= ans + len(s):
			ans += len(s)
			s = []
	print(ans + 1)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	sumx = 1
	temp = 1
	i = 0
	while i < n:
		if a[i] <= temp:
			i = i + 1
			temp += 1
			sumx = temp
		elif a[i] > temp:
			i = i + 1
			temp += 1
	print(sumx)


for _ in range(int(input())):
	n = int(input())
	l = [*map(int, input().split())]
	l.sort()
	cnt = 1
	total_grannies = 0
	for i in range(n):
		if l[i] <= i + 1:
			total_grannies = max(total_grannies, i + 1)
	print(total_grannies + 1)


def main(num, granny):
	granny = sorted(granny)
	for i in range(num, 0, -1):
		if granny[i - 1] <= i:
			return i + 1
	return 1
for i in range(int(input())):
	print(main(int(input()), map(int, input().split())))


from sys import stdin, stdout
int_in = lambda : int(stdin.readline())
arr_in = lambda : [int(x) for x in stdin.readline().split()]
mat_in = lambda rows: [arr_in() for y in range(rows)]
str_in = lambda : stdin.readline().strip()
out = lambda o: stdout.write('{}\n'.format(o))
arr_out = lambda o: out(' '.join(map(str, o)))
bool_out = lambda o: out('YES' if o else 'NO')
tests = lambda : range(1, int_in() + 1)
case_out = lambda i, o: out('Case #{}: {}'.format(i, o))

def solve(n, a):
	a.sort(reverse=True)
	need = n
	for (i, item) in enumerate(a):
		if item <= need:
			return n - i + 1
		need -= 1
	return 1
for i in tests():
	n = int_in()
	a = arr_in()
	out(solve(n, a))


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort(reverse=True)
	ii = n
	for i in range(n):
		if a[i] > ii:
			ii -= 1
		else:
			break
	print(ii + 1)


import sys
input = sys.stdin.buffer.readline

def main():
	t = int(input())
	ans = []
	for _ in range(t):
		_ = int(input())
		a = list(map(int, input().split()))
		a.sort()
		l = [i for (i, x) in enumerate(a) if i + 1 >= x]
		ans.append(1 if len(l) == 0 else l[-1] + 2)
	print('\n'.join(map(str, ans)))
main()


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	s = sorted(list(set(l)))
	d = {}
	for i in l:
		if i in d:
			d[i] += 1
		else:
			d[i] = 1
	c = 1
	i = 0
	while i < len(s):
		j = i
		x = c
		while j < len(s) and s[j] > x + d[s[j]] - 1:
			x += d[s[j]]
			j += 1
		if j < len(s):
			c = x + d[s[j]]
		i = j + 1
	print(c)


for z in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	count = 1
	stored = 0
	for i in range(n):
		if a[i] <= count + stored:
			count += stored + 1
			stored = 0
		else:
			stored += 1
	print(count)


def main():
	import sys
	input = sys.stdin.readline
	sys.setrecursionlimit(10 ** 6)
	t = int(input())
	for _ in range(t):
		n = int(input())
		an = sorted([int(x) for x in input().strip().split()])
		ind = -1
		for (i, a) in enumerate(an):
			if i + 1 >= a:
				ind = i
		print(ind + 2)
main()


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	n = int(input())
	w = sorted(map(int, input().split()))
	c = 0
	for i in range(n):
		if w[i] <= i + 1:
			if i + 1 > c:
				c = i + 1
	print(c + 1)


n = int(input())
l = []
for i in range(0, n):
	y = int(input())
	l = list(map(int, input().split()))
	l.sort()
	for j in range(0, y):
		if len(l) == 0:
			print('1')
		else:
			a = l[-1]
			b = len(l)
			if a <= b:
				c = b + 1
				print(str(c))
				break
			else:
				l.pop()
	else:
		print('1')


for _ in range(int(input())):
	n = int(input())
	a = [int(x) for x in input().split()]
	a.sort()
	ans = 1
	i = 0
	while i < n:
		if a[i] <= ans:
			ans += 1
			i += 1
		else:
			flag = 0
			x = ans
			x += 1
			for j in range(i + 1, n):
				if a[j] <= x:
					flag = 1
					ans = x + 1
					i = j
					break
				x += 1
			if flag == 1:
				i += 1
			else:
				i += n
	print(ans)


for _ in range(int(input())):
	n = int(input())
	in1 = [*map(int, input().split())]
	in1.sort()
	pos1 = 0
	for i in range(n):
		if in1[i] <= i + 1:
			pos1 = i + 1
	print(pos1 + 1)


t = int(input())
while t > 0:
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	count = 1
	temp = 0
	for i in range(n):
		if a[i] <= count:
			count += 1
		elif temp + count >= a[i]:
			count += temp + 1
			temp = 0
		else:
			temp += 1
	print(count)
	t -= 1


t = int(input())
for _ in range(t):
	n = int(input())
	a = [int(i) for i in input().strip().split()]
	a.sort(reverse=True)
	for (i, v) in enumerate(a):
		if n - i >= v:
			print(n - i + 1)
			break
	else:
		print(1)


t = int(input())
for i in range(t):
	n = int(input())
	ar = list(map(int, input().split(' ')))
	ar.sort()
	c = n - 1
	store = 0
	while c >= 0:
		if ar[c] > c + 1:
			c -= 1
		else:
			store = c + 1
			break
	print(1 + store)


def get_active_grandmothers_amount(grandmothers):
	active_amount = 1
	for (idx, required) in enumerate(sorted(grandmothers)):
		already_at_street = idx + 1
		if required <= already_at_street:
			active_amount = already_at_street + 1
	return active_amount
t = int(input())
for _ in range(t):
	n = int(input())
	grandmothers = map(int, input().split())
	print(get_active_grandmothers_amount(grandmothers))


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	(c, p, i) = (1, 0, 0)
	while i < n:
		if l[i] <= c:
			i += 1
			c += 1 + p
			p = 0
		else:
			cp = c
			while i < n:
				if l[i] > cp:
					cp += 1
					i += 1
				else:
					c = cp + 1
					i += 1
					break
	print(c)


t = int(input())
for i in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	a = 1
	b = 0
	c = 0
	j = 0
	while j < n:
		for k in range(j, len(l)):
			b = l[k]
			c = c + 1
			if a + c - 1 >= b:
				a = a + c
				j = k + c - 1
				c = 0
				break
		j = k + 1
	print(a)


import sys
import heapq
import random
import collections

def solve(lst):
	console('----- solving ------')
	lst = sorted(lst)
	res = 1
	for (i, x) in enumerate(lst, start=1):
		if i >= x:
			res = max(res, i + 1)
	return res

def console(*args):
	print('\x1b[36m', *args, '\x1b[0m', file=sys.stderr)
	return
for case_num in range(int(input())):
	_ = int(input())
	lst = list(map(int, input().split()))
	res = solve(lst)
	print(res)


for x in range(int(input())):
	n = int(input())
	a = sorted(map(int, input().split()))
	z = 0
	for i in range(len(a)):
		if a[i] <= i + 1:
			z = i + 1
	print(z + 1)


def main_function():
	from sys import stdin
	from sys import stdout
	input = stdin.readline
	print = stdout.write
	for _ in range(int(input())):
		n = int(input())
		a = list(map(int, input().split()))
		a.sort()
		possiblek = 1
		k = 0
		for i in range(n):
			if possiblek >= a[i]:
				k = possiblek
			possiblek += 1
		print(f'{k + 1}\n')
main_function()


import sys
input = sys.stdin.readline
t = int(input())
for i in range(t):
	n = int(input())
	b = list(map(int, input().split()))
	k = sorted(b)
	p = 1
	j = len(k) - 1
	while j >= 0:
		if k[j] <= j + 1:
			p = j + 2
			break
		else:
			pass
		j += -1
	print(p)


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	d = {}
	a.sort()
	s = set()
	for i in a:
		if i in d:
			d[i] += 1
		else:
			d[i] = 1
	c = 1
	t = 0
	i = 0
	while i < n:
		if d[a[i]] + c + t > a[i]:
			c += d[a[i]]
			if t != 0:
				c += t
				t = 0
		else:
			t += d[a[i]]
		i += d[a[i]]
	print(c)


t = int(input())
for _ in range(1, t + 1):
	n = int(input())
	b = list(map(int, input().split()))
	b.sort()
	j = n - 1
	while j >= 0:
		if b[j] > j + 1:
			j -= 1
		else:
			break
	print(j + 2)


tc = int(input())
for i in range(tc):
	total = int(input())
	order = [int(x) for x in input().split()]
	order = sorted(order)
	count = total
	for j in range(total - 1, -1, -1):
		if order[j] > total:
			count -= 1
		elif order[j] > count:
			count -= 1
		else:
			break
	print(count + 1)


test = int(input())
for i in range(0, test):
	dict_inp = {}
	length_inp = int(input())
	list_inp = list(input().strip(' ,').split(' '))
	list_inp = [int(key) for key in list_inp]
	for i in list_inp:
		if i in dict_inp.keys():
			dict_inp[i] = dict_inp[i] + 1
		else:
			dict_inp[i] = 1
	granny = 1
	temp = 1
	list_inp = [key for key in sorted(dict_inp.keys())]
	for i in list_inp:
		temp = temp + dict_inp[i]
		if int(i) < temp:
			granny = temp
	print(granny)


import sys
sys.setrecursionlimit(10000)

class Memoize:

	def __init__(self, f):
		self.f = f
		self.memo = {}

	def __call__(self, *args):
		if not args in self.memo:
			self.memo[args] = self.f(*args)
		return self.memo[args]

class Recurse(Exception):

	def __init__(self, *args, **kwargs):
		self.args = args
		self.kwargs = kwargs

def recurse(*args, **kwargs):
	raise Recurse(*args, **kwargs)

def tail_recursive(f):

	def decorated(*args, **kwargs):
		while True:
			try:
				return f(*args, **kwargs)
			except Recurse as r:
				args = r.args
				kwargs = r.kwargs
				continue
	return decorated
t = int(input())
for _ in range(t):
	n = int(input())
	a = map(int, input().split())
	a = sorted(a)
	ans = 1
	for i in range(n):
		if a[i] <= i + 1:
			ans = i + 2
	print(ans)


for _ in range(int(input())):
	n = int(input())
	seq = list(map(int, input().split()))
	seq.sort()
	count = 0
	for i in range(1, n + 1):
		if seq[i - 1] <= i:
			count = i
	print(count + 1)


def solution():
	n = int(input())
	a = sorted(list(map(lambda x: int(x), input().split())))
	for i in range(n - 1, -1, -1):
		if a[i] <= i + 1:
			print(i + 2)
			return
	print(1)
t = int(input())
for _ in range(t):
	solution()


t = int(input())
while t:
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	i = len(arr) - 1
	while i > -1 and arr[i] > i + 1:
		i -= 1
	print(i + 2)
	t -= 1


t = int(input())
cases = []
for i in range(t):
	n = int(input())
	case = [int(item) for item in input().split()]
	cases.append(case)
for case in cases:
	case.sort()
	m = len(case)
	g = 1
	q = []
	for a in case:
		if a <= g:
			g += 1
		else:
			d = a - g
			if len(q) >= d and len(q) != 0:
				g += 1 + len(q)
				q = []
			else:
				q.append(a)
	print(g)


for w in range(int(input())):
	n = int(input())
	a = sorted((int(x) for x in input().split()))
	b = [j + 1 >= a[j] for j in range(n)]
	for (x, y) in enumerate(reversed(b)):
		if y:
			print(n + 1 - x)
			break
	else:
		print(1)


for _ in range(int(input())):
	n = int(input())
	a = [int(i) for i in input().split()]
	a.sort()
	ans = 1
	for i in range(n):
		if a[i] <= i + 1:
			ans = i + 2
	print(ans)


import math
for ttt in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	c = 0
	i = n - 1
	while i >= 0:
		if i + 1 >= l[i]:
			c = 1
			break
		else:
			i -= 1
	if c == 1:
		print(i + 2)
	else:
		print(1)


test_case = int(input())
for _ in range(test_case):
	n = int(input())
	li = list(map(int, input().split()))
	li.sort()
	(cu, l) = (1, len(li))
	ans = 1
	maxi = 0
	for i in range(l):
		if li[i] < i + 2:
			ans = i + 2
	print(ans)


t = int(input())
while t:
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	i = n - 1
	while i >= 0:
		if a[i] > n:
			del a[i]
			i = i - 1
		elif a[i] > len(a):
			del a[i]
			i = i - 1
		else:
			break
	print(len(a) + 1)
	t = t - 1


import sys
import math as mt
import bisect
input = sys.stdin.buffer.readline
t = int(input())
for __ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	ans = 1
	ct = 0
	for i in range(n):
		if ans + ct >= l[i]:
			ans += ct
			ans += 1
			ct = 0
		else:
			ct += 1
	print(ans)


from bisect import bisect_left as bl
from bisect import bisect_right as br
from heapq import heappush, heappop
import math
from collections import *
from functools import reduce, cmp_to_key, lru_cache
import io, os
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
M = mod = 10 ** 9 + 7

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().split()]

def st():
	return str(input().rstrip())[2:-1]

def val():
	return int(input().rstrip())

def li2():
	return [str(i)[2:-1] for i in input().rstrip().split()]

def li3():
	return [int(i) for i in st()]
for _ in range(val()):
	n = val()
	l = sorted(li())
	curr = 1
	for i in range(n):
		if i + 1 >= l[i]:
			curr = i + 2
	print(curr)


n = int(input())
for _ in range(n):
	m = int(input())
	a = list(map(int, input().split()))
	a.sort()
	cnt = m
	for i in range(m - 1, -1, -1):
		if a[i] > i + 1:
			cnt -= 1
		else:
			break
	print(cnt + 1)


for ij in range(0, int(input())):
	n = int(input())
	l = list(map(int, input().split(' ')))
	l.sort()
	o = 0
	for i in range(len(l) - 1, -1, -1):
		if l[i] <= i + 1:
			o = -1
			print(i + 2)
			break
	if o == 0:
		print(1)


t = int(input())
for _ in range(t):
	n = int(input())
	l = [int(x) for x in input().split()]
	l.sort()
	best = 1
	for (i, x) in enumerate(l):
		if x <= i + 1:
			best = i + 2
	print(best)


t = int(input())
while t:
	t -= 1
	try:
		n = int(input())
		a = list(map(int, input().split()))
		a.sort()
		ans = total = 1
		prev = 0
		for (i, x) in enumerate(a):
			if x <= total:
				if prev != None:
					ans += i - prev + 1
				else:
					ans += 1
				total += 1
				prev = None
			else:
				total += 1
				if prev == None:
					prev = i
		print(ans)
	except Exception as e:
		print(str(e))


from collections import Counter
for _ in range(int(input())):
	n = map(int, input().split())
	l = list(map(int, input().split()))
	cnt = dict(Counter(l))
	sm = 1
	buff = 0
	for (k, v) in sorted(cnt.items()):
		if k <= sm + buff + v - 1:
			sm = sm + buff + v
			buff = 0
		else:
			buff += v
	print(sm)


(t, n) = (int(input()), [])
(a, k) = ([None for i in range(t)], [1] * t)
for i in range(t):
	n.append(int(input()))
	a[i] = sorted(list(map(int, input().split())))
	for j in range(n[i] - 1, -1, -1):
		if a[i][j] <= j + 1:
			k[i] += j + 1
			break
print(*k, sep='\n')


import math

def dict_sort(ans):
	ans = sorted(ans.items(), reverse=True, key=lambda kv: kv[1])

def is_prime(n, k):
	if n == 1:
		return 0
	for i in range(2, int(math.sqrt(n)) + 1):
		if n % i == 0:
			res = i
			break
	return res

def inp():
	ls = list(map(int, input().split()))
	return ls
t = int(input())
for ii in range(t):
	n = int(input())
	ls = inp()
	ls.sort()
	sum = 1
	presum = 1
	for i in range(n - 1, -1, -1):
		if ls[i] > 1 + i:
			continue
		else:
			sum = i + 2
			break
	print(sum)


for _ in range(int(input())):
	n = int(input())
	res = 1
	gr = [0] + [*map(int, input().split())]
	gr.sort()
	for i in range(n, 0, -1):
		if gr[i] <= n and gr[i] <= i:
			res = i + 1
			break
	print(res)


from collections import *
from bisect import *
from math import *
from heapq import *
import sys
input = sys.stdin.readline
t = int(input())
while t:
	t -= 1
	n = int(input())
	a = list(map(int, input().split()))
	a.sort(reverse=True)
	s = 0
	for i in range(n):
		if a[i] <= n - i:
			s = n - i
			break
	print(s + 1)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	k = 1
	i = 0
	for i in range(n):
		if a[i] <= i + 1:
			k = i + 2
	print(k)


t = int(input())
for i in range(t):
	n = int(input())
	ar = list(map(int, input().split()))
	ar.sort()
	total = n
	for i in range(n - 1, -1, -1):
		if ar[i] > total:
			total -= 1
	print(total + 1)


t = int(input())
while t != 0:
	t -= 1
	n = int(input())
	lt = [int(x) for x in input().split()]
	lt.sort()
	tot = [i for i in range(1, n + 1)]
	ans = 0
	i = 0
	while i < n:
		if lt[i] > n:
			break
		elif lt[i] <= tot[i]:
			i += 1
			ans += 1
		else:
			j = i
			while j < n and lt[j] > tot[j]:
				j += 1
			if j == n:
				break
			ans += j - i + 1
			i = j + 1
	print(ans + 1)


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	cnt = 1
	l.sort()
	f = 0
	for i in l:
		if f == 0:
			m = cnt
			f = 1
		if m >= i:
			cnt = m + 1
			f = 0
		else:
			m = m + 1
	print(cnt)


import math, sys, bisect
from collections import defaultdict, Counter, deque

def input():
	return sys.stdin.readline().strip()
ilele = lambda : map(int, input().split())
alele = lambda : list(map(int, input().split()))

def Y(c):
	print(['NO', 'YES'][c])

def y(c):
	print(['no', 'yes'][c])
for _ in range(int(input())):
	N = int(input())
	A = alele()
	A.sort()
	Ans = 1
	for i in range(len(A) - 1, -1, -1):
		if i + 1 >= A[i]:
			Ans += i + 1
			break
	print(Ans)


from collections import Counter
from queue import PriorityQueue
for _ in range(int(input())):
	size = int(input())
	q = PriorityQueue()
	for (chave, valor) in Counter(map(int, input().split())).items():
		if chave <= size:
			q.put((chave, valor))
	atual = 0
	acc = 0
	while not q.empty():
		(min2go, qtd) = q.get()
		if atual >= min2go:
			acc = 0
			atual += qtd
		else:
			acc += qtd
			if atual + acc >= min2go:
				atual += acc
				acc = 0
	print(atual + 1)


t = int(input())
ar = []
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	present = 1
	max_promised = 0
	count = 0
	for i in range(n):
		count += 1
		if max_promised < a[i]:
			max_promised = a[i]
		if present + count > max_promised:
			present += count
			max_promised = 0
			count = 0
	ar.append(str(present))
print('\n'.join(ar))


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	flag = 0
	a.sort()
	for i in range(n - 1, -1, -1):
		if a[i] <= i + 1:
			flag = 1
			print(i + 2)
			break
	if flag == 0:
		print(1)


def solve():
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	while n:
		if a[n - 1] <= n:
			break
		n = n - 1
	print(n + 1)
T = int(input())
while T:
	solve()
	T = T - 1


from sys import stdin, stdout
import math
from collections import Counter, deque
L = lambda : 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))))
for i in range(I()):
	n = I()
	c = 1
	a = L()
	d = Counter(a)
	k = 1
	a = sorted(a)
	for i in range(n):
		if a[i] <= k:
			k += 1
			c = k
		else:
			k += 1
	print(c)


t = int(input())
for case in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	d = {}
	for item in a:
		if d.get(item):
			d[item] += 1
		else:
			d[item] = 1
	keys = list(d.keys())
	keys.sort()
	(s, new_s) = (0, 0)
	for key in keys:
		new_s += d[key]
		if key <= new_s:
			s = new_s
	print(1 + s)


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	a = a[::-1]
	num = n
	for j in a:
		if j > num:
			num -= 1
		else:
			break
	print(num + 1)


for I in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	result = 0
	for i in range(n - 1, -1, -1):
		if i + 1 >= a[i]:
			result += i + 1
			break
	print(result + 1)


from sys import stdin
input = stdin.readline
for _ in range(int(input())):
	n = int(input())
	a = [int(x) for x in input().split()]
	a.sort()
	for x in a[::-1]:
		if x <= n:
			break
		else:
			n -= 1
	print(n + 1)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split(' ', n - 1)))
	g = 0
	ans = 1
	c = 0
	a.sort(reverse=True)
	b = a[:]
	for i in a:
		if i > n - c:
			b.remove(i)
			c += 1
	print(len(b) + 1)


t = int(input())
while t:
	t = t - 1
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	d = dict()
	for i in a:
		d[i] = d.get(i, 0) + 1
	out = 1
	cnt = 1
	for k in d.keys():
		cnt += d[k]
		if cnt - 1 >= k:
			out = cnt
	print(out)


for _ in range(int(input())):
	n = int(input())
	data = sorted(map(int, input().split()))[::-1]
	result = 0
	for (index, v) in enumerate(data):
		if v <= n - index:
			result = n - index
			break
	print(result + 1)


t = int(input())
m = []
for i in range(t):
	n = int(input())
	p = input()
	arr = sorted(list(map(int, p.split())))
	while n != 0:
		if arr[n - 1] <= n:
			m.append(n + 1)
			break
		n = n - 1
	if n == 0:
		m.append(1)
for i in m:
	print(i)


t = int(input())
while t:
	n = int(input())
	a = [int(x) for x in input().split()]
	a.sort()
	idx = n - 1
	while idx >= 0 and idx + 1 < a[idx]:
		idx -= 1
	print(idx + 2)
	t -= 1


t = input()
t = int(t)
while t > 0:
	n = int(input())
	a = list(map(int, input().strip().split()))[:n]
	a.sort()
	cnt = 0
	for (idx, val) in enumerate(a):
		if idx + 1 >= val:
			cnt = idx + 1
	print(cnt + 1)
	t -= 1


t = int(input())
for _ in range(t):
	n = int(input())
	a = [int(i) for i in input().split(' ')]
	a.sort()
	ok = False
	for i in range(n - 1, -1, -1):
		if a[i] <= i + 1:
			print(i + 2)
			ok = True
			break
	if not ok:
		print(1)


import math
q = int(input())
while q:
	n = int(input())
	arr = [int(i) for i in input().split()]
	d = {}
	arrived = 1
	for k in arr:
		if k in d:
			d[k] += 1
		else:
			d[k] = 1
	times = d.keys()
	times = sorted(times)
	count = [d[i] for i in times]
	it = 0
	while it < len(times):
		if times[it] <= arrived + count[it] - 1:
			arrived += count[it]
			it += 1
		else:
			j = it
			rs = 0
			while j < len(times) and rs + count[j] + arrived - 1 < times[j]:
				rs += count[j]
				j += 1
			if j == len(times):
				break
			arrived += rs + count[j]
			rs = 0
			it = j + 1
	print(arrived)
	q -= 1


t = int(input())
k = []
for i in range(t):
	n = int(input())
	a = sorted(list(map(int, input().split())))
	for j in range(len(a) - 1, -1, -1):
		if j + 2 > a[j]:
			k.append(j + 2)
			break
	else:
		k.append(1)
print(*k, sep='\n')


T = int(input())
import math
while T:
	T -= 1
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	t = 1
	c = 0
	for i in range(n):
		if a[i] <= t + c:
			t = t + 1 + c
			c = 0
		else:
			c += 1
	print(t)


import sys
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()
	arr.sort()
	currmax = 0
	ans = 0
	for i in range(n):
		currmax = max(arr[i], currmax)
		if currmax <= i + 1:
			ans = i + 1
	print(ans + 1)


for t in range(int(input())):
	n = int(input())
	lst = list(map(int, input().split()))
	lst.sort()
	num = 1
	ans = 1
	for i in lst:
		num += 1
		if num > i:
			ans = num
	print(ans)


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	d = 0
	a.sort()
	for i in range(1, n + 1):
		if a[i - 1] > i:
			continue
		else:
			d = i
	print(d + 1)


import sys
agGK = int(input())
for _ in range(agGK):
	n = int(input())
	a = [int(i) for i in input().split(' ', n - 1)]
	k = 1
	max = 0
	a.sort()
	for i in range(n):
		if a[i] <= n - (n - i) + 1:
			max = i + 1
	print(max + 1)


import math
for i in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	max1 = 0
	count = n
	for i in range(len(l) - 1, -1, -1):
		if l[i] <= count:
			max1 = count
			break
		count = count - 1
	print(max1 + 1)


import sys
Ri = lambda : [int(x) for x in sys.stdin.readline().split()]
ri = lambda : sys.stdin.readline().strip()

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 ** 18
MOD = 10 ** 9 + 7
for _ in range(int(ri())):
	n = int(ri())
	a = Ri()
	a.sort()
	dic = {}
	for i in a:
		if i in dic:
			dic[i] += 1
		else:
			dic[i] = 1
	cur = 1
	tempcur = 0
	arr = [i for i in dic]
	pre = [0] * len(dic)
	pre[0] = dic[arr[0]]
	for i in range(1, len(dic)):
		pre[i] = pre[i - 1] + dic[arr[i]]
	ans = 0
	for i in range(len(dic) - 1, -1, -1):
		if pre[i] >= arr[i]:
			ans = pre[i]
			break
	print(ans + 1)


t = int(input())
s = ''
while t != 0:
	ans = 1
	N = int(input())
	li = input().split()
	li = [int(num) for num in li]
	li.sort()
	for i in range(1, N + 1):
		if int(li[-i]) <= N - i + 1:
			ans = N - i + 2
			break
	s = s + str(ans) + '\n'
	t -= 1
print(s.rstrip('\n'))


from __future__ import division, print_function
import os
import sys
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip
import math

def solve(t):
	n = int(input().strip())
	data = list(map(int, input().strip().split()))
	data.sort()
	i = len(data) - 1
	while i >= 0:
		k = data[i]
		if k <= i + 1:
			break
		i -= 1
	return i + 2

def main():
	tc = int(input().strip())
	for t in range(1, tc + 1):
		print(solve(t))
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))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


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]

def main():
	for _ in range(II()):
		n = II()
		aa = LI()
		aa.sort()
		for i in range(n - 1, -1, -1):
			if aa[i] <= i + 1:
				print(i + 2)
				break
		else:
			print(1)
main()


def main():
	from collections import Counter
	for __ in [0] * int(input()):
		N = int(input())
		(*A,) = map(int, input().split())
		A.sort()
		ans = 1
		for (i, a) in enumerate(A):
			if i + 1 >= a:
				ans = i + 2
		print(ans)
main()


for _ in range(int(input())):
	n = int(input())
	a = [int(x) for x in input().split()]
	total = 1
	dict_a = {}
	for x in a:
		value = dict_a.get(x, 0)
		dict_a[x] = value + 1
	end = set()
	tmp = set()
	for x in sorted(list(set(a))):
		if total + dict_a[x] > x:
			end.add(x)
			end |= tmp
			tmp = set()
		else:
			tmp.add(x)
		total += dict_a[x]
	total = 1
	for x in end:
		total += dict_a[x]
	print(total)


import bisect
import sys
input = sys.stdin.readline
from collections import defaultdict

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(case):
	n = inp()
	aa = inlt()
	aa.sort()
	res = 0
	for (i, a) in enumerate(aa):
		if a <= i + 1:
			res = i + 1
	return res + 1
T = inp()
for i in range(T):
	res = solve(i + 1)
	print(str(res))


t = int(input())
r = []

def init(a):
	for l in range(len(a)):
		a[l] = int(a[l])
	return a
for i in range(t):
	n = int(input())
	g = input().split()
	g = init(g)
	g = sorted(g, reverse=True)
	cnt = len(g)
	for j in range(n):
		if g[j] > cnt:
			cnt = cnt - 1
		elif g[j] <= cnt:
			break
	r.append(cnt + 1)
for k in range(t):
	print(r[k])


def solve():
	n = int(input())
	a = sorted(map(int, input().split()))
	i = n - 1
	while i >= 0 and a[i] > i + 1:
		i -= 1
	print(i + 2)
for i in range(int(input())):
	solve()


T = int(input())
for t in range(T):
	N = int(input())
	A = [int(_) for _ in input().split()]
	A = sorted(A)
	last = 0
	for i in range(N):
		if A[i] <= i + 1:
			last = i + 1
	print(last + 1)


def solve(n, ss):
	inp_arr_unsorted = [int(k) for k in ss.split(' ')]
	inp_arr = sorted(inp_arr_unsorted)[::-1]
	flag = False
	counter = 0
	n_fix = n
	candidate_ans = 0
	while not flag:
		if inp_arr[counter] <= n:
			flag = True
			candidate_ans = n
		else:
			counter += 1
			n -= 1
			flag = counter == n_fix
	candidate_ans += 1
	return candidate_ans
t = int(input())
for ___ in range(t):
	n = int(input())
	if n == 1:
		if int(input()) == 1:
			answer = 2
		else:
			answer = 1
	else:
		inp_str = input()
		answer = solve(n, inp_str)
	print(answer)


for f in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	mx = 1
	for i in range(n):
		if a[i] <= i + 1:
			mx = i + 2
	print(mx)


import sys
from sys import stdin, stdout

def R():
	return map(int, stdin.readline().strip().split())
anss = []
for h in range(int(stdin.readline())):
	n = int(stdin.readline())
	arr = list(R())
	arr.sort()
	ans = 1
	for i in range(n):
		if arr[i] <= i + 1:
			ans = i + 2
	anss.append(str(ans))
stdout.write('\n'.join(anss))


t = int(input())
for _ in range(t):
	input()
	a = list(map(int, input().split()))
	a = sorted(a)
	ans = 0
	for (i, x) in enumerate(a):
		if i + 1 >= x:
			ans = i + 1
	print(ans + 1)


def solve():
	n = int(input())
	l = [int(x) for x in input().split()]
	l.append(0)
	l.sort()
	(ans, c) = (1, 0)
	d = {}
	for i in range(1, n + 1):
		if l[i] <= i:
			ans += i - c
			c = i
	print(ans)
for _ in range(int(input())):
	solve()


text = [*open(0)]
for s in text[2::2]:
	flag = 1
	l = sorted(map(int, s.strip().split()), reverse=True)
	for i in range(len(l)):
		if len(l) - i >= l[i]:
			flag = 0
			print(len(l) - i + 1)
			break
	if flag:
		print(1)


import sys

def solve():
	return None

def main():
	q = []
	for line in sys.stdin.readlines():
		q.append(line)
	for i in range(len(q)):
		q[i] = q[i].rstrip().split(' ')
		q[i] = [int(x) for x in q[i]]
	for i in range(1, len(q), 2):
		a = q[i + 1]
		total = 1
		h = {}
		for i in a:
			if i not in h:
				h[i] = 1
			else:
				h[i] += 1
		key_l = []
		for key in h.keys():
			key_l.append(key)
		key_l.sort(reverse=True)
		total += sum(h.values())
		for i in key_l:
			if total > i:
				break
			else:
				total -= h[i]
		print(total)
main()


import sys, math
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	cnt = n
	for i in range(n - 1, -1, -1):
		if l[i] > cnt:
			cnt -= 1
		else:
			break
	print(cnt + 1)


t = int(input())
for i in range(t):
	n = int(input())
	d = dict()
	l = list(map(int, input().split()))
	l.sort()
	for j in range(n):
		if l[j] in d.keys():
			d[l[j]] += 1
		else:
			d[l[j]] = 1
	val = 1
	buff = 1
	for j in d.keys():
		buff += d[j]
		if buff - 1 >= j:
			val = buff
		elif val + d[j] - 1 >= j:
			val += d[j]
	print(val)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort(reverse=True)
	ans = 0
	x = n
	for i in range(n):
		if x >= a[i]:
			break
		else:
			x -= 1
	ans = x + 1
	print(ans)


def main():
	for _ in range(int(input())):
		n = int(input())
		lst = list(map(int, input().split()))
		lst = sorted(lst)
		i = len(lst)
		while i > 0:
			if lst[i - 1] <= i:
				break
			else:
				i -= 1
		print(i + 1)
main()


t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	sum = 0
	i = n - 1
	while i >= 0:
		if a[i] <= i + 1:
			sum = i + 1
			break
		else:
			i -= 1
	print(sum + 1)


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	arr = sorted(arr)
	cnt = 0
	ans = 0
	for i in range(n):
		cnt += 1
		if arr[i] <= cnt:
			ans = i + 1
	print(ans + 1)


from sys import stdin, stderr

def rl():
	return [int(w) for w in stdin.readline().split()]
(t,) = rl()
for _ in range(t):
	(n,) = rl()
	a = rl()
	a.sort()
	print(1 + max([i + 1 for (i, x) in enumerate(a) if x <= i + 1] + [0]))


t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	ans = 0
	for i in range(0, n):
		if l[i] <= i + 1:
			ans = i + 1
	print(ans + 1)


testcases = int(input())
import math
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)
	cur = 1
	ans = 1
	for i in arr:
		if cur >= i:
			cur += 1
			ans = cur
		else:
			cur += 1
	print(ans)


import math
t = int(input())
for g in range(0, t):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort(reverse=True)
	i = 0
	breaks = 0
	while i < n:
		if a[i] <= n - i:
			print(n - i + 1)
			breaks = 1
			break
		i = i + 1
	if breaks == 0:
		print(1)


import sys
input = sys.stdin.buffer.readline

def solution():
	for _ in range(int(input())):
		n = int(input())
		l = list(map(int, input().split()))
		l.sort()
		i = 0
		j = 0
		ans = 1
		while i < n:
			if ans + i - j >= l[i]:
				ans += i - j + 1
				j = i + 1
			i += 1
		print(ans)
solution()


def modinv(n, p):
	return pow(n, p - 2, p)

def srt(element):
	return [element[0], -1 * element[1]]

def main():
	for case in range(int(input())):
		n = int(input())
		grannies = [int(x) for x in input().split()]
		grannies.sort()
		ans = 1
		i = 2
		for g in grannies:
			if g < i:
				ans = i
			i += 1
		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()


t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	i = 0
	curr = 1
	call = 1
	d = 1
	while i < len(arr):
		if curr >= arr[i]:
			call += d
			curr += 1
			i += 1
			d = 1
		else:
			d += 1
			curr += 1
			i += 1
	print(call)


t = int(input())
for _ in range(t):
	n = int(input())
	m = 1
	l = sorted(map(int, input().split()))
	for i in range(n - 1, -1, -1):
		if l[i] <= i + 1:
			m = m + (i + 1)
			break
	print(m)


import sys
input = lambda : sys.stdin.readline().strip('/r/n')
for _ in range(int(input())):
	n = int(input())
	a = sorted(list(map(int, input().split())))
	for i in range(n - 1, -1, -1):
		if a[i] <= i + 1:
			print(i + 2)
			break
	else:
		print(1)


import math
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	pos = -1
	for i in range(n):
		if a[i] <= i + 1:
			pos = i + 1
	if pos > 0:
		print(1 + pos)
	else:
		print(1)


t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	cnt = 0
	cnt1 = 1
	for i in range(n):
		if arr[i] <= i + 1:
			if cnt1 == 0:
				cnt += 1
			else:
				cnt += cnt1
				cnt1 = 1
		else:
			cnt1 += 1
	print(cnt + 1)


ll = lambda : list(map(int, input().split()))
s = lambda : input()
v = lambda : map(int, input().split())
ii = lambda : int(input())
for _ in range(int(input())):
	x = ii()
	l = ll()
	l.sort()
	s = 0
	for i in range(x):
		if i + 1 >= l[i]:
			s = i + 1
	print(s + 1)


from sys import stdin

def ler():
	for line in stdin:
		yield line

def solve(s):
	n = int(next(s))
	lista = [int(x) for x in next(s).split(' ')]
	lista.sort()
	res = 1
	i = 0
	temp = 0
	while True:
		temp = 0
		if lista[i] <= res:
			res += 1
			i += 1
			if i == n:
				return res
			continue
		while lista[i] > res + temp:
			temp += 1
			i += 1
			if i == n:
				return res
		res += temp
s = ler()
for i in range(int(next(s))):
	print(solve(s))


class A:

	def solve(self):
		t = int(input())
		for c in range(t):
			[n, m] = [int(x) for x in input().split(' ')]
			total_lights = n // 2 * m
			if n % 2 == 1:
				total_lights += m // 2
				if m % 2 == 1:
					total_lights += 1
			print(total_lights)

class B:

	def solve(self):
		t = int(input())
		for c in range(t):
			n = int(input())
			nums = [int(x) for x in input().split(' ')]
			nums = sorted(nums)
			grannies = 1
			current_grannies = 1
			max_requirement = 1
			for (i, g) in enumerate(nums):
				if i != 0:
					current_grannies += 1
				max_requirement = max(max_requirement, g)
				if current_grannies >= max_requirement:
					grannies = current_grannies + 1
			print(grannies)
B().solve()


from math import *
t = int(input())
for _ in range(t):
	c = 1
	f = 0
	n = int(input())
	x = list(map(int, input().split()))
	x.sort()
	for i in range(n):
		if i + 1 >= x[i]:
			c = max(c, i + 1)
			f = 1
	if f == 0:
		print(1)
	else:
		print(c + 1)


def max_grannies(n, G):
	l = sorted(G)
	c = 1
	for i in range(n - 1, -1, -1):
		if l[i] <= i + 1:
			c = i + 2
			break
	return c
t = int(input())
for i in range(t):
	n = int(input())
	G = list(map(int, input().split()))
	print(max_grannies(n, G))


t = int(input())
for k in range(t):
	n = int(input())
	arr = list(map(int, input().rstrip().split()))
	count = 1
	arr.sort()
	gr = 0
	for i in range(n):
		if i + 1 >= arr[i]:
			gr = i + 1
	print(gr + 1)


from copy import deepcopy
amount = int(input())
lst = []
results = []
while amount != 0:
	n = int(input())
	grandmothers = [int(i) for i in input().split()]
	lst.append(grandmothers)
	amount -= 1
for i in lst:
	i.sort()
	i = i[::-1]
	for k in deepcopy(i):
		if k <= len(i):
			results.append(len(i) + 1)
			break
		else:
			i.remove(k)
		if len(i) == 0:
			results.append(1)
for i in results:
	print(i)


from sys import stdin, stdout, setrecursionlimit
input = stdin.readline
for _ in range(int(input())):
	n = int(input())
	a = sorted([int(i) for i in input().split()])
	cur = 1
	cou = 0
	for i in range(n):
		if a[i] <= cur + cou:
			cur += cou + 1
			cou = 0
		else:
			cou += 1
	print(cur)


t = int(input())
for q in range(t):
	n = int(input())
	ch = input()
	L = [0] + [int(i) for i in ch.split()]
	L.sort()
	nb = 0
	L2 = []
	for i in range(n + 1):
		if L[i] <= i:
			L2.append(i)
	print(max(L2) + 1)


for _ in range(int(input())):
	n = int(input())
	a_sorted = sorted(map(int, input().split()))
	max_grannies = 1
	current_grannies = 1
	grannies_required = 0
	for g in a_sorted:
		grannies_required = max(grannies_required - 1, max(g - current_grannies, 0))
		if grannies_required == 0:
			max_grannies = current_grannies + 1
		current_grannies += 1
	print(max_grannies)


from sys import stdin
from collections import deque
mod = 10 ** 9 + 7
import sys
import random
from queue import PriorityQueue
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()))
	l.sort()
	i = 0
	init = 1
	while i < n:
		cont = 0
		j = i
		if l[i] > cont + init:
			while l[i] > cont + init:
				cont += 1
				i += 1
				if i == n:
					break
			if i == n:
				if l[i - 1] <= cont + init - 1:
					init += cont
				break
			temp = cont
			while l[i] <= cont + init:
				cont += 1
				i += 1
				if i == n:
					break
			if j == i:
				i += 1
			if temp != cont:
				init += cont
		else:
			while l[i] <= cont + init:
				cont += 1
				i += 1
				if i == n:
					break
			if j == i:
				i += 1
			init += cont
	print(init)


for _ in range(int(input())):
	n = int(input())
	a = sorted(list(map(int, input().split())))
	inparty = 1
	pointer = -1
	for i in range(n):
		if a[i] <= i + 1:
			inparty += i - pointer
			pointer = i
	print(inparty)


test = int(input())
for i in range(test):
	n = int(input())
	arr = [int(i) for i in input().split()]
	arr.sort()
	dp = [0] * n
	ans = 1
	last = 0
	for i in range(n):
		if ans + i >= arr[i]:
			dp[i] = 1
			last = i + 1
	print(ans + last)


def solve():
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	k = n - 1
	while k >= 0 and a[k] > k + 1:
		k -= 1
	print(k + 2)
t = int(input())
for _ in range(t):
	solve()


cases = int(input())
for i in range(cases):
	g = int(input())
	a = [int(p) for p in input().split()]
	a.sort()
	good = 1
	for j in range(g):
		if a[j] <= j + 1:
			good = j + 2
	print(good)


from collections import Counter
from functools import lru_cache
from typing import List
t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	cntr = Counter(l)
	ctr = [(i, occ) for (i, occ) in cntr.items()]
	ctr.sort()
	count = 1
	v = 0
	while v < len(ctr):
		(i, occ) = ctr[v]
		while count + occ - 1 < i and v < len(ctr) - 1:
			v = v + 1
			i = ctr[v][0]
			occ += ctr[v][1]
		if v == len(ctr) - 1 and count + occ - 1 < i:
			break
		else:
			count += occ
		v += 1
	print(count)


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

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 main():
	try:
		n = I()
		l = [1] + list(In())
		l.sort()
		i = 1
		ma = l[0]
		pep = 1
		j = 0
		q = 0
		for x in range(1, n + 1):
			q += 1
			if pep + j >= l[x]:
				pep += q
				j = 0
				q = 0
			else:
				j += 1
		print(pep)
	except:
		pass
M = 998244353
P = 1000000007
for _ in range(I()):
	main()


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	(present, cnt, cur) = (1, 0, 0)
	for i in range(n):
		if arr[i] <= present:
			present += 1
		elif arr[i] <= present + cur:
			present += cur + 1
			cur = 0
		else:
			cur += 1
	print(present)


import os
import sys
if os.path.exists('/mnt/c/Users/Square/square/codeforces'):
	f = iter(open('B.txt').readlines())

	def input():
		return next(f)
else:
	input = lambda : sys.stdin.readline().strip()
fprint = lambda *args: print(*args, flush=True)
import itertools
t = int(input())
for _ in range(t):
	n = int(input())
	a = sorted(list(map(int, input().split())))
	res = 0
	for (i, j) in enumerate(a):
		if j <= i + 1:
			res = i + 1
	res += 1
	print(res)


import sys
t = int(input())
for _ in range(t):
	sys.stdin.readline()
	grannies = [int(var) for var in input().split(' ')]
	grannies.sort()
	people = 1
	for idx in reversed(range(len(grannies))):
		if idx + 1 >= grannies[idx]:
			people = idx + 2
			break
	print(people)


t = int(input())
for i in range(t):
	n = int(input())
	list1 = [int(i) for i in input().split()]
	list1.sort()
	count = bool(0)
	while count == 0 and len(list1) != 0:
		if list1[-1] > n:
			del list1[-1]
			n -= 1
		else:
			count = 1
	print(n + 1)


t = int(input())
for _ in range(t):
	n = int(input())
	a = sorted(list(map(int, input().split())))
	flag = 1
	s = n
	for i in range(n - 1, -1, -1):
		if a[i] <= s:
			flag = 0
			break
		else:
			s -= 1
	if flag == 1:
		print('1')
	else:
		print(s + 1)


def check(M):
	if M == 0:
		return True
	if u[M - 1] <= M:
		return True
	return False
ans = []
for _ in range(int(input())):
	n = int(input())
	u = list(map(int, input().split()))
	u.sort()
	for i in range(n, -1, -1):
		if check(i):
			ans.append(i + 1)
			break
print('\n'.join(map(str, ans)))


for _ in range(int(input())):
	n = int(input())
	m = [*map(int, input().split())]
	m.sort()
	res = 0
	for i in range(n):
		if m[i] <= i + 1:
			res = i + 1
	print(res + 1)


t = int(input())
while t != 0:
	n = int(input())
	A = sorted(list(map(int, input().split())))

	def check(arr):
		tmp = len(arr)
		while len(arr) > 0 and arr[-1] > tmp:
			arr.pop()
		if len(arr) > 0 and max(arr) <= len(arr):
			return len(arr) + 1
		elif len(arr) == 0:
			return 1
		elif len(arr) == 1 and arr[0] > 1:
			return 1
		else:
			return check(arr)
	print(check(A))
	t -= 1


import bisect
import math
for _ in range(int(input())):
	n = int(input())
	l = [int(x) for x in input().split()]
	l.sort()
	c = 1
	o = 0
	mx = -1
	for i in l:
		if i <= c:
			c += 1
		elif i > mx and mx != -1:
			o += 1
			mx = i
		elif i == mx:
			o += 1
			if o + c > mx:
				c += o
				mx = -1
				o = 0
		else:
			o += 1
			mx = i
	print(c)


for __ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	(count, temp_count) = (1, 0)
	i = 0
	while i < n:
		if a[i] <= count + temp_count:
			count = i + 2
			temp_count = 0
		else:
			temp_count += 1
		i += 1
	print(count)


I = input
for _ in range(int(I())):
	n = int(I())
	for i in sorted(map(int, I().split()), reverse=True):
		if i > n:
			n -= 1
		else:
			print(n + 1)
			break
	else:
		print(1)


for _ in range(int(input())):
	n = int(input())
	l = sorted(list(map(int, input().split())))
	k = len(l)
	for num in range(len(l)):
		if k >= l[-(num + 1)]:
			print(len(l[0:-(num + 1)]) + 2)
			break
		k -= 1
	else:
		print(1)


t = int(input())
l = []
for i in range(t):
	n = int(input())
	a = []
	a = [int(x) for x in input().split()]
	d = 1
	a.sort()
	for k in range(n - 1, -1, -1):
		people = k + 1
		if a[k] <= people:
			d = k + 2
			break
	l.append(d)
for x in l:
	print(x)


for t in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	ans = 0
	for i in range(n):
		ele_before = i + 1
		if ele_before >= arr[i]:
			ans = ele_before
	print(ans + 1)


t = int(input())
for i in range(t):
	n = int(input())
	inp = [int(j) for j in input().split()]
	inp.sort()
	res = 1
	temp = 1
	temp2 = 0
	for i in range(n):
		if res >= inp[i]:
			temp = temp + 1
			temp = temp + temp2
			temp2 = 0
		else:
			temp2 = temp2 + 1
		res = res + 1
	print(temp)


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	count = 1
	temp = 1
	for i in range(n):
		if temp >= arr[i]:
			count = temp + 1
		temp += 1
	print(count)


import math
from collections import Counter

def solve(n, a):
	d = Counter(a)
	c = 1
	g = 1
	for i in sorted(d.keys()):
		if g + d[i] > i:
			g += d[i]
			c = g
		else:
			g += d[i]
	return c
t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	res = solve(n, a)
	print(res)


for j in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	arr = sorted(arr, reverse=True)
	count = 0
	for i in range(n):
		if arr[i] <= n - i:
			count += n - i
			break
	print(count + 1)


from math import *

def r1(t):
	return t(input().strip())

def r2(t):
	return [t(i) for i in input().strip().split()]

def r3(t):
	return [t(i) for i in input().strip()]
for _ in range(int(input())):
	n = r1(int)
	a = r2(int)
	a.sort()
	ans = 1
	for i in range(n):
		if a[i] <= i + 1:
			ans = i + 2
	print(ans)


t = int(input())
for i in range(t):
	n = int(input())
	row = input()
	babki = [int(j) for j in row.split()]
	babki.sort()
	total = 0
	for j in range(len(babki)):
		if j + 1 >= babki[j]:
			total = j + 1
	print(total + 1)


for t in range(int(input())):
	n = int(input())
	l = sorted(list(map(int, input().split())))
	p = 0
	for i in range(n - 1, -1, -1):
		if i + 1 >= l[i]:
			p = i + 1
			break
	print(p + 1)


import math
from collections import OrderedDict
for _ in range(int(input())):
	n = int(input())
	A = list(map(int, input().split()))
	A.sort()
	mark = OrderedDict()
	for i in range(n):
		if mark.get(A[i], 0) == 0:
			mark[A[i]] = 1
		else:
			mark[A[i]] += 1
	Ans = 0
	t = 0
	for i in mark.keys():
		if mark[i] + t + Ans >= i:
			Ans += mark[i] + t
			t = 0
		else:
			t += mark[i]
	print(Ans + 1)


for tc in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	for i in range(n - 1, -1, -1):
		if l[i] > n:
			l.pop()
			n -= 1
		else:
			break
	print(n + 1)


import sys
import math
import collections
from sys import stdin, stdout, setrecursionlimit
import bisect as bs
setrecursionlimit(2 ** 20)
M = 10 ** 9 + 7
T = int(stdin.readline())
for _ in range(T):
	n = int(stdin.readline())
	a = list(map(int, stdin.readline().split()))
	a.sort()
	g = 1
	to = 0
	for i in range(n):
		if a[i] <= g + to:
			g += to + 1
			to = 0
		else:
			to += 1
	print(g)


import collections
for _ in range(int(input())):
	n = int(input())
	arr = sorted(list(map(int, input().split())))
	curr = 1
	count = 1
	freq = collections.Counter(arr)
	arr = set(arr)
	for i in arr:
		curr += freq[i]
		if curr - 1 >= i:
			count = curr
	print(count)


for _ in range(int(input())):
	n = int(input())
	l = sorted(list(map(int, input().split())))
	idx = 0
	for i in range(n):
		if l[i] <= i + 1:
			idx = i + 1
	print(idx + 1)


t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	c = 1
	i = 0
	cu = 0
	while i < n:
		if arr[i] <= c + cu:
			if cu == 0:
				c += 1
			else:
				c += cu + 1
			cu = 0
		else:
			cu += 1
		i += 1
	print(c)


def f(a):
	a.sort()
	C = []
	for i in range(len(a)):
		if a[i] <= i + 1:
			C.append(i)
	if len(C) == 0:
		return 1
	else:
		return max(C) + 2
t = int(input())
while t > 0:
	n = int(input())
	a = list(map(int, input().split()))
	print(f(a))
	t -= 1


def main():
	n = int(input())
	lst = sorted(list(map(int, input().split())))
	for i in range(n - 1, -1, -1):
		if lst[i] <= i + 1:
			print(i + 2)
			return
	print(1)

def __starting_point():
	t = int(input())
	for i in range(t):
		main()
__starting_point()


t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	flag = 0
	i = n - 1
	for i in range(n - 1, -1, -1):
		if l[i] <= i + 1:
			flag = 1
			break
	if flag:
		print(i + 2)
	else:
		print(1)


t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	c = 1 + n
	for i in range(n - 1, -1, -1):
		if c <= arr[i]:
			c -= 1
		else:
			print(c)
			break
	else:
		print(c)


import math
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split(' ')))
	a.sort(reverse=True)
	ex = 0
	count = 0
	for i in range(n):
		if a[i] > n - ex:
			ex += 1
		else:
			count += 1
	print(count + 1)


t = int(input())
for i in range(t):
	n = int(input())
	a = sorted(list(map(int, input().split())), reverse=True)
	for j in range(n):
		if a[j] > n:
			n -= 1
	print(n + 1)


I = input
t = int(I())
while t > 0:
	t -= 1
	n = int(I())
	a = [int(x) for x in I().strip().split()]
	a.sort()
	i = n - 1
	while i >= 0:
		if a[i] <= i + 1:
			print(i + 2)
			break
		i -= 1
	if i == -1:
		print(1)


test = int(input())
for t in range(test):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	flag = False
	for i in range(n - 1, -1, -1):
		if l[i] <= i + 1:
			print(i + 2)
			flag = True
			break
	if flag:
		pass
	else:
		print(1)


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	while l:
		if l[-1] <= n:
			break
		else:
			l.pop()
			n -= 1
	print(n + 1)


t = int(input())
for x in range(t):
	l = int(input())
	gran = list(map(int, input().split()))
	gran.sort()
	m = l
	total = 1
	for i in range(l - 1, -1, -1):
		if gran[i] <= m:
			total += 1
		else:
			m -= 1
	print(total)


import math
import bisect

def f(k):
	z = bisect.bisect(li, k)
	if z >= k:
		return 1
	return 0
t = int(input())
for you in range(t):
	n = int(input())
	l = input().split()
	li = [int(i) for i in l]
	li.sort()
	for i in range(n, -1, -1):
		if f(i):
			ans = i
			break
	print(ans + 1)


t = int(input())
ans = []
for i in range(t):
	n = int(input())
	lst = list(map(int, input().split()))
	lst.sort()
	no_granny = 1
	c = 0
	j = 0
	while j < n:
		if no_granny + c >= lst[j]:
			no_granny += 1 + c
			c = 0
		else:
			c += 1
		j += 1
	ans.append(no_granny)
for item in ans:
	print(item)


t = int(input())
for f in range(t):
	n = int(input())
	l = [int(x) for x in input().split()]
	l.sort()
	l.reverse()
	true = 0
	for i in range(n):
		if l[i] <= n - i:
			true = 1
			print(n - i + 1)
			break
	if not true:
		print(1)


def solve():
	n = input()
	persons = list(map(int, input().split()))
	s = 1
	wait = 0
	for (i, p) in enumerate(sorted(persons)):
		if s + wait >= p:
			s += 1 + wait
			wait = 0
		else:
			wait += 1
	print(s)
for _ in range(int(input())):
	solve()


t = int(input())
while t:
	t -= 1
	n = int(input())
	A = [i for i in map(int, input().strip().split())]
	A.sort()
	i = 0
	ans = 1
	while i < n:
		if A[i] <= i + 1:
			check = True
		else:
			check = False
		if check:
			ans = i + 2
		i += 1
	print(ans)


for _ in range(int(input())):
	N = int(input())
	List = [int(x) for x in input().split()]
	List.sort()
	Curr = 0
	for i in range(N - 1, -1, -1):
		if List[i] <= i + 1:
			Curr = i + 1
			break
		if i == 0:
			Curr = 0
			break
	print(Curr + 1)


from sys import stdin, stdout
import math

def solve():
	cases = int(input())
	for case in range(1, cases + 1):
		n = int(input())
		arr = [int(n) for n in input().split()]
		arr = sorted(arr)
		count = 1
		ans = 1
		for (i, a) in enumerate(arr):
			count += 1
			if count > a:
				ans = i + 2
		print('{}'.format(ans))
solve()


from __future__ import division, print_function
import os
import sys
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip
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 math import sqrt, floor, factorial, gcd
from collections import deque, Counter, defaultdict
input = lambda : sys.stdin.readline().rstrip('\r\n')
read = lambda : list(map(int, input().split(' ')))

def main():
	for _ in range(int(input())):
		n = int(input())
		arr = Counter(read())
		gs = 1
		s = 0
		for i in sorted(arr.keys()):
			if gs + s + arr[i] - 1 >= i:
				gs += arr[i]
				gs += s
				s = 0
			else:
				s += arr[i]
		print(gs)
main()


for _ in range(int(input())):
	n = int(input())
	lis = sorted(map(int, input().split()))
	gran = 1
	ans = 0
	for i in range(n):
		if lis[i] <= i + 1:
			ans = i + 1
	print(ans + 1)


from collections import OrderedDict
for i in range(int(input())):
	n = int(input())
	lst = sorted(list(map(int, input().split())))
	d = OrderedDict()
	for ele in lst:
		if ele in d:
			d[ele] += 1
		else:
			d[ele] = 1
	temp = 0
	granny_in = 1
	for (e, v) in d.items():
		if e <= granny_in + v - 1 + temp:
			granny_in += v + temp
			temp = 0
		else:
			temp += v
	print(granny_in)


for t in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	i = n - 1
	while i >= 0 and a[i] > i + 1:
		i -= 1
	print(i + 2)


import sys
import heapq

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

def iinput():
	return int(input())

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

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

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

def main():
	n = iinput()
	q = srlinput()
	res = 1
	for i in range(n):
		if i + 1 >= q[i]:
			res = i + 2
	print(res)
for i in range(iinput()):
	main()


import sys
import math
input = sys.stdin.buffer.readline
t = int(input())
for _ in range(t):
	n = int(input())
	arr = [int(c) for c in input().split()]
	arr.sort(reverse=True)
	arrk = [arr[0]]
	k = n
	ans = 1
	for i in range(len(arr)):
		if arr[i] <= k:
			ans += k
			break
		k -= 1
	print(ans)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	cur = 1
	i = 0
	cnt = 0
	while i < n:
		cnt += 1
		if cur + cnt - 1 >= a[i]:
			cur += cnt
			cnt = 0
		i += 1
	print(cur)


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	d = {}
	cur = n
	for x in a:
		if x in d:
			d[x] += 1
		else:
			d[x] = 1
	s = list(d.keys())
	s.sort(reverse=True)
	for u in s:
		if u > cur:
			cur -= d[u]
		else:
			break
	print(cur + 1)


import sys, random, math
from bisect import bisect_left, bisect_right
input = sys.stdin.readline

def main():
	inf = 10 ** 18
	t = int(input())
	for _ in range(1, t + 1):
		n = int(input())
		a = sorted([int(x) for x in input().split()])
		(l, r) = (-1, 0)
		ans = 0
		while r < n:
			if r - l + ans >= a[r]:
				ans += r - l
				l = r
			r += 1
		print(ans + 1)
main()


for _ in range(int(input())):
	n = int(input())
	a = [int(x) for x in input().split()]
	a.sort()
	res = 1
	for i in range(n):
		if i + 1 >= a[i]:
			res = max(res, i + 2)
	print(res)


t = int(input())
while t:
	n = int(input())
	a = list(map(int, input().split()))
	a.sort(reverse=True)
	k = 0
	z = 0
	for i in range(0, n):
		if a[i] <= n - k:
			print(n - k + 1)
			z = 1
			break
		else:
			k += 1
	if z == 0:
		print('1')
	t -= 1


import sys
readline = sys.stdin.readline
ns = lambda : readline().rstrip()
ni = lambda : int(readline().rstrip())
nm = lambda : map(int, readline().split())
nl = lambda : list(map(int, readline().split()))

def solve():
	n = ni()
	nums = nl()
	nums = sorted(nums)
	cnt = 0
	for (idx, val) in enumerate(nums):
		if val <= idx + 1:
			cnt = idx + 1
	print(cnt + 1)
t = ni()
for _ in range(t):
	solve()


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()
	a.sort()
	c = 1
	k = 1
	for i in range(n):
		if a[i] <= i + 1:
			c = i + 2
	print(c)
for _ in range(I()):
	solve()


from sys import stdin
input = stdin.readline

def main():
	test = int(input())
	for _ in range(test):
		n = int(input())
		l = [int(i) for i in input().split(' ')]
		l.sort()
		count = 1
		i = 0
		while i < n:
			if i + 1 >= l[i]:
				count = max(count, i + 2)
			i += 1
		print(count)
main()


import collections
t = int(input())
for we in range(t):
	n = int(input())
	l = sorted(list(map(int, input().split())))
	f = collections.Counter(l)
	g = 0
	a = 0
	for i in f.items():
		g += i[1]
		if i[0] <= g:
			a = g
	print(a + 1)


q = int(input())
for _ in range(q):
	n = int(input())
	arr = list(map(int, input().split(' ')))
	arr.sort()
	MAX = -1
	sure = 1
	cur = 1
	for i in range(n):
		if arr[i] <= cur:
			cur += 1
			sure = cur
			MAX = max(MAX, arr[i])
		else:
			MAX = max(MAX, arr[i])
			cur += 1
	print(sure)


from sys import stdin, stdout
t = int(stdin.readline().strip())
for _ in range(t):
	n = int(stdin.readline().strip())
	l = list(map(int, stdin.readline().strip().split()))
	l.sort()
	k = n
	for i in range(n):
		if l[n - i - 1] <= k:
			break
		else:
			k -= 1
	stdout.write(str(k + 1) + '\n')


import sys
from math import floor, sqrt, ceil, factorial, gcd, pi
from itertools import chain, combinations, permutations, accumulate
from collections import Counter, defaultdict, OrderedDict, deque
from array import array
INT_MAX = sys.maxsize
INT_MIN = -sys.maxsize - 1
mod = 1000000007

def solve():
	t = int(sys.stdin.readline())
	for _ in range(t):
		n = int(sys.stdin.readline())
		a = list(map(int, sys.stdin.readline().split()))
		person = set(a)
		a.sort()
		ans = 0
		for i in range(n):
			if a[i] <= i + 1:
				ans = i + 1
		print(ans + 1)
solve()


from math import *
from copy import *
t = int(input())
for i in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	l = sorted(l)
	a = False
	for j in range(len(l) - 1, -1, -1):
		if l[j] <= j + 1:
			a = True
			break
	if a == True:
		print(j + 2)
	else:
		print(1)


def fun(array):
	q = 0
	array.sort()
	count = 1
	for i in range(len(array)):
		a = array[i]
		if array[i] <= q + count:
			count += q + 1
			q = 0
		else:
			q += 1
	return count
for _ in range(int(input())):
	n = int(input())
	array = list(map(int, input().split()))
	print(fun(array))


tc = int(input())
for i in range(tc):
	n = int(input())
	grannies = list(map(int, input().split()))
	grannies.sort()
	f = 1
	for i in range(n - 1, -1, -1):
		if grannies[i] <= i + 1:
			print(i + 2)
			f = 0
			break
	if f:
		print(1)


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	(pre, nee) = (1, 0)
	ans = 1
	for i in l:
		pre += 1
		if pre - 1 < i:
			nee = 1
		else:
			nee = 0
		if nee == 0:
			ans = max(ans, pre)
	print(ans)


t = int(input())
for q in range(t):
	n = int(input())
	entrada = list(map(int, input().split(' ')))
	entrada.sort()
	entrada = list(reversed(entrada))
	y = n
	for k in range(n):
		if entrada[k] > y:
			y -= 1
		else:
			break
	print(y + 1)


import sys
import math

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

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

def ILS():
	return list(map(str, sys.stdin.readline().strip().split()))
t = I()
for iii in range(t):
	n = I()
	l = IL()
	l.sort()
	cur = 0
	tmp = 1
	for i in range(len(l)):
		if tmp >= l[i]:
			cur = tmp
		tmp += 1
	print(cur + 1)
	pass


t = int(input())
a = []
c = 0
for i in range(t):
	n = int(input())
	h = n
	l = [int(i) for i in input().split()][:n]
	l.sort()
	for k in range(n - 1, -1, -1):
		if l[k] > h:
			h -= 1
	a.insert(c, h + 1)
	c += 1
print(*a, sep='\n')


for _ in range(int(input())):
	n = int(input())
	lst = list(map(int, input().split()))
	lst.sort()
	i = n - 1
	temp = n
	while lst[i] > temp:
		temp -= 1
		i -= 1
		if i < 0:
			break
	print(temp + 1)


T = int(input())

def ans(A):
	A = sorted(A)
	seq = range(1, len(A) + 1)
	for (a, b) in reversed(list(zip(A, seq))):
		if b >= a:
			return b + 1
	return 1
for t in range(T):
	n = input()
	A = input().split(' ')
	A = [int(x) for x in A]
	print(ans(A))


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	while len(a) > 0 and a[len(a) - 1] > len(a):
		a.pop()
	print(len(a) + 1)


from collections import Counter
for _ in range(int(input())):
	n = int(input())
	a = dict(Counter(list(map(int, input().split()))))
	b = list(a.keys())
	b.sort()
	c = 1
	i = 0
	m = len(b)
	while i < m:
		if b[i] <= c:
			c += a[b[i]]
		else:
			temp = c
			j = i
			while j < m:
				temp += a[b[j]]
				if b[j] <= temp - 1:
					break
				j += 1
			if j == m:
				break
			if temp - 1 >= b[j]:
				c = temp
			i = j
		i += 1
	print(c)


t = int(input())
for T in range(t):
	n = int(input())
	a = [int(k) for k in input().split()]
	a.sort()
	kolvo = n
	for i in range(n - 1, -1, -1):
		if kolvo + 1 <= a[i]:
			kolvo -= 1
			continue
	print(kolvo + 1)


import math
from sys import stdin, stdout

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

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

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

def main():
	for i in range(I()):
		n = I()
		l = L()
		l = sorted(l, reverse=True)
		ans = n + 1
		for i in l:
			if i < ans:
				break
			else:
				ans -= 1
		print(ans)
main()


t = int(input())
cnt = 0
while cnt < t:
	cnt += 1
	n = int(input())
	a = [int(i) for i in input().split()]
	a.sort()
	flag = True
	tmp = 0
	res = 0
	i = 0
	while i < n:
		if a[i] <= res + 1:
			res += 1
			i += 1
			tmp = 0
		else:
			j = i
			while a[j] > res + 1 + tmp:
				j += 1
				tmp += 1
				if j > n - 1:
					flag = False
					break
			if flag == False:
				break
			else:
				res += tmp
				tmp = 0
				i = j
	print(res + 1)


t = int(input())
for i in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	s = 1
	arr.sort()
	i = n - 1
	while i >= 0 and arr[i] > i + 1:
		arr.pop()
		i = i - 1
	print(len(arr) + 1)


tests = int(input())
for i in range(tests):
	n = int(input())
	a = [int(x) for x in input().split(' ')]
	a.sort()
	result = 0
	for x in range(n - 1, -1, -1):
		if a[x] <= x + 1:
			result = x + 1
			break
	print(result + 1)


for _ in range(int(input())):
	n = int(input())
	arr = sorted((int(x) for x in input().split()))
	count = 1
	for k in range(n - 1, -1, -1):
		if k + 1 >= arr[k]:
			count = k + 2
			break
	print(count)


for _ in range(int(input())):
	n = int(input())
	lst = [int(i) for i in input().split()]
	lst.sort(reverse=True)
	for i in lst:
		if n >= i:
			break
		else:
			n = n - 1
	print(n + 1)


for _ in range(int(input())):
	n = int(input())
	grans = list(map(int, input().split()))
	grans = sorted(grans)
	ans = 1
	tgran = 0
	for i in range(n - 1, -1, -1):
		if grans[i] <= i + 1:
			tgran = max(tgran, grans[i])
		if grans[i] <= tgran:
			ans += 1
	print(ans)


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	granies = 1
	waiting = 0
	i = 0
	while i < n:
		if arr[i] <= granies:
			granies += 1
			i += 1
		else:
			if arr[i] <= waiting + granies:
				granies += waiting + 1
				waiting = 0
			else:
				waiting += 1
			i += 1
	print(granies)


t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	arr = sorted(arr)
	a = []
	x = 1
	g = 0
	for i in range(len(arr)):
		if arr[i] <= i + 1:
			x = x + g + 1
			g = 0
		else:
			g = g + 1
	print(x)


def main():
	t = int(input())
	for __ in range(t):
		m = int(input())
		pres = 1
		req = 0
		a = sorted(list(map(int, input().split())))
		for i in range(m):
			if i + 1 >= a[i] and req > 0:
				req = 0
			elif i + 1 < a[i]:
				if req > 0:
					req -= 1
				req += a[i] - (i + 1)
			if req == 0:
				pres = i + 2
		print(pres)
main()


from sys import stdin
t = int(input())
for _ in range(0, t):
	n = int(input())
	a = [int(c) for c in stdin.readline().split()]
	a.sort()
	answer = n + 1
	for i in range(len(a) - 1, -1, -1):
		if a[i] > i + 1:
			answer = i
		else:
			answer = i + 2
			break
	if answer == 0:
		answer = 1
	print(answer)


t = int(input())
for i in range(t):
	n = int(input())
	data = list(map(int, input().split()))
	data = sorted(data)
	gc = 1
	count = 0
	for j in data:
		if gc + count >= j:
			gc += 1 + count
			count = 0
		else:
			count += 1
	print(gc)


t = int(input())
for i in range(t):
	n = int(input())
	arr = [int(i) for i in input().split()]
	arr.sort()
	c = 0
	for i in range(n):
		if arr[i] <= i + 1:
			c = i + 1
	print(int(c) + 1)


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	c = 1
	for i in range(1, n + 1):
		if l[i - 1] <= i:
			c = i + 1
	print(c)


def main():
	for _ in range(int(input())):
		n = int(input())
		a = list(map(int, input().split()))
		a.sort()
		s = 0
		m = s
		mi = -1
		for i in range(n):
			if i + 1 >= a[i]:
				s = i + 1
		print(s + 1)
main()


for _ in range(int(input())):
	n = int(input())
	data = [int(x) for x in input().split()]
	data.sort()
	res = 0
	r = 1
	for q in range(n):
		if data[q] <= r:
			res = q + 1
		r += 1
	print(res + 1)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()[:n]))
	k = 0
	a.sort()
	i = 0
	while i < n:
		if a[i] <= k + 1:
			k += 1
		else:
			t = 0
			tem = k
			x = i
			z = i
			while z < n:
				if a[z] <= tem + 1:
					t = z - x + 1
				z += 1
				tem += 1
			k += t
			i = z - 1
		i += 1
	print(k + 1)


import sys
input = lambda : sys.stdin.readline().rstrip()

def calc():
	N = int(input())
	A = sorted([int(a) for a in input().split()])
	ma = 0
	for (i, a) in enumerate(A):
		if i + 1 >= a:
			ma = max(ma, i + 1)
	return ma + 1
T = int(input())
for _ in range(T):
	print(calc())


def solve():
	occ = [0] * (n + 1)
	for i in range(n):
		if a[i] <= n:
			occ[a[i]] += 1
	ngrans = 0
	orless = [0] * (n + 1)
	for i in range(n + 1):
		ngrans += occ[i]
		orless[i] = ngrans
	ans = 0
	for i in range(n + 1):
		if orless[i] >= i:
			ans = orless[i] + 1
	print(ans)
	return
t = int(input())
for tt in range(1, t + 1):
	n = int(input())
	a = [int(i) for i in input().split(' ')]
	solve()


for _ in range(0, int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	while True:
		if len(a) == 0:
			print(1)
			break
		if a[-1] > len(a):
			del a[-1]
		else:
			print(len(a) + 1)
			break


def solve():
	n = int(input())
	a = sorted(list(map(int, input().split())))
	c = 1
	i1 = 0
	for i in range(0, n + 1):
		if i == n:
			print(c)
			return
		if a[i] <= c + i1:
			c += i1 + 1
			i1 = -1
		i1 += 1
	print(c)
t = int(input())
for tt in range(0, t):
	solve()


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	(res, l, check) = (1, 0, 0)
	for i in arr:
		if i <= res:
			res += 1
		else:
			if i > check:
				l += 1
				check = i
			elif check == i:
				l += 1
			if l > check - res:
				res += l
				check = 0
				l = 0
	if check != 0:
		if l > check - res:
			res += l
	print(res)


import sys
INF = 10 ** 20
MOD = 10 ** 9 + 7
I = lambda : list(map(int, input().split()))
from math import gcd
from math import ceil
from collections import defaultdict as dd, Counter
from bisect import bisect_left as bl, bisect_right as br

def solve():
	(n,) = I()
	a = I()
	M = 300000
	ans = n + 1
	a.sort(reverse=1)
	for i in a:
		if i > ans - 1:
			ans -= 1
	print(ans)
(t,) = I()
while t:
	t -= 1
	solve()


from collections import OrderedDict

def grannies_possible(n, arr):
	f_d = OrderedDict()
	arr.sort()
	for i in range(len(arr)):
		f_d[arr[i]] = f_d.get(arr[i], 0) + 1
	c_s = dict()
	prev = 1
	for k in f_d:
		c_s[k] = f_d[k] + prev
		prev = c_s[k]
	rev_k = f_d.keys()
	rev_k = reversed(rev_k)
	val = 1
	for k in rev_k:
		if k <= c_s[k] - 1:
			return c_s[k]
	return 1
t = int(input())
for i in range(t):
	n = int(input())
	arr = input()
	arr = arr.split()
	arr = [int(el) for el in arr]
	print(grannies_possible(n, arr))


for _ in range(int(input())):
	n = int(input())
	s = list(map(int, input().split()))
	s.sort(reverse=True)
	c = 0
	for i in range(len(s)):
		if s[i] <= len(s) - i:
			print(len(s) - i + 1)
			c += 1
			break
	if c == 0:
		print('1')


import sys
input = sys.stdin.readline
Q = int(input())
Query = []
for _ in range(Q):
	N = int(input())
	A = list(map(int, input().split()))
	Query.append((N, A))
for (N, A) in Query:
	A.sort()
	ans = 1
	for (i, a) in enumerate(A):
		if i + 1 >= a:
			ans = i + 2
	print(ans)


test_cases = int(input())
for test_case in range(test_cases):
	length = int(input())
	gs = list(map(int, input().split(' ')))
	gs.sort()
	count = 1
	stopped = -1
	for g in gs:
		if g > count:
			if stopped == -1:
				stopped = count
		else:
			stopped = -1
		count += 1
	if stopped != -1:
		print(stopped)
	else:
		print(count)


import sys
try:
	sys.stdin = open('Input.txt', 'r')
	sys.stdout = open('Output.txt', 'w')
except:
	pass
input = sys.stdin.readline
for testCases in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort(reverse=True)
	ans = n
	for i in range(n):
		if l[i] <= ans:
			break
		else:
			ans -= 1
	print(ans + 1)


t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	inside = 1
	count = n
	total = n
	ans = True
	for i in range(n - 1, -1, -1):
		if total < l[i]:
			total -= 1
		else:
			break
	print(total + 1)


from collections import Counter
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	d = Counter(a)
	(b, i, c) = (1, 1, 0)
	while i < n + 1:
		if b + d[i] + c - 1 >= i:
			b += c + d[i]
			c = 0
		else:
			c += d[i]
		i += 1
	print(b)


t = int(input())
for test in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.append(1)
	arr.sort()
	cnt = 0
	for i in range(1, n + 1):
		if arr[i] <= i:
			cnt = i
	print(cnt + 1)


for t in range(int(input())):
	n = int(input())
	g_list = [*map(int, input().split(' '))]
	g_list.sort()
	g_count = 0
	for i in range(n):
		if g_list[i] <= i + 1:
			g_count = max(g_count, i + 1)
	print(g_count + 1)


t = int(input())
for i in range(t):
	n = int(input())
	l = list(map(int, input().strip().split()))
	l.sort()
	count = 0
	for j in range(n - 1, -1, -1):
		if l[j] <= j + 1:
			count = j + 1
			break
	print(count + 1)


t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().strip().split()))
	arr.sort()
	(num, ans, i) = (1, 1, 0)
	while i < n and arr[i] == 1:
		ans += 1
		i += 1
	while i < n:
		if arr[i] <= ans:
			ans += 1
			i += 1
			continue
		d = arr[i] - ans
		i = i + d
		k = d
		if i >= n:
			break
		while arr[i] > ans + k:
			if i >= n:
				break
			d = arr[i] - (ans + k)
			i = i + d
			k += d
			if i >= n:
				break
		if i < n:
			ans += k
	print(ans)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	c = 1
	for i in range(n - 1, -1, -1):
		if a[i] <= i + 1:
			c = i + 2
			break
		else:
			continue
	print(c)


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().strip().split()))
	a.sort()
	ok = [0] * n
	last_one = -1
	for (idx, element) in enumerate(a):
		if element - 1 <= idx:
			ok[idx] = 1
			last_one = idx
	if last_one == -1:
		print(1)
	else:
		print(last_one + 2)


t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	h = {}
	ih = {}
	k = 0
	s = 0
	ts = 0
	for i in range(n):
		if l[i] in h.keys():
			h[l[i]] += 1
		else:
			h[l[i]] = 1
			ih[k] = l[i]
			k += 1
	for p in ih.keys():
		if h[ih[p]] + s >= ih[p]:
			ts = 0
		else:
			ts += h[ih[p]]
		s = s + h[ih[p]]
	print(s + 1 - ts)


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()]
t = int(input())
for q in range(t):
	n = inputnum()
	a = inputlist()
	ans = 1
	a.sort(reverse=True)
	for i in range(n):
		if n - i >= a[i]:
			ans += n - i
			break
	print(ans)


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	l = [0] + l
	for i in range(len(l) - 1, -1, -1):
		if l[i] <= i:
			print(i + 1)
			break


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	flag = False
	for i in range(n - 1, -1, -1):
		if a[i] <= i + 1:
			print(i + 2)
			flag = True
			break
	if flag == False:
		print(1)


for i in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	ans = 0
	for j in range(n, -1, -1):
		if j >= l[j - 1]:
			ans = j
			break
	print(ans + 1)


def solve(n, arr):
	arr.sort()
	i = n - 1
	while i >= 0 and arr[i] > i + 1:
		i -= 1
	return i + 2
t = int(input())
for _ in range(t):
	inp = input().split()
	n = int(inp[0])
	arr = [int(x) for x in input().split()]
	print(solve(n, arr))


import sys
input = sys.stdin.readline
t = int(input())
for test in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	ans = 1
	for i in range(n - 1, -1, -1):
		if i + 1 >= a[i]:
			ans += 1 + i
			break
	print(ans)


import math
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(n):
		if a[n - 1 - j] > n - j:
			continue
		else:
			ans = n - j
			break
	print(ans + 1)


import random

def ans_finder(nakhre, n):
	real_count = 1
	nakhre.sort()
	for i in range(n):
		if nakhre[i] <= i + 1:
			real_count = i + 2
	return real_count
t = int(input())
ans = []
for i in range(t):
	n = int(input())
	nakhre = [int(i) for i in input().split()]
	ans.append(ans_finder(nakhre, n))
for i in ans:
	print(i)


t = int(input())
for _ in range(t):
	n = int(input())
	g = sorted(list(map(int, input().split())))
	(check, i) = (n + 1, n - 1)
	while i >= 0 and check <= g[i]:
		check -= 1
		i -= 1
	if i < 0:
		print(1)
	else:
		print(check)


for t in range(int(input())):
	n = int(input())
	grannies = [int(x) for x in input().split()]
	grannies.sort()
	k = 1
	ans = 1
	for i in range(n):
		if k >= grannies[i]:
			ans = k + 1
		k += 1
	print(ans)


def grannyno(grannies):
	counts = {}
	for g in grannies:
		counts[g] = counts.get(g, 0) + 1
	order = sorted(counts)
	summ = 0
	maxi = 1
	for count in order:
		summ += counts[count]
		if summ >= count:
			maxi = summ + 1
	return maxi
t = int(input())
for i in range(t):
	n = int(input())
	grannies = [int(i) for i in input().split()]
	print(grannyno(grannies))


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort(reverse=True)
	intialG = n
	for i in arr:
		if i <= intialG:
			break
		intialG -= 1
	print(intialG + 1)


from collections import Counter
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	c = Counter(a)
	d = list(sorted(c.items()))
	ans = 0
	current = 1
	bulk = 0
	for i in range(len(d)):
		bulk += d[i][1]
		if current + bulk - 1 >= d[i][0]:
			current += bulk
			ans = i + 1
			bulk = 0
	print(current)


import os
import sys
from io import BytesIO, IOBase

def solution(arr, n):
	arr.sort()
	arr.insert(0, 0)
	if arr[-1] <= n:
		write(n + 1)
		return
	(i, res) = (n, n + 1)
	while arr[i] > i:
		res -= 1
		i -= 1
	write(res)

def main():
	for _ in range(r_int()):
		n = r_int()
		arr = r_array()
		solution(arr, n)
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')

def write(*args, end='\n'):
	for x in args[:-1]:
		sys.stdout.write(str(x) + ' ')
	sys.stdout.write(str(args[-1]))
	sys.stdout.write(end)

def r_array():
	return [int(x) for x in input().split()]

def r_int():
	return int(input())
main()


for z in range(int(input())):
	n = int(input())
	ar = list(map(int, input().split()))
	ar.sort()
	current = 1
	i = 0
	while i < n:
		call = 0
		found = 0
		while i < n:
			if ar[i] > current + call:
				call += 1
			elif ar[i] >= current + call:
				found = 1
				call += 1
				break
			i += 1
		i += 1
		if found:
			current += call
			call = 0
			while i < n and current + call >= ar[i]:
				i += 1
				call += 1
			current += call
	print(current)


from collections import Counter
t = int(input())
rr = lambda : input()
rri = lambda : int(input())
rrm = lambda : list(map(int, input().split()))

def solve(N, arr):
	amt = 1
	newamt = 0
	arr.sort()
	i = 0
	count = Counter(arr)
	seen = set()
	for v in arr:
		if v in seen:
			continue
		seen.add(v)
		if amt + newamt + (count[v] - 1) >= v:
			amt += count[v] + newamt
			newamt = 0
		else:
			newamt += count[v]
	return amt
for _ in range(t):
	n = rri()
	arr = rrm()
	print(solve(n, arr))


for tc in range(int(input())):
	n = int(input())
	L = sorted([int(_) for _ in input().split()], reverse=True)
	ans = 0
	for i in range(n):
		if L[i] <= n - i:
			ans = n - i
			break
	print(1 + ans)


for _ in range(int(input())):
	n = int(input())
	li = list(map(int, input().split()))
	li.sort()
	c = 1
	ans = 1
	x = 0
	f = 0
	while x < n:
		if li[x] <= c:
			f = 1
			ans = c
		c += 1
		x += 1
	if f == 0:
		print(ans)
	else:
		print(ans + 1)


for _ in range(int(input())):
	n = int(input())
	a = sorted(map(int, input().split()))
	s = 1
	m = 1
	y = a[0]
	for i in range(1, n):
		if a[i] != y:
			if s + m > y:
				s += m
				m = 0
		m += 1
		y = a[i]
	if s + m > y:
		s += m
	print(s)


t = int(input())
for i in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	test = True
	for j in range(n - 1, -1, -1):
		if j + 1 >= l[j] and test:
			print(j + 2)
			test = False
	if test:
		print(1)


import sys
input = sys.stdin.readline
a = int(input())
for i in range(a):
	x = int(input())
	z = list(map(int, input().split()))
	cur = 1
	z.sort()
	ans = []
	count = 1
	for i in range(1, len(z)):
		if z[i] == z[i - 1]:
			count += 1
		else:
			ans.append(count)
			count = 1
	ans.append(count)
	index = 0
	i = 0
	extra = 0
	while i < len(ans) and index < len(z):
		if ans[i] + cur + extra > z[index]:
			cur += ans[i] + extra
			index += ans[i]
			extra = 0
			i += 1
		else:
			extra += ans[i]
			index += ans[i]
			i += 1
	print(cur)


import sys, math
t = int(sys.stdin.readline())
for _ in range(t):
	n = int(sys.stdin.readline())
	l = list(map(int, sys.stdin.readline().split()))
	l.sort()
	ans = 1
	for i in range(n - 1, -1, -1):
		if l[i] <= i + 1:
			ans = i + 2
			break
	print(ans)


t = int(input())
p = 0
while p < t:
	n = int(input())
	A = [int(j) for j in input().split()]
	b = A
	b.sort(reverse=True)
	total = len(b)
	for i in b:
		if i > total:
			total -= 1
		else:
			break
	total += 1
	print(total)
	p += 1


t = int(input())
for i in range(t):
	n = int(input())
	x = list(map(int, input().split()))
	count = 0
	x.sort(reverse=True)
	for j in range(n):
		if x[j] >= n + 1 - j:
			continue
		else:
			count = 1
			break
	if count != 1:
		print(1)
	else:
		print(n + 1 - j)


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	num_grannies = 1
	batch_cnt = 0
	for a_i in a:
		if num_grannies >= a_i:
			num_grannies += 1
			continue
		elif batch_cnt + num_grannies >= a_i:
			num_grannies += batch_cnt + 1
			batch_cnt = 0
		else:
			batch_cnt += 1
	print(num_grannies)


n = int(input())
l1 = []
for i in range(n):
	a = int(input())
	b = list(map(int, input().split()))
	l1.append(b)
for i in l1:
	i.sort()
	for j in range(len(i) - 1, -1, -1):
		if i[j] <= j + 1:
			print(j + 2)
			break
	else:
		print('1')


import bisect
import os
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

def primeFactors(n):
	prime = set()
	while n % 2 == 0:
		prime.add(2)
		n = n // 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			prime.add(i)
			n = n // i
	if n > 2:
		prime.add(n)
	return list(prime)

def getFactors(n):
	factors = []
	i = 1
	while i <= math.sqrt(n):
		if n % i == 0:
			if n // i == i:
				factors.append(i)
			else:
				factors.append(i)
				factors.append(n // i)
		i = i + 1
	return factors

def SieveOfEratosthenes(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
	num = []
	for p in range(2, n + 1):
		if prime[p]:
			num.append(p)
	return num

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

def sort_dict(key_value):
	return sorted(key_value.items(), key=lambda kv: (kv[1], kv[0]))

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

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

def string_list():
	return list(input())

def decimalToBinary(n):
	return bin(n).replace('0b', '')

def binaryToDecimal(n):
	return int(n, 2)

def solve():
	n = int(input())
	arr = list_input()
	arr.sort()
	curr = 0
	for i in range(n):
		if arr[i] - 1 <= i:
			curr = i + 1
	print(curr + 1)
t = int(input())
for _ in range(t):
	solve()


from math import *
t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	ans = 0
	a.sort()
	for i in range(n):
		if a[i] <= i + 1:
			ans = i + 1
	print(ans + 1)


t = int(input())
for i in range(0, t):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	g = 0
	c = []
	d = []
	for j in range(0, n):
		if j == 0:
			g = a[j]
			c.append(a[j])
			d.append(1)
		elif g == a[j]:
			d[len(d) - 1] += 1
		else:
			g = a[j]
			c.append(a[j])
			d.append(1)
	x = sum(d) + 1
	for j in range(0, len(c)):
		if x - 1 >= c[len(c) - 1 - j]:
			break
		else:
			x = x - d[len(c) - 1 - j]
	print(x)


t = int(input())
z = t
ans = list()
a = list()
i = 0
while z > 0:
	pq = int(input())
	p = pq
	str1 = input()
	a = str1.split()
	count = 0
	for q in a:
		a[count] = int(a[count])
		count = count + 1
	a.sort(reverse=True)
	ans1 = pq + 1
	for w in a:
		if w > p:
			p = p - 1
			ans1 = ans1 - 1
	ans.append(ans1)
	z = z - 1
	a.clear()
for r in ans:
	print(r)


import math

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

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

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

def invr():
	return map(int, input().split())
t = inp()
while t:
	n = inp()
	a = inlist()
	c = 0
	a = sorted(a, reverse=True)
	target = n
	for i in a:
		if i <= target:
			c += 1
		else:
			target -= 1
	print(c + 1)
	t -= 1


from collections import defaultdict
for _ in range(int(input())):
	n = int(input())
	l = [int(i) for i in input().split()]
	l.sort()
	d = defaultdict(int)
	for i in l:
		d[i] += 1
	key = list(d.keys())
	val = list(d.values())
	cnt = 0
	k = x = 0
	for i in range(len(val)):
		if key[i] <= cnt + val[i] + k:
			cnt = cnt + val[i] + k
			k = 0
		else:
			k += val[i]
	print(cnt + 1)


t = int(input())
while t:
	n = int(input())
	lst = list(map(int, input().split()))
	d = {i: 0 for i in lst}
	for i in lst:
		d[i] += 1
	a = list(d.items())
	cnt = 0
	temp = 0
	asl = 0
	a.sort()
	for i in a:
		if i[0] <= i[1] + cnt:
			cnt += i[1]
			if temp < i[0] and temp != 0:
				temp = 0
			asl = cnt
		else:
			temp = i[0]
			cnt += i[1]
	print(asl + 1)
	t -= 1


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	cnt = n
	arr = sorted(arr)
	arr = [0] + arr
	for i in range(len(arr) - 1, -1, -1):
		if arr[i] > i:
			cnt -= 1
		else:
			print(cnt + 1)
			break


for _ in range(int(input())):
	n = int(input())
	arr = [int(i) for i in input().split()]
	arr.sort()
	p = False
	i = n - 1
	while i >= 0:
		if arr[i] <= i + 1:
			ans = i + 2
			p = True
			break
		i -= 1
	if p:
		print(ans)
	else:
		print(1)


t = int(input())
for cas in range(t):
	n = int(input())
	l = [int(i) for i in input().split()]
	l.sort()
	oknum = 1
	for i in range(n - 1, -1, -1):
		if l[i] <= i + 1:
			oknum = i + 2
			break
	print(oknum)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	s = 1
	ans = 1
	c = 0
	while a:
		k = a.pop(0)
		if s >= k:
			s += 1
			ans += 1 + c
			c = 0
		else:
			s += 1
			c += 1
	print(ans)


t = int(input())
for i in range(t):
	k = 1
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	b = [[a[0], 1]]
	for j in range(1, n):
		if a[j] == b[-1][0]:
			b[-1][1] += 1
		else:
			b.append([a[j], 1])
	j = 0
	while j < len(b):
		if b[j][0] <= k + b[j][1] - 1:
			k += b[j][1]
		elif j < len(b) - 1:
			b[j + 1][1] += b[j][1]
		j += 1
	print(k)


try:
	t = int(input())
	while t:
		n = int(input())
		l = [int(x) for x in input().split()]
		l.sort()
		while True:
			i = len(l)
			if l[i - 1] > i:
				a = l[i - 1]
				l.pop(i - 1)
				if len(l) == 0:
					print(1)
					break
			else:
				print(len(l) + 1)
				break
		t -= 1
except:
	pass


def new_func():
	n = int(input())
	arr = sorted(list(map(int, input().split())))
	for i in reversed(range(n)):
		if i + 1 >= arr[i]:
			print(i + 1 + 1)
			break
	else:
		print(1)
for i in range(int(input())):
	new_func()


for _ in '0' * int(input()):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	i = len(l) - 1
	a = len(l)
	while i >= 0:
		if l[i] > a:
			i -= 1
			a -= 1
		else:
			break
	print(1 + a)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	grp = 1
	toAdd = 0
	cnt = 0
	change = 0
	for i in a:
		if i <= grp + toAdd and change + i - (grp + toAdd) - 1 <= 0:
			grp = grp + toAdd + 1
			change = 0
			toAdd = 0
		else:
			change = i - (grp + toAdd) - 1
			toAdd += 1
	print(grp)


t = int(input())
for _ in range(t):
	n = int(input())
	a = sorted(list(map(int, input().split())))
	cur_gr = 1
	possible_to_add = 0
	for i in range(n):
		if a[i] <= cur_gr + possible_to_add:
			cur_gr += possible_to_add + 1
			possible_to_add = 0
			continue
		possible_to_add += 1
	print(cur_gr)


import os
import sys
import io
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
t = int(input())
for q in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	count = 1
	for i in range(n, 0, -1):
		if a[i - 1] <= i:
			count = i + 1
			break
	print(count)


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().strip().split()))
	a.sort()
	ans = 0
	gl = 1
	for i in range(n):
		if a[i] <= gl:
			ans = i + 1
		gl += 1
	print(ans + 1)


t = int(input())
for _ in range(t):
	n = int(input())
	ls = sorted(map(int, input().split()))
	ans = -1
	for i in range(n):
		if i + 1 >= ls[i]:
			ans = i
	print(ans + 2)


t = int(input())
for i in range(t):
	n = int(input())
	array = [int(s) for s in input().split()]
	array = sorted(array)
	max_ = 0
	for j in range(len(array)):
		if array[j] - 1 < j + 1:
			if j + 1 > max_:
				max_ = j + 1
	print(max_ + 1)


for s in [*open(0)][2::2]:
	a = sorted(map(int, s.split()))
	i = len(a)
	while i and a[i - 1] > i:
		i -= 1
	print(i + 1)


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a1 = sorted(a)
	a1.reverse()
	k = len(a1)
	for i in a1:
		if i > k:
			k = k - 1
			if k == 0:
				print(1)
		else:
			print(k + 1)
			break


t = int(input())
while t > 0:
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	k = 0
	for i in range(n):
		if l[i] <= i + 1:
			k = i + 1
	print(k + 1)
	t -= 1


from collections import defaultdict as dfd
import math
import sys
import heapq

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 main():
	for _ in range(int(input())):
		N = II()
		A = LI()
		val = dfd(int)
		for i in range(N):
			val[A[i]] += 1
		val = sorted(val.items())
		x = 1
		i = 0
		while i < len(val):
			if x + val[i][1] - 1 >= val[i][0]:
				x += val[i][1]
				i += 1
			else:
				j = i
				c = x
				plo = x
				pa = 0
				while j < len(val):
					c += val[j][1] - 1
					if c >= val[j][0]:
						x += c - plo + 1
						plo = x
						i = j
						pa = 1
					c += 1
					j += 1
				break
		print(x)
main()


def main():
	test = int(input())
	for _ in range(test):
		_ = int(input())
		ara = [int(num) for num in input().split()]
		ara.sort()
		ans = 1
		group_size = 0
		for num in ara:
			group_size += 1
			if ans + group_size > num:
				ans += group_size
				group_size = 0
		print(ans)
main()


import sys
input = sys.stdin.readline
for i in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	s = 1
	i = 0
	j = 0
	while j < n and i < n:
		if a[i] <= s:
			s += 1
			i += 1
			j = i
		else:
			S = s
			j = i
			while j < n and a[j] > S:
				S += 1
				j += 1
				i = j
			if j < n:
				if S >= a[j]:
					s = S
	print(s)


T = int(input())
for j in range(T):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	total = 1
	buffer = 0
	for i in l:
		if i <= total:
			total += 1
		elif i <= total + buffer:
			total = total + buffer + 1
			buffer = 0
		else:
			buffer += 1
	print(total)


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	output = 1
	b = 1
	for i in sorted(a):
		if b >= i:
			output = b + 1
		b += 1
	print(output)


t = int(input())
answer = []
for kek in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	ans = 1
	for i in range(n):
		if a[i] <= i + 1:
			ans = i + 2
	answer.append(ans)
print(*answer, sep='\n')


for tc in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	g = [0] + l
	g.sort()
	for i in range(n, -1, -1):
		if g[i] <= i:
			break
	print(i + 1)


cases = int(input())
for i in range(cases):
	count = 1
	input()
	gran = [int(i) for i in input().split(' ')]
	gran.sort()
	on_hold = 0
	for i in gran:
		if count >= i:
			count = count + 1
		elif on_hold + count >= i:
			count = count + on_hold + 1
			on_hold = 0
		else:
			on_hold = on_hold + 1
	print(count)


for i in range(int(input())):
	n = int(input())
	lst = sorted([int(x) for x in input().split()])
	i = n - 1
	while lst[i] > i + 1 and i >= 0:
		i -= 1
	print(i + 2)


import math
k = int(input())
a = []
for i in range(0, k):
	n = int(input())
	b = [int(x) for x in input().split()]
	a.append(b)
for i in a:
	grannies_num = 1
	number_count = 1
	i.sort()
	for j in range(len(i)):
		if number_count + grannies_num > i[j]:
			grannies_num += number_count
			number_count = 1
		else:
			number_count += 1
	print(grannies_num)


from sys import stdin
t = int(stdin.readline())
for _ in range(t):
	n = int(stdin.readline())
	l = list(map(int, stdin.readline().split()))
	l = sorted(l)
	ind = len(l)
	for i in range(ind - 1, -1, -1):
		if l[i] > i + 1:
			del l[i]
		else:
			break
	print(len(l) + 1)


t = int(input())
for test in range(t):
	n = int(input())
	arr = [int(x) for x in input().split()]
	arr.sort()
	ppl = 1
	lasti = 1
	i = 0
	while i < n:
		if arr[i] <= ppl:
			ppl += 1
			lasti = ppl
		else:
			ppl += 1
		i += 1
	print(lasti)


T = int(input())
for i in range(T):
	n = int(input())
	ls = [int(i) for i in input().split()]
	ls.sort()
	count = 1
	revCount = 0
	for l in range(n):
		if ls[l] <= count + revCount:
			count = count + 1 + revCount
			revCount = 0
		else:
			revCount += 1
	print(count)


def rnum():
	return int(input())

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

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

def solve():
	n = rnum()
	mas = rlist()
	mas = sorted(mas)
	ans = 0
	for i in range(n):
		if mas[i] <= i + 1:
			ans = i + 1
	print(ans + 1)

def main():
	t = rnum()
	for i in range(t):
		solve()
main()


import sys
from os import path
if path.exists('C:/Users/prana/Desktop/sublime/input.txt'):
	sys.stdin = open('C:/Users/prana/Desktop/sublime/input.txt', 'r')
	sys.stdout = open('C:/Users/prana/Desktop/sublime/output.txt', 'w')

def solve():
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	b = [i for i in range(1, n + 1)]
	temp = 1
	count = 1
	i = n - 1
	print(a, file=sys.stderr)
	print(b, file=sys.stderr)
	while i >= 0:
		if a[i] > i + 1:
			i -= 1
		else:
			break
	print(i + 2)
T = 1
T = int(input())
for _ in range(1, T + 1):
	print('Case #', _, file=sys.stderr)
	solve()


for _ in range(int(input())):
	n = int(input())
	l = list(input().split(' '))
	for i in range(len(l)):
		l[i] = int(l[i])
	l.sort()
	while n > 0:
		n = n - 1
		if l[n] <= n + 1:
			break
		else:
			l.pop()
	print(len(l) + 1)


import sys
import heapq

def main():
	t = int(input())
	for _ in range(t):
		n = int(sys.stdin.readline().strip())
		nums = list(map(int, sys.stdin.readline().split()))
		nums.sort()
		ans = 1
		temp = 0
		for i in range(n):
			if nums[i] <= ans + temp:
				ans += temp + 1
				temp = 0
			else:
				temp += 1
		print(ans)
	return
main()


import math
t = int(input())
while t > 0:
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	ans = 0
	for i in range(n):
		if l[i] <= i + 1:
			ans = i + 1
	ans += 1
	if n == 3999:
		print('-1')
	print(ans)
	t -= 1


from bisect import bisect_left, bisect_right
for _ in range(int(input())):
	input()
	gr = [int(i) for i in input().split()]
	gr.sort()
	cont = 1
	ini = 0
	busca = 0
	while busca < len(gr):
		fim = bisect_right(gr, gr[busca])
		qnt = fim - ini
		if cont + qnt - 1 >= gr[fim - 1]:
			cont += qnt
			ini = fim
		busca = fim
	print(cont)


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	x = {}
	for i in l:
		if i not in x:
			x[i] = 1
		else:
			x[i] += 1
	p = list(x.keys())
	p.sort()
	y = len(p)
	i = 0
	g = 1
	h = 0
	while i < y:
		if g + x[p[i]] + h - 1 >= p[i]:
			g = g + x[p[i]] + h
			h = 0
		else:
			h += x[p[i]]
		i += 1
	print(g)


import math
import sys
input = sys.stdin.readline
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	prev = 1
	k = 1
	ans = 1
	for (i, v) in enumerate(sorted(a)):
		if v <= i + 1:
			ans = i + 2
	print(ans)


import math
import sys
import collections
from collections import defaultdict
sys.setrecursionlimit(10 ** 9)
for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	cnt = 1
	i = 0
	while i < n:
		if arr[i] <= cnt:
			cnt += 1
			i += 1
		elif i < n - 1:
			val = cnt
			flag = 0
			for j in range(i, n):
				if val >= arr[j]:
					flag = 1
					break
				else:
					val += 1
			if flag == 1:
				cnt = val
			i = j
		else:
			break
	print(cnt)


def solve():
	n = int(input())
	grn = list(map(int, input().split()))
	grn.sort()
	idx = 0
	part = 1
	while idx < n:
		if grn[idx] <= part:
			part += 1
			idx += 1
		else:
			temp_p = part
			while idx < n and grn[idx] > temp_p:
				idx += 1
				temp_p += 1
			if idx == n:
				print(part)
				return
			part = temp_p
	print(part)
t = int(input())
for _ in range(t):
	solve()


tc = int(input())

def solve(arr, n):
	while n < arr[-1]:
		arr.pop()
		n -= 1
		if arr == []:
			return 1
	return n + 1
for _ in range(tc):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	print(solve(arr, n))


t = int(input())
for j in range(t):
	c = 0
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	for j in range(n):
		if arr[j] <= j + 1:
			c = j + 1
	print(c + 1)


t = int(input())
for z in range(0, t):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	count = 1
	a = count
	for i in l:
		a += 1
		if a > i:
			count = a
	print(count)


n = int(input())
for i in range(n):
	a = int(input())
	b = list(map(int, input().split()))
	b.sort()
	s = 1
	l = []
	for i in range(a - 1, -1, -1):
		if b[i] <= i + 1:
			print(i + 2)
			s = 0
			break
	if s == 1:
		print(1)


t = int(input())
for _ in range(t):
	n = int(input())
	bab = list(map(int, input().split()))
	bab.sort(reverse=True)
	count_bab = 0
	while count_bab < n:
		if bab[count_bab] <= n - count_bab:
			print(n - count_bab + 1)
			break
		else:
			count_bab += 1
		if count_bab == n:
			print(1)


t = int(input())
for tcase in range(t):
	n = input()
	l = list(map(int, input().split()))
	l.sort(reverse=True)
	i = 0
	while i in range(len(l)):
		if l[i] > len(l):
			del l[i]
			i -= 1
		i += 1
	print(1 + len(l))


from collections import deque
from collections import OrderedDict
import math
import sys
import os
from io import BytesIO
import threading
import bisect
import heapq
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')
input = sys.stdin.readline
ara = [0] * 100005
listOdd = list()

def aratosfen():
	global ara
	for i in range(2, int(math.sqrt(len(ara)))):
		if ara[i] == 0:
			for j in range(i * 2, len(ara), i):
				ara[j] = 1
	global listOdd
	for i in range(2, len(ara)):
		if ara[i] == 0:
			listOdd.append(i)
aratosfen()
for t in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	arr = arr[::-1]
	answer = n + 1
	tn = n
	for i in range(n):
		if arr[i] <= tn:
			break
		else:
			answer -= 1
			tn -= 1
	print(answer)


for i in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	ans = 1
	k = 1
	for j in arr:
		if j <= ans:
			ans += 1
			k += 1
			continue
		if j <= k:
			ans = k + 1
			k += 1
		else:
			k += 1
	print(ans)


t = int(input())
while t:
	t -= 1
	input()
	data = sorted(list(map(int, input().split())))
	count = 0
	for i in range(len(data)):
		if i + 1 >= data[i]:
			count = i + 1
	print(1 + count)


t = int(input())
while t:
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	mx = 1
	c = 0
	for i in range(len(a)):
		if a[i] <= mx + c:
			mx += c + 1
			c = 0
		else:
			c += 1
	print(mx)
	t -= 1


for _ in range(int(input())):
	n = int(input())
	ar = list(map(int, input().split()))
	ar.sort()
	z = 1
	for i in range(n - 1, -1, -1):
		if ar[i] <= i + 1:
			z = 0
			print(i + 2)
			break
	if z:
		print(1)


import sys
t = int(sys.stdin.readline())
while t:
	n = int(sys.stdin.readline())
	arr = sorted(list(map(int, sys.stdin.readline().split())))
	count = 0
	for i in range(len(arr)):
		if i + 1 >= arr[i]:
			count = i + 1
	print(max(1, count + 1))
	t -= 1


t = int(input())
for dud in range(t):
	n = int(input())
	arr = [int(x) for x in input().split()]
	arr.sort()
	for i in range(len(arr) - 1, -1, -1):
		if i + 1 >= arr[i]:
			print(i + 2)
			break
		if i == 0:
			print(1)


def solve():
	n = int(input())
	a = sorted(map(int, input().split()))
	for i in range(n - 1, -1, -1):
		if a[i] <= i + 1:
			print(i + 2)
			return
	print(1)
n = int(input())
while n:
	solve()
	n -= 1


for _ in range(int(input())):
	n = int(input())
	list1 = list(map(int, input().split()))
	list1.sort()
	count = 1
	cnt = 0
	for i in list1:
		if i <= count:
			count += 1
		elif cnt != 0:
			if cnt + count >= i:
				count += cnt + 1
				cnt = 0
			else:
				cnt += 1
		else:
			cnt = 1
	print(count)


t = int(input())
import bisect
for _ in range(t):
	n = int(input())
	arr = sorted([int(x) for x in input().split()])
	ans = 1
	for i in range(n - 1, -1, -1):
		if arr[i] <= i + 1:
			ans = i + 2
			break
	print(ans)


import sys

def ints():
	return list(map(int, sys.stdin.readline().strip().split()))
tc = int(input())
while tc:
	tc -= 1
	n = int(input())
	ls = ints()
	ls.sort()
	ans = 1
	temp = 1
	for item in ls:
		if item <= temp:
			ans = temp + 1
		temp += 1
	print(ans)


for _ in range(int(input())):
	n = int(input())
	arr = sorted(map(int, input().strip().split()))
	i = 0
	curr = 1
	while i < n:
		j = i
		found = False
		while j < n:
			req = arr[j]
			if curr + j - i >= req:
				curr += j - i + 1
				i = j + 1
				found = True
				break
			j = j + 1
		if not found:
			break
	print(curr)


import sys
for t in range(int(input())):
	res = 0
	n = int(sys.stdin.readline().strip())
	s = list(map(int, sys.stdin.readline().strip().split()))
	s.sort()
	for i in range(n):
		if s[i] <= i + 1:
			res = i + 1
	sys.stdout.write(str(res + 1) + '\n')


from collections import Counter

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

def read_ints():
	return map(int, input().split(' '))
t = read_int()
for case_num in range(t):
	n = read_int()
	a = list(read_ints())
	cnt = Counter(a)
	tot = 1
	ans = 1
	for i in range(1, n + 1):
		if not i in cnt:
			continue
		tot += cnt[i]
		if tot - 1 >= i:
			ans = tot
	print(ans)


import math
t = int(input())
for u in range(t):
	n = int(input())
	a = list(sorted(list(map(int, input().split()))))
	cnt = 1
	for i in range(n):
		if a[i] <= i + 1:
			cnt = i + 2
	print(cnt)


import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	flag = False
	for i in range(n - 1, -1, -1):
		if a[i] <= i + 1:
			flag = True
			print(2 + i)
			break
	if not flag:
		print(1)


def solve(n, a):
	a.sort()
	(i, sol) = (0, 1)
	while i < n:
		curr = 0
		while i < n and sol + curr < a[i]:
			curr += 1
			i += 1
		if i < n and sol + curr >= a[i]:
			sol += curr + 1
		else:
			break
		i += 1
	return sol
t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	print(solve(n, a))


from sys import stdin
from math import ceil, log
input = stdin.readline

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

def sep_input():
	return map(int, input().split())
for _ in range(int(input())):
	n = int(input())
	a = list_input()
	c = 1
	a.sort()
	temp = 0
	for i in range(n):
		if a[i] <= c + temp:
			c += 1 + temp
			temp = 0
		else:
			temp += 1
	print(c)


import sys
file_name = ''
if file_name:
	f = open(file_name, 'r')
else:
	f = sys.stdin
line = f.readline()
t = int(line)
for _ in range(t):
	line = f.readline()
	n = int(line)
	a = [int(x) for x in f.readline().split()]
	a.sort()
	while a and a[-1] > n:
		n -= 1
		a.pop()
	print(n + 1)


T = int(input())
for i in range(T):
	n = int(input())
	A = list(map(int, input().split()))
	A.sort()
	prev = -1
	count = 0
	for i in range(n):
		if A[i] - 1 <= i:
			count += i - prev
			prev = i
	if count == 0:
		print(1)
	else:
		print(count + 1)


import sys
import math
import operator as op
from functools import reduce
from collections import deque

def read_line():
	return sys.stdin.readline()[:-1]

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

def read_int_line():
	return [int(v) for v in sys.stdin.readline().split()]

def read_float_line():
	return [float(v) for v in sys.stdin.readline().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 maxSum(arr, n, k):
	if n < k:
		print('Invalid')
		return -1
	res = 0
	for i in range(k):
		res += arr[i]
	curr_sum = res
	for i in range(k, n):
		curr_sum += arr[i] - arr[i - k]
		res = max(res, curr_sum)
	return res
t = read_int()
for i in range(t):
	n = read_int()
	a = read_int_line()
	a.sort()
	ans = 1
	i = n - 1
	while i >= 0:
		if a[i] <= ans + i:
			ans += i + 1
			break
		else:
			i -= 1
	print(ans)


t = int(input())
for case in range(1, t + 1):
	n = int(input())
	a = [int(x) for x in input().split()]
	a.sort()
	ans = 1
	hope = 1
	for (i, granny) in enumerate(a):
		if hope < granny:
			hope += 1
		else:
			hope += 1
			ans = hope
	print(ans)


import sys
import math
import random
input = sys.stdin.readline

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

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

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

def invr():
	return map(int, input().split())
t = inp()
for _ in range(t):
	n = inp()
	ara = inara()
	ara.sort()
	ans = 0
	for i in range(0, n):
		if i + 1 >= ara[i]:
			ans = max(ans, i + 1)
	ans += 1
	print(ans)


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	ans = 0
	for i in range(n):
		if l[i] <= i + 1:
			ans = i + 1
	print(ans + 1)


t = int(input())
ans = []
for k in range(t):
	n = int(input())
	l = [0] + sorted([int(i) for i in input().split()])
	maxi = 0
	for i in range(1, len(l)):
		if l[i] <= i:
			maxi = i
	ans.append(maxi + 1)
for i in ans:
	print(i)


def f(n, a):
	x = a
	x.sort()
	for i in range(1, n + 1):
		j = n - i
		if x[j] <= j + 1:
			return j + 2
	return 1
t = int(input())
for i in range(t):
	n = int(input())
	aStr = input().rstrip().split()
	a = [int(i) for i in aStr]
	print(f(n, a))


from collections import Counter
for _ in range(int(input())):
	n = int(input())
	grannies = list(map(int, input().split()))
	grannies.sort()
	grannycount = Counter(grannies)
	garden = 1
	maxgrannies = 1
	for granny in grannycount:
		garden += grannycount[granny]
		if granny < garden:
			maxgrannies = garden
	print(maxgrannies)


def solve(size, array):
	array.sort()
	required_grannies = []
	for i in range(0, size, 1):
		if array[i] - (i + 1) > 0:
			required_grannies.append(array[i] - (i + 1))
		else:
			required_grannies.append(0)
	grannies = 0
	for i in range(size - 1, -1, -1):
		if required_grannies[i] == 0:
			grannies = i + 1
			break
	print(grannies + 1)
testCases = int(input())
while testCases:
	N = int(input())
	A = [int(x) for x in input().split()]
	solve(N, A)
	testCases -= 1


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	ans = 1
	i = 0
	while i < len(a):
		if ans >= a[i]:
			i += 1
			ans += 1
			continue
		j = i
		sm = 1
		while j < n and ans + sm <= a[j]:
			j += 1
			sm += 1
		if j == len(a):
			break
		else:
			i = j
			ans += sm
		i += 1
	print(ans)


for i in range(int(input())):
	n = int(input())
	x = list(map(int, input().split()))
	x.sort()
	c = 1
	for j in range(n):
		if j + 1 >= x[j]:
			c = j + 2
	print(c)


t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	for i in range(n - 1, -1, -1):
		if i + 1 >= l[i]:
			break
	else:
		i -= 1
	print(i + 2)


T = int(input())
for _ in range(T):
	n = int(input())
	li = list(map(int, input().split()))
	f = 0
	li.sort()
	for i in range(n - 1, -1, -1):
		if li[i] <= i + 1:
			f = 1
			print(i + 2)
			break
	if f == 0:
		print(1)


def answer(n, ary):
	ary.sort(reverse=True)
	tgt = n
	sum = 1
	for i in range(n):
		if ary[i] <= tgt:
			sum += tgt
			return sum
		else:
			tgt -= 1
	return sum

def main():
	t = int(input())
	n = [0] * t
	ary = [0] * t
	for j in range(t):
		n[j] = int(input())
		ary[j] = [int(i) for i in input().split()]
	for j in range(t):
		print(answer(n[j], ary[j]))
main()


import math
t = int(input())
for _ in range(t):
	n = int(input())
	gs = [int(s) for s in input().split()]
	gs.sort()
	g = 1
	w = 0
	for a in gs:
		if g + w >= a:
			g += w + 1
			w = 0
		else:
			w += 1
	print(g)


import collections

def solve(n, arr):
	arr.sort()
	ans = 1
	(i, n) = (0, len(arr))
	while i < n:
		val = arr[i]
		if val <= ans:
			ans += 1
		else:
			(j, currVal) = (i, ans)
			while j < n and arr[j] > currVal:
				currVal += 1
				j += 1
			if j >= n and currVal > arr[j - 1] or (j < n and currVal >= arr[j]):
				ans += j - i
			else:
				break
			i = j
			continue
		i += 1
	return ans
t = int(input().strip())
for i in range(t):
	n = int(input().strip())
	arr = list(map(int, input().strip().split()))
	print(solve(n, arr))


import sys
import heapq
import re
from itertools import permutations
from bisect import bisect_left, bisect_right
from collections import Counter, deque
from fractions import gcd
from math import factorial, sqrt, ceil, log2, fabs
from functools import lru_cache, reduce
import math
INF = 1 << 60
MOD = 1000000007
sys.setrecursionlimit(10 ** 7)

class UnionFind:

	def __init__(self, n):
		self.n = n
		self.parents = [-1] * n

	def find(self, x):
		if self.parents[x] < 0:
			return x
		else:
			self.parents[x] = self.find(self.parents[x])
			return self.parents[x]

	def union(self, x, y):
		x = self.find(x)
		y = self.find(y)
		if x == y:
			return
		if self.parents[x] > self.parents[y]:
			(x, y) = (y, x)
		self.parents[x] += self.parents[y]
		self.parents[y] = x

	def size(self, x):
		return -self.parents[self.find(x)]

	def same(self, x, y):
		return self.find(x) == self.find(y)

	def members(self, x):
		root = self.find(x)
		return [i for i in range(self.n) if self.find(i) == root]

	def roots(self):
		return [i for (i, x) in enumerate(self.parents) if x < 0]

	def group_count(self):
		return len(self.roots())

	def all_group_members(self):
		return {r: self.members(r) for r in self.roots()}

	def __str__(self):
		return '\n'.join(('{}: {}'.format(r, self.members(r)) for r in self.roots()))

def is_prime(n):
	if n == 1:
		return False
	for i in range(2, int(n ** 0.5) + 1):
		if n % i == 0:
			return False
	return True

def warshall_floyd(d, n):
	for k in range(n):
		for i in range(n):
			for j in range(n):
				d[i][j] = min(d[i][j], d[i][k] + d[k][j])
	return d

def dijkstra_heap(s, edge, n):
	d = [10 ** 20] * n
	used = [True] * n
	d[s] = 0
	used[s] = False
	edgelist = []
	for (a, b) in edge[s]:
		heapq.heappush(edgelist, a * 10 ** 6 + b)
	while len(edgelist):
		minedge = heapq.heappop(edgelist)
		if not used[minedge % 10 ** 6]:
			continue
		v = minedge % 10 ** 6
		d[v] = minedge // 10 ** 6
		used[v] = False
		for e in edge[v]:
			if used[e[1]]:
				heapq.heappush(edgelist, (e[0] + d[v]) * 10 ** 6 + e[1])
	return d

def factorization(n):
	arr = []
	temp = n
	for i in range(2, int(-(-n ** 0.5 // 1)) + 1):
		if temp % i == 0:
			cnt = 0
			while temp % i == 0:
				cnt += 1
				temp //= i
			arr.append([i, cnt])
	if temp != 1:
		arr.append([temp, 1])
	if arr == []:
		arr.append([n, 1])
	return arr

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

def lcm_list(numbers):
	return reduce(lcm, numbers, 1)

def gcd_list(numbers):
	return reduce(gcd, numbers)

def eratosthenes(limit):
	A = [i for i in range(2, limit + 1)]
	P = []
	while True:
		prime = min(A)
		if prime > sqrt(limit):
			break
		P.append(prime)
		i = 0
		while i < len(A):
			if A[i] % prime == 0:
				A.pop(i)
				continue
			i += 1
	for a in A:
		P.append(a)
	return P

def permutation_with_duplicates(L):
	if L == []:
		return [[]]
	else:
		ret = []
		S = sorted(set(L))
		for i in S:
			data = L[:]
			data.remove(i)
			for j in permutation_with_duplicates(data):
				ret.append([i] + j)
		return ret

def check(a, b, c, d, m):
	if a * m ** 3 + b * m ** 2 + c * m + d == 0:
		return True
	else:
		return False

def f1(a, b, c, d):
	l = -1001
	h = 1000
	eps = 10 ** (-6)
	while fabs(l - h) > eps:
		m = (l + h) / 2
		if a * m ** 3 + b * m ** 2 + c * m + d > 0:
			l = m
		elif a * m ** 3 + b * m ** 2 + c * m + d == 0:
			return m
		else:
			h = m
	return l

def f(a, b, c, d):
	l = -1001
	h = 1000
	eps = 10 ** (-6)
	a = False
	b = False
	while fabs(l - h) > eps:
		m = (l + h) / 2
		if a * m ** 3 + b * m ** 2 + c * m + d < 0:
			a = True
			l = m
		elif a * m ** 3 + b * m ** 2 + c * m + d == 0:
			return m
		else:
			h = m
			b = True
		if a and b:
			return m
	return l

def BinarySearch(a, x):
	i = bisect_left(a, x)
	if i:
		return i - 1
	else:
		return -1

def BinarySearch1(a, x):
	i = bisect_right(a, x)
	if i != len(a) + 1 and a[i - 1] == x:
		return i - 1
	else:
		return -1
t = int(input())
for i in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	a = 1
	for i in range(n):
		if l[i] <= i + 1:
			a = max(a, i + 2)
	print(a)


for cas in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	ans = 0
	a.sort()
	for i in range(n):
		if a[i] <= i + 1:
			ans = i + 1
	print(ans + 1)


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	hm = {}
	for c in arr:
		if c in hm:
			hm[c] += 1
		else:
			hm[c] = 1
	ans = 1
	temp = 0
	for (k, v) in hm.items():
		temp += v
		if ans + temp - 1 >= k:
			ans += temp
			temp = 0
	print(ans)


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	res = 0
	for i in range(n):
		if i + 1 >= a[i]:
			res = i + 1
	print(res + 1)


for _ in range(int(input())):
	n = int(input())
	arr = [int(i) for i in input().split()]
	arr.sort()
	d = dict()
	for i in arr:
		if i not in d:
			d[i] = 1
		else:
			d[i] += 1
	c = 0
	x = 1
	i = 0
	while i < n:
		if x + c + d[arr[i]] - 1 >= arr[i]:
			x += d[arr[i]] + c
			i += d[arr[i]]
			c = 0
		else:
			c += d[arr[i]]
			i += d[arr[i]]
	print(x)


def main():
	t = int(input())
	for _ in range(t):
		_ = int(input())
		a = list(map(int, input().split()))
		a.sort()
		l = [i for (i, x) in enumerate(a) if i + 1 >= x]
		ans = 0
		if len(l) > 0:
			ans = l[-1] + 1
		print(ans + 1)
main()


ans = ''
for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	p = 1
	for i in range(n):
		if arr[i] <= i + 1:
			p = i + 2
	print(p)


import bisect

def solve(a, n):
	low = 0
	high = n - 1
	current = 1
	a.sort()
	max_element = sum(a) + 1
	i = current
	while i <= n:
		ndx = bisect.bisect_right(a, i, low, -1)
		e = ndx - low - 1
		if e + current >= i:
			current += ndx - low
			low = ndx
		i += 1
	print(current)

def read():
	t = int(input())
	for i in range(t):
		n = int(input())
		a = list(map(int, input().split()))
		solve(a, n)
read()


for __ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	r = 1
	c = 0
	a = []
	for i in range(n):
		if l[i] <= r:
			c = i + 1
		r += 1
	c = c + 1
	print(c)


from collections import Counter
t = int(input())
for _ in range(t):
	n = int(input())
	fools = list(map(int, input().split()))
	fools.sort()
	fools = dict(Counter(fools))
	curr = 1
	count = 0
	for i in fools:
		if i <= fools[i] + curr - 1 + count:
			curr += fools[i] + count
			count = 0
		else:
			count += fools[i]
	print(curr)


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())
for _ in range(inp()):
	len_ = inp()
	list_ = sorted(inlt(), reverse=True)
	for idx in range(len_):
		if list_[idx] <= len_ - idx:
			print(len_ - idx + 1)
			break
	else:
		print(1)


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().strip().split()))[:n]
	granny = 1
	temp = 1
	a.sort()
	for j in range(n - 1, -1, -1):
		temp = j + 1
		if temp >= a[j]:
			granny = temp + 1
			break
	print(granny)


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().strip().split()))
	arr.sort()
	c = 1
	c1 = 0
	for i in range(0, n):
		if c >= arr[i]:
			c = c + 1
			c1 = 0
		else:
			c1 += 1
			c += 1
	print(c - c1)


from collections import defaultdict
from collections import OrderedDict
from collections import deque
from itertools import combinations
from itertools import permutations
import bisect
import math
import heapq
import sys
import io, os
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
for ii in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	dic = defaultdict(int)
	for i in range(n):
		dic[arr[i]] += 1
	curr = 1
	extra = 0
	for (k, v) in dic.items():
		if k <= curr + v + extra - 1:
			curr += v + extra
			extra = 0
		else:
			extra += v
	print(curr)


import sys
from collections import defaultdict as dd
import heapq
import math
try:
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
except:
	pass
input = sys.stdin.readline
for i in range(int(input())):
	q = int(input())
	a = list(map(int, input().split()))
	a = sorted(a)
	l = 0
	j = 0
	for i in range(q):
		if i + 1 >= a[i]:
			l = i + 1
	print(l + 1)


for case in range(int(input())):
	n = int(input())
	series = [int(x) for x in input().split()]
	series.sort()
	ans = 1
	for i in range(1, n + 1):
		if series[i - 1] <= i:
			ans = i + 1
	print(ans)


for _ in range(int(input())):
	n = int(input())
	l = [int(x) for x in input().split()]
	l.sort(reverse=True)
	c = 0
	for i in range(n):
		if l[i] <= n - i:
			print(n - i + 1)
			c = 1
			break
	if c == 0:
		print(1)


from __future__ import division, print_function
import itertools
import sys
import os
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
	input = raw_input
	range = xrange
	filter = itertools.ifilter
	map = itertools.imap
	zip = itertools.izip

def is_it_local():
	script_dir = str(os.getcwd()).split('/')
	username = 'dipta007'
	return username in script_dir

def READ(fileName):
	if is_it_local():
		sys.stdin = open(f'./{fileName}', 'r')
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 not is_it_local():
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
	input = lambda : sys.stdin.readline().rstrip('\r\n')

def input1(type=int):
	return type(input())

def input2(type=int):
	[a, b] = list(map(type, input().split()))
	return (a, b)

def input3(type=int):
	[a, b, c] = list(map(type, input().split()))
	return (a, b, c)

def input_array(type=int):
	return list(map(type, input().split()))

def input_string():
	s = input()
	return list(s)

def main():
	t = input1()
	for ci in range(t):
		n = input1()
		ar = input_array()
		ar.sort()
		granny = 1
		past = 0
		cnt = 0
		for v in ar:
			if granny + cnt >= v:
				granny += cnt + 1
				cnt = 0
			else:
				cnt += 1
		print(granny)
	pass
READ('in.txt')
main()


T = int(input())
for _ in range(T):
	N = int(input())
	A = list(map(int, input().split()))
	A.sort()
	for (i, a) in reversed(list(enumerate(A))):
		if i + 1 >= a:
			print(i + 2)
			break
	else:
		print(1)


for _ in range(int(input())):
	n = int(input())
	arr = sorted([int(i) for i in input().split()])
	temp = 0
	for i in range(n):
		if arr[i] <= i + 1:
			temp = i + 1
	print(temp + 1)


t = []
testCases = int(input())
for test in range(testCases):
	numberOfGrannies = int(input())
	grannies = list()
	grannies = map(lambda x: int(x), input().split(' '))
	grannies = sorted(grannies)
	num = 1
	ans = 0
	for i in range(len(grannies)):
		num += 1
		if num > grannies[i]:
			ans = num
	t.append(ans)
for i in range(len(t)):
	if t[i] == 0:
		print('1')
	else:
		print(t[i])


inp = input
for _ in range(int(inp())):
	n = int(inp())
	arr = list(map(int, inp().strip().split(' ')))
	arr.sort()
	cntr = []
	i = 0
	while i < n:
		cur = arr[i]
		cnt = 1
		i += 1
		while i < n and cur == arr[i]:
			i += 1
			cnt += 1
		cntr.append((cur, cnt))
	ans = 1
	cur = 1
	i = 0
	ln = len(cntr)
	while cntr:
		(val, cnt) = cntr.pop(0)
		if cnt + cur - 1 >= val:
			cur += cnt
			ans += cnt
		else:
			cur += cnt
			tem = cnt
			while cntr:
				(val, cnt) = cntr.pop(0)
				if cnt + cur - 1 >= val:
					cur += cnt
					ans += cnt + tem
					break
				else:
					cur += cnt
					tem += cnt
	print(ans)


for i in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	count = n
	for i in range(n - 1, -1, -1):
		if a[i] > count:
			count -= 1
		else:
			break
	print(count + 1)


for _ in range(int(input())):
	n = int(input())
	_list = list(map(int, input().split()))
	_list.sort()
	count = 1
	_result = 1
	for key in _list:
		count += 1
		if count > key:
			_result = count
	print(_result)


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

def main():
	for _ in range(int(input())):
		n = int(input())
		s = r = 1
		arr = sorted(list(map(int, input().split())))
		c = 0
		for n in arr:
			if n <= s + c:
				r += c + 1
				c = 0
				s = r
			else:
				c += 1
		print(r)
main()


from sys import stdin
input = stdin.readline
for _ in range(int(input())):
	g = int(input())
	s = sorted(map(int, input().split()))
	res = 0
	for (i, c) in enumerate(s):
		if c <= i + 1:
			res = i + 1
	print(res + 1)


t = int(input())
for _ in range(t):
	n = int(input())
	G = sorted(list(map(int, input().split(' '))))
	total = 1
	for i in range(n):
		if i + 1 >= G[i]:
			total = i + 2
	print(total)


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	res = 1
	i = 0
	while i < n:
		if res >= arr[i]:
			res += 1
			i += 1
		else:
			j = i
			temp = res
			while j < n:
				if temp >= arr[j]:
					temp += 1
					break
				else:
					j += 1
					temp += 1
			if j == n:
				break
			res = temp
			i = j + 1
	print(res)


import math
for _ in range(int(input())):
	n = int(input())
	a = [int(i) for i in input().split()]
	a.sort()
	x = 1
	s = 0
	for i in range(n):
		if x >= a[i]:
			x += 1
			s = i + 1
		elif i - s + x >= a[i]:
			x += i - s + 1
			s = i + 1
	print(x)


t = int(input())
while t:
	t = t - 1
	n = int(input())
	l = list(map(int, input().split()))
	l = sorted(l)
	flag = 0
	for w in range(n - 1, -1, -1):
		if l[w] > w + 1:
			continue
		else:
			print(w + 2)
			flag = 1
			break
	if flag == 0:
		print(1)


import collections
t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	v = 1
	a.sort()
	q = []
	for x in a:
		if v + len(q) >= x:
			v += len(q) + 1
			q = []
		else:
			q.append(a)
	print(v)


for i in range(int(input())):
	n = int(input())
	l = sorted(list(map(int, input().split())))
	s = 1
	for i in range(n - 1, -1, -1):
		if i + 1 >= l[i]:
			s = i + 2
			break
	print(s)


import sys
buff_readline = sys.stdin.readline
readline = sys.stdin.readline
INF = 2 ** 62 - 1

def read_int():
	return int(buff_readline())

def read_int_n():
	return list(map(int, buff_readline().split()))

def read_float():
	return float(buff_readline())

def read_float_n():
	return list(map(float, buff_readline().split()))

def read_str():
	return readline().strip()

def read_str_n():
	return readline().strip().split()

def error_print(*args):
	print(*args, file=sys.stderr)

def mt(f):
	import time

	def wrap(*args, **kwargs):
		s = time.time()
		ret = f(*args, **kwargs)
		e = time.time()
		error_print(e - s, 'sec')
		return ret
	return wrap

def slv(N, A):
	A.sort(reverse=True)
	for i in range(N):
		if A[i] <= N - i:
			break
		else:
			pass
	else:
		i += 1
	return N + 1 - i

def main():
	T = read_int()
	for _ in range(T):
		N = read_int()
		A = read_int_n()
		print(slv(N, A))
main()


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	ct = 1
	i = 0
	while i < n:
		if ct >= a[i]:
			ct += 1
		else:
			temp = ct + 1
			fg = 0
			ind = 0
			for j in range(i + 1, n):
				if temp < a[j]:
					temp += 1
				else:
					temp += 1
					ind = j
					fg = 1
					break
			if fg == 1:
				i = j
				ct = temp
			else:
				break
		i += 1
	print(ct)


import sys
ints = (int(x) for x in sys.stdin.read().split())
sys.setrecursionlimit(3000)

def main():
	ntc = next(ints)
	for tc in range(1, ntc + 1):
		n = next(ints)
		a = [next(ints) for i in range(n)]
		a.sort()
		ans = 1 + next((i + 1 for i in range(n - 1, -1, -1) if a[i] <= i + 1), 0)
		print(ans)
	return
main()


import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	out = 1
	for i in range(n):
		if l[i] <= i + 1:
			out = i + 2
	print(out)


def solve(n, d):
	d.sort()
	for i in range(len(d) - 1, -1, -1):
		if d[i] > i + 1:
			continue
		else:
			return i + 2
	return 1

def main():
	t = int(input())
	for i in range(t):
		n = int(input())
		d = input()
		d = [int(i) for i in d.split()]
		ans = solve(n, d)
		print(ans)
main()


for i in range(int(input())):
	n = int(input())
	x = list(map(int, input().split()))
	x.sort()
	g = 1
	for r in range(len(x)):
		if x[r] <= r + 1:
			g = r + 2
	print(g)


def granny(arr):
	max_elem = 0
	n = len(arr)
	arr = sorted(arr, reverse=True)
	k = n
	for i in range(n):
		if arr[i] > k:
			k -= 1
		else:
			break
	return k + 1
t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	print(granny(arr))


def process_test_case(i_t):
	n = int(input())
	a_vec = list(map(int, input().split()))
	a_vec.sort()
	ans = 1
	is_ok = True
	i = 0
	while i < n and is_ok:
		j = 0
		is_possible = a_vec[i] <= ans
		while i + j + 1 < n and (not is_possible):
			j += 1
			is_possible = a_vec[i + j] <= ans + j
		if is_possible:
			ans += j + 1
		else:
			is_ok = False
		i += j + 1
	print(ans)
	return None
n_tests = int(input())
for i_test in range(1, n_tests + 1):
	process_test_case(i_test)


t = int(input())
from math import *
for ab in range(t):
	n = int(input())
	x = list(map(int, input().split()))
	yz = sorted(x)[::-1]
	aq = 0
	ta = False
	while aq < n:
		if yz[aq] <= n - aq:
			print(n - aq + 1)
			ta = True
			break
		else:
			aq += 1
	if not ta:
		print(1)


T = int(input())

def solve():
	N = int(input())
	A = sorted(list(map(int, input().split())))
	ans = 1
	idx = 0
	while idx < len(A):
		if A[idx] <= idx + 1:
			ans = idx + 2
		idx += 1
	print(ans)
for _ in range(T):
	solve()


from sys import stdin

def input():
	return stdin.readline()
for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	i = n - 1
	c = 1
	while i >= 0:
		if arr[i] <= i + 1:
			c = i + 2
			break
		i = i - 1
	print(c)


def merge(arr, l, m, r):
	n1 = m - l + 1
	n2 = r - m
	L = [0] * n1
	R = [0] * n2
	for i in range(0, n1):
		L[i] = arr[l + i]
	for j in range(0, n2):
		R[j] = arr[m + 1 + j]
	i = 0
	j = 0
	k = l
	while i < n1 and j < n2:
		if L[i] <= R[j]:
			arr[k] = L[i]
			i += 1
		else:
			arr[k] = R[j]
			j += 1
		k += 1
	while i < n1:
		arr[k] = L[i]
		i += 1
		k += 1
	while j < n2:
		arr[k] = R[j]
		j += 1
		k += 1

def mergeSort(arr, l, r):
	if l < r:
		m = (l + (r - 1)) // 2
		mergeSort(arr, l, m)
		mergeSort(arr, m + 1, r)
		merge(arr, l, m, r)
t = int(input())
for i in range(t):
	n = int(input())
	num1 = list(map(int, input().split()))
	mergeSort(num1, 0, n - 1)
	a = 1
	b = 1
	queue = []
	for j in range(n):
		queue.append(num1[j])
		while queue and a >= queue[-1]:
			queue.pop(0)
			b += 1
		a += 1
	print(b)


import collections as cc
I = lambda : list(map(int, input().split()))
import sys
input = sys.stdin.readline
(t,) = I()
for tc in range(t):
	(n,) = I()
	l = [0] + sorted(I())
	ann = 0
	r = 0
	v = 1
	for i in range(1, n + 1):
		if l[i - 1] == l[i]:
			v += 1
		elif ann + v + r - 1 >= l[i - 1]:
			ann += v + r
			r = 0
			v = 1
		else:
			r += v
			v = 1
	if ann + v + r - 1 >= l[n]:
		ann += v + r
	print(ann)


import math
from collections import Counter
for _ in range(int(input())):
	n = int(input())
	a = [int(o) for o in input().split()]
	a.sort()
	c = 1
	for i in range(n):
		if a[i] <= i + 1:
			c = i + 2
	print(c)


t = int(input())
for i in range(0, t):
	n = int(input())
	s = input()
	gran1 = []
	gran = s.split(' ')
	for x in gran:
		y = int(x)
		gran1.append(y)
	gran1.sort(reverse=True)
	while gran1[0] > len(gran1):
		gran1.pop(0)
		if len(gran1) == 0:
			break
	print(len(gran1) + 1)


T = int(input())
for _ in range(T):
	N = int(input())
	A = sorted(map(int, input().split()))
	ans = 1
	for (i, elt) in enumerate(A):
		if elt <= i + 1:
			ans = i + 2
	print(ans)


for t in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a1 = sorted(list(set(a)))
	freq = {}
	for i in a:
		if freq.get(i, 0) == 0:
			freq[i] = 1
		else:
			freq[i] += 1
	prev = 1
	ans = 1
	for i in a1:
		if prev + freq[i] - 1 >= i:
			ans = prev + freq[i]
		prev += freq[i]
	print(ans)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	ans = 0
	a.sort()
	curr_cnt = 0
	for val in a:
		curr_cnt += 1
		if val <= curr_cnt:
			ans = curr_cnt
	print(ans + 1)


for t in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	flag = 0
	for j in range(n - 1, -1, -1):
		if l[j] <= j + 1:
			flag = 1
			print(j + 2)
			break
	if flag == 0:
		print(1)


def solve():
	t = int(input())
	while t > 0:
		n = int(input())
		l = list(map(int, input().strip().split()))
		l.sort()
		m = 1
		co = n
		for i in range(n - 1, -1, -1):
			if l[i] > i + 1:
				co -= 1
				continue
			else:
				break
		m = m + co
		print(m)
		t -= 1
solve()


from sys import stdin
a = int(stdin.readline())
for b in range(0, a):
	A = int(stdin.readline())
	B = stdin.readline().split()
	B.sort(key=int)
	record = 1
	for t in range(0, A):
		if int(B[t]) <= 1 + t:
			record = t + 2
	print(record)


for _ in range(int(input())):
	_ = int(input())
	a = list(map(int, input().split()))
	reqd = dict()
	for i in a:
		reqd[i] = reqd.get(i, 0) + 1
	req = [(i, k) for (i, k) in sorted(reqd.items(), key=lambda x: x[0])]
	del a, reqd
	g = 1
	temp = 1
	while req:
		pair = req.pop(0)
		temp += pair[1]
		if pair[0] <= temp - 1:
			g = temp
	print(g)


import sys
from collections import defaultdict as dd

def eprint(*args):
	print(*args, file=sys.stderr)
zz = 1
from math import *
import copy
if zz:
	input = sys.stdin.readline
else:
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('all.txt', 'w')

def li():
	return [int(x) for x in input().split()]

def fi():
	return int(input())

def si():
	return list(input().rstrip())

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

def bo(i):
	return ord(i) - ord('a')
t = fi()
while t > 0:
	t -= 1
	n = fi()
	a = li()
	a.sort()
	c = -1
	maxi = 1
	for i in range(n):
		if a[i] <= i + 1:
			c = i
	print(c + 2)


from sys import stdin, stdout
input = stdin.readline
for t in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	ans = 1
	for i in range(n - 1, -1, -1):
		if a[i] <= i + 1:
			ans = i + 2
			break
	print(ans)


t = int(input())
while t:
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	c = 1
	for i in range(n - 1, -1, -1):
		if l[i] <= i + 1:
			c += i + 1
			break
	print(c)
	t -= 1


from math import pi, sin, cos
T = int(input().strip())
for t in range(T):
	n = int(input())
	a = list(enumerate(sorted(list(map(int, input().split()))[:n]), 1))
	res = 1
	for pair in a[::-1]:
		if pair[1] <= pair[0]:
			res = pair[0] + 1
			break
	print(res)


from sys import stdin
from collections import Counter
N = int(stdin.readline())
for _ in range(N):
	n = int(stdin.readline())
	array = sorted(list(map(int, stdin.readline().split())))
	ans = len(array) + 1
	count = Counter(array)
	for i in sorted(count.keys(), reverse=True):
		if ans > i:
			break
		else:
			ans -= count[i]
	print(ans)


for _ in ' ' * int(input()):
	n = int(input())
	a = sorted(list(map(int, input().split())))
	for i in range(n - 1, -1, -1):
		if a[i] <= i + 1:
			print(i + 2)
			break
	else:
		print(1)


for i in [0] * int(input()):
	a = int(input())
	l = sorted(list(map(int, input().split())))
	for i in l[::-1]:
		if i > a:
			a -= 1
		elif i <= a:
			print(a + 1)
			break
		if a == 0:
			print(1)
			break


import math
from collections import *

def query():
	pass

def solve(n, A):
	A.sort()
	for i in range(len(A) - 1, -1, -1):
		if i + 1 >= A[i]:
			return i + 2
	return 1
t = int(input())
for test_num in range(t):
	n = int(input())
	A = list(map(int, input().split()))
	output_string = solve(n, A)
	print('{}'.format(output_string))


t = int(input())
while t:
	t -= 1
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	c = 1
	x = []
	c = 0
	p = 0
	for i in range(n):
		x.append(l[i])
		p += 1
		if x[-1] <= c + p:
			c += p
			p = 0
			x = []
	print(c + 1)


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()
	ls.sort()
	ava = 1
	ans = 1
	for val in ls:
		if ava >= val:
			ans = ava + 1
		ava += 1
	print(ans)

def main():
	solve()
TestCases = True
if TestCases:
	for i in range(get_int()):
		main()
else:
	main()


n = int(input())
for j in range(n):
	g = 1
	x = int(input())
	a = list(map(int, input().split()))
	a.sort()
	a.reverse()
	for i in range(x):
		if a[i] > x - i - 1 + g:
			pass
		else:
			g = g + 1
	print(g)


ipnl = lambda n: [int(input()) for _ in range(n)]
inp = lambda : int(input())
ip = lambda : [int(w) for w in input().split()]
for _ in range(inp()):
	n = inp()
	x = ip()
	x.sort()
	ans = 1
	for i in range(n - 1, -1, -1):
		if x[i] <= i + 1:
			ans = i + 2
			break
	print(ans)


t = int(input())
for i in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	(total, a, point) = (0, 1, 0)
	if l[len(l) - 1] <= len(l):
		print(len(l) + 1)
		continue
	else:
		for j in range(len(l)):
			if l[j] <= a:
				a += 1
				continue
			elif j > 0 and l[j - 1] <= a - 1:
				total = j
				a += 1
			else:
				a += 1
		if total == 0:
			print(1)
		else:
			print(total + 1)


import math
for _ in range(int(input())):
	n = int(input())
	a = sorted(list(map(int, input().split())))
	cnt = 1
	x = 0
	stop = False
	a.reverse()
	for i in a:
		if n >= i:
			stop = True
			break
		n -= 1
	print(n + 1 if stop == True else 1)


casos = int(input())
for x in range(casos):
	numV = int(input())
	vector = list(map(int, input().split()))
	vector.sort()
	ab = 1
	antAb = -1
	for y in range(numV):
		if ab >= vector[y]:
			antAb = y
		ab += 1
	print(antAb + 2)


for _ in range(int(input())):
	n = int(input())
	a = sorted(list(map(int, input().split())))
	(g, c) = (1, 1)
	for i in range(n):
		if a[i] <= g:
			c = i + 2
		g += 1
	print(c)


for ad in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	c = 0
	s = 0
	d = 0
	x = 0
	for i in range(n):
		d += 1
		x += 1
		if d >= l[i]:
			c += x
			x = 0
	print(c + 1)


for _ in range(int(input())):
	n = int(input())
	ar = list(map(int, input().split()))
	inside = 1
	outside = 0
	p = 0
	ar.sort()
	for i in range(n):
		if inside >= ar[i]:
			p = i + 1
		inside += 1
	print(p + 1)


from sys import stdin, stdout
import sys
from math import *
input = stdin.readline
for __ in range(int(input())):
	n = int(input())
	ar = list(map(int, input().split()))
	ar.sort()
	ans = 1
	for i in range(n):
		if ar[i] <= i + 1:
			ans = i + 1 + 1
	print(ans)


t = int(input())
for x in range(t):
	total = int(input())
	main = sorted(map(int, input().split()))
	while main[-1] > total:
		main.pop()
		total -= 1
		if total == 0:
			break
	print(len(main) + 1)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	dp = [0] * n
	s = 1
	for i in range(n):
		if s + i >= a[i]:
			dp[i] = s + i + 1
	if max(dp) == 0:
		print(1)
	else:
		print(max(dp))


t = int(input())
for i in range(t):
	n = int(input())
	sure = 0
	possible = 0
	needed = 0
	grannies = sorted(list(map(int, input().split())))
	for gran in grannies:
		needed = max(gran, needed)
		possible += 1
		if possible >= needed:
			sure = possible
	print(sure + 1)


import math
for i in range(int(input())):
	n = int(input())
	l = [int(x) for x in input().split()]
	l = sorted(l)
	res = 1
	for j in range(n):
		if l[j] <= j + 1:
			res = j + 2
	print(res)


for _ in range(int(input())):
	n = int(input())
	arr = sorted(list(map(int, input().split())))
	(count, temp) = (1, 1)
	j = 0
	for i in range(n):
		if arr[i] <= temp:
			count += temp - j
			temp = count
			j = i + 1
		else:
			temp += 1
	print(count)


from sys import stdin, stdout
input = lambda : stdin.readline().strip()
fast_print = stdout.write
from math import sqrt, floor
from bisect import bisect_right
T = int(input())
for _ in range(T):
	n = int(input())
	ls = list(map(int, input().split()))
	ls.sort()
	for i in range(n - 1, -1, -1):
		if i + 1 >= ls[i]:
			fast_print(str(i + 2) + '\n')
			break
	else:
		fast_print(str(1) + '\n')


t = int(input())
for i in range(t):
	n = int(input())
	array = list(map(int, input().rstrip().split()))
	array.sort()
	for i in range(n - 1, -1, -1):
		if 1 + i >= array[i]:
			print(i + 2)
			break
	else:
		print(1)


for cases in range(int(input())):
	n = int(input())
	lst = list(map(int, input().split()))
	count = n + 1
	lst.sort()
	for i in range(n - 1, -1, -1):
		if lst[i] > count - 1:
			count -= 1
		else:
			continue
	print(count)


import sys
import os
import heapq
import math
try:
	path = './file/input.txt'
	if os.path.exists(path):
		sys.stdin = open(path, 'r')
except:
	pass
t = int(input())

def printd(value):
	pass
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split(' ')))
	a.sort()
	result = 0
	for (index, number) in enumerate(a):
		count = index + 1
		if count >= number:
			result = count
	print(result + 1)


import math
t = int(input())
for j in range(t):
	x = 1
	n = int(input())
	a = list(map(int, input().split()))
	a = sorted(a)
	for i in range(n):
		if i + 1 >= a[i]:
			x = i + 1 + 1
	print(x)


for j in range(int(input())):
	m = int(input())
	s = list(map(int, input().split()))
	s.sort()
	l = 1
	for i in range(m):
		if s[i] <= i + 1:
			l = i + 2
	print(l)


import os
import sys
import io
import math
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
for t in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort(reverse=True)
	answer = 1
	i = 0
	while i < n:
		if a[i] > n:
			i += 1
		else:
			if a[i] <= n - i:
				answer += n - i
				break
			i += 1
	print(answer)


t = int(input())
for x in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	c = 1
	f = True
	temp = False
	while f:
		for i in range(len(l)):
			if l[i] <= i + c:
				temp = True
				if i == len(l) - 1:
					l = []
					c += i + 1
					f = False
					break
				continue
			elif temp:
				c += i
				l = l[i:]
				break
			else:
				if i == len(l) - 1:
					f = False
					break
				continue
		temp = False
	print(c)


from math import factorial as lol

def ch():
	pass
t = int(input())
for u in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	x = 0
	for i in range(len(l) - 1, -1, -1):
		if l[i] > n - x:
			x += 1
	print(n - x + 1)


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	per = 1
	wait = 0
	for i in l:
		if i <= per + wait:
			per += 1 + wait
			wait = 0
		else:
			wait += 1
	if l[-1] <= per + wait - 1:
		per += wait
	print(per)


def call(values):
	count = 0
	for i in range(len(values)):
		if values[i] <= 1 + i:
			count = i + 1
	return count

def main():
	t = int(input())
	for i in range(t):
		n = int(input())
		values = list(map(int, input().split()))
		values.sort()
		print(call(values) + 1)
main()


def f(al):
	al.sort()
	curr = 0
	i = 0
	while i < len(al):
		if al[i] <= curr + 1:
			curr = curr + 1
		else:
			j = i
			ct = curr
			while j < len(al) and al[j] > ct + 1:
				ct = ct + 1
				j = j + 1
			if j == len(al):
				return curr + 1
			curr = curr + j - i + 1
			i = j
		i = i + 1
	return curr + 1
for tc in range(int(input())):
	temp = int(input())
	ll = list(map(int, input().split()))
	print(f(ll))


t = int(input())
for test in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	rem = 0
	pre = 1
	for i in range(n):
		if pre >= a[i]:
			pre += 1
		elif pre + rem >= a[i]:
			pre += rem + 1
			rem = 0
		else:
			rem += 1
	print(pre)


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort(reverse=True)
	a = b = len(arr)
	for i in range(a):
		if i == a - 1 and arr[i] > 1:
			print(1)
		if arr[i] <= b:
			print(b + 1)
			break
		else:
			b = b - 1


ans = []
t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().strip().split()))[:n]
	a.sort()
	j = n
	while True:
		if j == 0:
			ans.append(1)
			break
		if a[j - 1] <= j:
			ans.append(j + 1)
			break
		else:
			j -= 1
for i in ans:
	print(i)


t = int(input())
for tc in range(t):
	n = int(input())
	num = list(map(int, input().split()))
	num.sort()
	f = 0
	co = 1
	for i in range(n - 1, -1, -1):
		if num[i] <= i + 1:
			f = 1
			co = i + 2
			break
	print(co)


t = int(input())
while t > 0:
	n = int(input())
	lst = list(map(int, input().split()))
	i = 0
	k = n
	lst.sort()
	for i in range(n - 1, -1, -1):
		if lst[i] <= k:
			print(k + 1)
			break
		else:
			k -= 1
	if k == 0:
		print(k + 1)
	t -= 1


def solve():
	a = input()
	gp = list(map(int, input().split()))
	gp.sort(reverse=True)
	f = len(gp)
	for i in range(0, len(gp)):
		if gp[i] <= f:
			pass
		else:
			f = f - 1
	print(f + 1)

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


t = int(input())
for _ in range(t):
	n = int(input())
	a = sorted(list(map(int, input().split())))
	g = 1
	for i in range(n - 1, -1, -1):
		v = a[i]
		if a[i] > n:
			a.pop(i)
			n -= 1
		else:
			g += 1
	print(g)


def quick_gcd(a, b):
	for i in range(min(a, b), 0, -1):
		if a % i == 0 and b % i == 0:
			return i

def go():
	n = int(input())
	s = sorted(map(int, input().split()))
	for (i, ss) in reversed(list(enumerate(s, 1))):
		if i >= ss:
			return i + 1
	return 1
t = int(input())
ans = []
for _ in range(t):
	ans.append(str(go()))
print('\n'.join(ans))


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	l.reverse()
	works = False
	for i in range(len(l)):
		if l[i] <= len(l) - i:
			print(len(l) - i + 1)
			works = True
			break
	if not works:
		print(1)


from collections import Counter
from collections import defaultdict
from collections import deque
import math
import heapq
import sys
input = sys.stdin.readline
from bisect import *
rs = lambda : input().strip()
ri = lambda : int(input())
rl = lambda : list(map(int, input().split()))
rls = lambda : list(map(str, input().split()))
t = int(input())
for _ in range(0, t):
	n = int(input())
	a = rl()
	a.sort()
	mx = 0
	for i in range(0, n):
		if a[i] <= i + 1:
			mx = max(mx, i + 1)
	print(mx + 1)


from sys import stdin
from collections import defaultdict, Counter
from bisect import bisect_right

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

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

def linput():
	return list(map(int, stdin.readline().split()))
t = iinput()
while t:
	t -= 1
	n = iinput()
	a = linput()
	a.sort()
	for i in range(n - 1, -1, -1):
		if a[i] <= i + 1:
			print(i + 2)
			break
	else:
		print(1)


testCases = int(input())
for test in range(testCases):
	numberOfGrannies = int(input())
	grannies = list()
	grannies = map(lambda x: int(x), input().split(' '))
	grannies = sorted(grannies)
	i = len(grannies) - 1
	num = len(grannies)
	res = 1
	while i >= 0:
		if grannies[i] == num:
			res += grannies[i]
			break
		if grannies[i] < num:
			res += 1
		i -= 1
		num -= 1
	print(res)


t = int(input())
for q in range(t):
	n = int(input())
	a = [int(x) for x in input().split()]
	a.sort()
	c = 0
	g = 1
	for i in range(n):
		if a[i] <= g + i:
			c = i + 1
	print(c + 1)


def granny(A):
	A = sorted(A)
	cnt = 1
	buffer = 0
	for (i, a) in enumerate(A):
		if cnt + buffer >= a:
			cnt += buffer + 1
			buffer = 0
		else:
			buffer += 1
	print(cnt)

def main():
	T = int(input())
	for t in range(T):
		n = int(input())
		lst = list(map(int, input().split(' ')))
		granny(lst)
main()


t = int(input())
results = []
for case in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	count = 0
	best = 0
	for i in range(n):
		count += 1
		if count >= a[i]:
			best = count
	results.append(best + 1)
for result in results:
	print(result)


from sys import stdin, stdout
t = int(stdin.readline())
while t > 0:
	n = int(stdin.readline())
	a = list(map(int, stdin.readline().split()))
	a = sorted(a)
	cur = 1
	M = 0
	i = 0
	while i < n:
		req = a[i]
		if req <= cur:
			M += 1
			cur += 1
			i += 1
		else:
			valid = False
			local = 0
			while i < n:
				req = a[i]
				if cur == req:
					valid = True
					break
				cur += 1
				i += 1
				local += 1
			if valid:
				M += local
	stdout.write('{}\n'.format(M + 1))
	t -= 1


t = int(input())
for q in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	i = n - 1
	ans = n + 1
	while i >= 0:
		if a[i] > i + 1:
			ans -= 1
		else:
			break
		i -= 1
	print(ans)


from sys import stdin
t = int(stdin.readline().strip())
for _ in range(t):
	n = int(stdin.readline().strip())
	a = list(map(int, stdin.readline().strip().split()))
	a.sort()
	result = 0
	for (index, number) in enumerate(a):
		count = index + 1
		if count >= number:
			result = count
	print(result + 1)


def solve(a, n):
	a = sorted(a)
	i = -1
	while i < n - 1:
		j = n - 1
		while a[j] > j + 1 and j > i:
			j -= 1
		if j > i:
			i = j
		else:
			break
	return j + 2

def main():
	t = int(input())
	for i in range(t):
		n = int(input())
		a = list(map(int, input().split()))
		print(solve(a, n))
main()


for i in range(int(input())):
	a = int(input())
	b = list(map(int, input().split()))
	c = 1 + len(b)
	b.sort(reverse=True)
	for i in b:
		if i > c - 1:
			c -= 1
	print(c)


for x in range(int(input())):
	n = int(input())
	m = list(map(int, input().split()))
	m.sort()
	p = 1
	for i in range(n):
		if m[i] <= i + 1:
			p = 2 + i
	print(p)


from sys import stdin
input = stdin.buffer.readline
for _ in range(int(input())):
	n = int(input())
	a = sorted(map(int, input().split()))
	ans = 0
	for i in range(n):
		if i + 1 >= a[i]:
			ans = i + 1
	print(ans + 1)


t = int(input())
for i in range(t):
	n = int(input())
	max_gran = 1
	arr = [int(x) for x in input().split()]
	arr.sort()
	for i in range(len(arr)):
		if arr[i] <= i + 1:
			max_gran = i + 2
	print(max_gran)


from sys import stdin, stdout
import math
fastinput = stdin.buffer.readline
for _ in range(int(fastinput())):
	n = int(fastinput())
	a = [0] * (n + 2)
	for i in fastinput().split():
		x = int(i)
		if x > n + 1:
			continue
		else:
			a[x] += 1
	count = 1
	previous = 0
	for i in range(1, n + 2):
		if a[i] + count + previous > i:
			count += previous + a[i]
			previous = 0
		else:
			previous += a[i]
	print(count)


t = int(input())
for i in range(t):
	n = int(input())
	lst = list(map(int, input().strip().split(' ')))
	lst.sort()
	f = 0
	for j in reversed(range(n)):
		if j + 1 >= lst[j]:
			f = j + 1
			break
	print(f + 1)


for T in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	r = 0
	res = 1
	arr.sort()
	for i in range(n - 1, -1, -1):
		if i + 1 >= arr[i]:
			r = i + 1
			break
	print(res + r)


from sys import stdin, stdout

def solve():
	n = int(stdin.readline())
	a = list(map(int, stdin.readline().split()))
	a.sort(reverse=True)
	ans = n
	for i in range(n):
		if a[i] > ans:
			ans -= 1
	return ans + 1
for _ in range(int(stdin.readline())):
	stdout.write(str(solve()) + '\n')


import sys
input = sys.stdin.readline
(T,) = map(int, input().split())
for _ in range(T):
	(n,) = map(int, input().split())
	X = sorted(list(map(int, input().split())))
	r = 1
	for i in range(n):
		if X[i] <= i + 1:
			r = max(r, i + 2)
	print(r)


t = int(input())
for _ in range(t):
	n = int(input())
	x = list(map(int, input().split()))
	x.sort()
	p = 0
	pf = 1
	b = 0
	for i in range(n):
		p += 1
		if x[i] <= p:
			pf = p
			b = 1
	if b == 1:
		pf += 1
	print(pf)


for _ in range(int(input())):
	n = int(input())
	li = list(map(int, input().split()))
	li.sort()
	ct = 1
	n1 = n - 1
	while n1 >= 0:
		if li[n1] <= n1 + 1:
			ct = n1 + 1 + 1
			break
		n1 -= 1
	print(ct)


import sys
input = sys.stdin.readline
t = int(input())
for tests in range(t):
	n = int(input())
	A = sorted(map(int, input().split()))
	for i in range(n - 1, -1, -1):
		if A[i] <= i + 1:
			print(i + 2)
			break
	else:
		print(1)


import math
for _ in range(int(input())):
	n = int(input())
	x = [int(x) for x in input().split()]
	x.sort()
	(c, f) = (1, 0)
	m = -1
	for i in x:
		if i <= c:
			c += 1
		elif i > m and m != -1:
			f += 1
			m = i
		elif i == m:
			f += 1
			if f + c > m:
				c += f
				m = -1
				f = 0
		else:
			f += 1
			m = i
	print(c)


for _ in range(int(input())):
	n = int(input())
	lis = list(map(int, input().split()))
	lis.sort()
	c = 1
	x = 0
	for i in lis:
		if c + x >= i:
			c += 1 + x
			x = 0
		else:
			x += 1
	print(c)


for _ in range(int(input())):
	n = int(input())
	count = 0
	arr = list(map(int, input().split()))
	arr.sort()
	for i in range(n - 1, -1, -1):
		if arr[i] > i + 1:
			count = count + 1
		else:
			break
	print(n - count + 1)


t = int(input())
for q in range(t):
	n = int(input())
	mas = list(map(int, input().split()))
	mas.sort()
	maxi = 1
	for i in range(n):
		if i + 1 >= mas[i]:
			maxi = i + 2
	print(maxi)


for _ in range(int(input())):
	n = int(input())
	lis = list(map(int, input().split()))
	cur = 1
	lis.sort()
	i = 0
	tmp = []
	while i < n:
		if cur >= lis[i]:
			cur += 1
			i += 1
		else:
			tmp = lis[i:]
			break
	while len(tmp) != 0:
		tempc = cur
		tempc += len(tmp) - 1
		if tmp[-1] > tempc:
			tmp.pop()
		else:
			cur += len(tmp)
			break
	print(cur)


from sys import stdin, exit
input = stdin.readline

def i():
	return input()

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

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

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

def print_array(a):
	print(' '.join(map(str, a)))
t = ii()
for _ in range(t):
	n = ii()
	a = sorted(liis())
	ans = 1
	for i in range(n - 1, -1, -1):
		if a[i] <= i + 1:
			ans += i + 1
			break
	print(ans)


from fractions import Fraction
import bisect
import os
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

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 = rlinput()
	a.sort()
	count = 0
	for i in range(n - 1, -1, -1):
		if a[i] <= i + 1:
			count = i + 1
			break
	print(count + 1)


def solve(n, arr):
	arr.sort()
	for i in range(n - 1, -1, -1):
		if arr[i] <= i + 1:
			return i + 2
	return 1
t = int(input())
results = list()
for _ in range(0, t):
	n = int(input())
	arr = list(map(int, input().split(' ')))
	results.append(solve(n, arr))
for result in results:
	print(result)


n = int(input())
for i in range(n):
	s = int(input())
	found = True
	babushki = sorted(list(map(int, input().split())))
	for i in range(s - 1, -1, -1):
		if babushki[i] <= i + 1:
			print(i + 2)
			found = False
			break
	if found:
		print(1)


t = int(input())
while t != 0:
	n = int(input())
	a = input().split()
	a = [int(a[i]) for i in range(n)]
	a.sort()
	j = 1
	chk = False
	n -= 1
	while n != -1:
		if a[n] <= n + 1:
			print(n + 2)
			chk = True
			break
		n -= 1
	if chk == False:
		print(1)
	t -= 1


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	b = [0] * n
	for i in range(n):
		if a[i] <= i + 1:
			b[i] = 1
	if 1 not in b:
		print(1)
	else:
		print(n - b[::-1].index(1) + 1)


from collections import Counter
t = int(input())
for _ in range(t):
	n = int(input())
	a = sorted(list(map(int, input().split())))
	num = 0
	num_in = 1
	num_t = 0
	for (num, grands) in enumerate(a, 1):
		if grands <= num_in + num_t:
			num_in += 1 + num_t
			num_t = 0
		else:
			num_t += 1
	print(num_in)


t = int(input())
for i in range(t):
	a = int(input())
	b = list(map(int, input().split()))
	c = sorted(b)
	people = 1
	sum = 0
	j = 0
	while j < a:
		if c[j] <= people + sum and j < a:
			people = people + 1
			j = j + 1
		else:
			for k in range(j, a):
				if c[k] > sum + people:
					sum = sum + 1
				else:
					people = people + sum + 1
					sum = 0
					break
			j = k + 1
	print(people)


import sys
for t in range(int(sys.stdin.readline())):
	n = int(sys.stdin.readline())
	a = sorted(map(int, sys.stdin.readline().split()))
	for i in reversed(range(n)):
		if a[i] <= i + 1:
			sys.stdout.write(f'{i + 2}\n')
			break
	else:
		sys.stdout.write(f'1\n')


for _ in range(int(input())):
	n = int(input())
	grannies = [int(num) for num in input().split()]
	grannies.sort(reverse=True)
	l1 = []
	for i in range(len(grannies)):
		if grannies[i] <= len(grannies) - i:
			l1 = grannies[i:]
			break
	print(len(l1) + 1)


import math
t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	E = 1
	for i in range(n):
		if a[i] <= i + 1:
			E = i + 2
	print(E)


for _ in range(int(input())):
	n = int(input())
	A = list(map(int, input().split()))
	A.sort()
	c = 0
	ans = 0
	k = 1
	for i in A:
		if i <= k:
			c = k
		ans = max(ans, c)
		k += 1
	print(ans + 1)


t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	arr = sorted(arr)
	ct = 1
	dct = {}
	for i in arr:
		if i == 1:
			ct += 1
			continue
		if i in dct.keys():
			dct[i] += 1
		else:
			dct[i] = 1
	lst = list(dct.keys())
	sm = ct
	last = sm
	for i in lst:
		sm += dct[i]
		if sm - 1 >= i:
			last = sm
	print(last)


import math
t = int(input())
for i in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	result = 0
	j = 0
	for j in range(n):
		if l[j] <= j + 1:
			result = j + 1
	print(result + 1)


for t in range(int(input())):
	n = int(input())
	l1 = list(map(int, input().split()))
	l1.sort()
	l = len(l1)
	count = 0
	for i in range(l):
		if l1[l - 1 - i] <= l - i:
			count = 1
			print(l - i + 1)
		if count == 1:
			break
	if count == 0:
		print(1)


for _ in range(int(input())):
	n = int(input())
	a = sorted(list(map(int, input().split())))
	x = 1
	y = 1
	for i in range(n):
		if y - a[i] >= 0:
			x = y + 1
		y += 1
	print(x)


for i in range(int(input())):
	n = int(input())
	a = sorted(map(int, input().split()[:n]))
	grnny = 1
	for j in reversed(range(len(a))):
		if a[j] <= j + 1:
			grnny += j + 1
			break
	print(grnny)


import math
t = int(input())
for _ in range(t):
	n = int(input())
	items = list(map(int, input().split()))
	items.append(0)
	items.sort()
	for i in range(n + 1):
		if i >= items[i]:
			res = i
		else:
			continue
	print(res + 1)


for i in range(int(input())):
	n = int(input())
	arr = [int(i) for i in input().split(' ')]
	arr.sort()
	res = 1
	for i in range(n - 1, -1, -1):
		if arr[i] <= i + 1:
			res = i + 2
			break
	print(res)


number = int(input())
for iTask in range(number):
	n = int(input())
	inputStr = str(input())
	arr = list(map(int, inputStr.split(' ')))
	arr = sorted(arr)
	came = 0
	while n > -1:
		if n >= arr[n - 1]:
			came = n
			break
		n -= 1
	print(1 + came)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	r = 1
	a.sort()
	count = 0
	i = 0
	while i < n:
		if a[i] <= r + count:
			r = r + count + 1
			count = 0
		else:
			count = count + 1
		i = i + 1
	print(r)


t = int(input())
for i in range(t):
	n = int(input())
	x = input()
	x1 = x.split()
	for j in range(n):
		x1[j] = int(x1[j])
	x1.sort()
	t = True
	for j in range(n):
		if x1[n - 1 - j] <= n - j:
			print(int(n - j + 1))
			t = False
			break
	if t:
		print(1)


testing_mode = True
import sys, traceback
test_data = ''
final_output = ''

def input(input_format=0, multi=0):
	if multi > 0:
		return [input(input_format) for x in range(multi)]
	else:
		next_line = next(test_data, None).strip() if test_data else sys.stdin.readline()
		if input_format == 0:
			formatted_input = [next_line]
		elif input_format == 1:
			formatted_input = list(map(int, next_line.split()))
		elif input_format == 2:
			formatted_input = list(map(float, next_line.split()))
		elif input_format == 3:
			formatted_input = next_line.split()
		elif input_format == 4:
			formatted_input = (lambda x: [x[0], list(map(int, x[1:]))])(next_line.split())
		elif input_format == 5:
			formatted_input = (lambda x: [x[0], list(map(float, x[1:]))])(next_line.split())
		else:
			formatted_input = [next_line]
		return formatted_input

def log(*args):
	if testing_mode:
		print(*args)

def out(output_line, output_format=0, newline=True):
	global final_output
	formatted_output = ''
	if output_format == 0:
		formatted_output = str(output_line)
	elif output_format == 1:
		formatted_output = ' '.join(map(str, output_line))
	elif output_format == 1:
		formatted_output = '\n'.join(map(str, output_line))
	if testing_mode:
		final_output += formatted_output + '\n' * newline
	else:
		print(formatted_output, end='\n' if newline else '')
test_inputs = ['\n4\n5\n1 1 2 2 1\n6\n2 3 4 5 6 7\n6\n1 5 4 5 1 9\n5\n1 2 3 5 6\n\n', '\n1\n1\n2\n', '\n$$$\n', '\n$$$\n']
test_outputs = ['\n6\n1\n6\n4\n\n', '\n$$$\n', '\n$$$\n', '\n$$$\n']

def solve():
	e = [0] * (20 ** 5 + 1)
	for z in range(input(1)[0]):
		n = input(1)[0]
		g = input(1)
		b = []
		for i in g:
			if e[i] == 0:
				b.append(i)
			e[i] += 1
		b.sort(reverse=True)
		log(b)
		log(e[:10])
		k = 0
		for i in b:
			if i > n - k:
				k += e[i]
			e[i] = 0
		log()
		out(n - k + 1)
	return

def run_all(overwrite_testing=False):
	global testing_mode, final_output, test_data
	testing_mode = overwrite_testing and testing_mode
	if testing_mode:
		tests_failed = 0
		for (test_number, (test_in, test_out)) in enumerate(zip(test_inputs, test_outputs)):
			final_output = ''
			if test_in.lstrip()[:3] == '$$$':
				continue
			test_data = iter([i for i in test_in.split('\n') if i])
			print(f'Test Case #{test_number + 1}:')
			print('<' * 20)
			fail = False
			verdict = '\x1b[92m\x1b[1mPASS\x1b[0m'
			try:
				solve()
				final = final_output.rstrip('\n')
				raw_out = iter(map(str, final.split('\n'))) if final else iter(())
			except Exception:
				raw_out = ''
				fail = True
				print('\x1b[95m')
				traceback.print_exc()
				print('\x1b[0m')
			if raw_out:
				if test_out.lstrip()[:3] == '$$$':
					verdict = '\x1b[94m\x1b[1mSKIP\x1b[0m'
					print('\x1b[94m' + '\n'.join(list(raw_out)) + '\x1b[0m')
				else:
					for line_out in [i for i in test_out.split('\n') if i]:
						line_raw = next(raw_out, '% None %')
						if line_raw == line_out.strip():
							print(f'\x1b[92m{line_raw}\x1b[0m')
						else:
							print(f'\x1b[91m{line_raw}\x1b[0m')
							fail = True
					line_raw = next(raw_out, None)
					while line_raw:
						print(f'\x1b[91m{line_raw}\x1b[0m')
						line_raw = next(raw_out, None)
						fail = True
			print('>' * 20)
			if fail:
				verdict = '\x1b[91m\x1b[1mFAIL\x1b[0m'
				tests_failed += 1
			print(verdict + '\n')
		if tests_failed:
			print(f"\x1b[91m\x1b[1m{tests_failed} TEST{('S' if tests_failed > 1 else '')} FAILED!\x1b[0m")
		else:
			print(f'\x1b[92m\x1b[1mALL TESTS PASSED!\x1b[0m')
	else:
		test_data = False
		solve()
run_all(False)


for _ in range(int(input())):
	n = int(input())
	ai = list(map(int, input().split()))
	ai.sort(reverse=True)
	answer = n
	onfield = 1
	answerc = answer
	requ = 0
	maxi = 0
	for i in range(0, n):
		if ai[i] <= n - i:
			print(n - i + 1)
			break
		if i == n - 1:
			print('1')


t = int(input())
for test in range(t):
	n = int(input())
	arr = [int(x) for x in input().split()]
	arr.sort()
	gran = 1
	for i in range(n):
		if arr[i] <= i + 1:
			gran = 1 + (i + 1)
	print(gran)


import math

def main():
	for q in range(int(input())):
		N = int(input())
		l = list(map(int, input().split()))
		l.sort()
		ans = 1
		for i in range(N):
			if l[i] <= i + 1:
				ans = i + 2
		print(ans)
main()


def solve(n, m):
	sa = 1
	sb = 1
	i = 0
	a = sorted(m)
	while 1:
		while i != n and sb < a[i]:
			i += 1
			sb += 1
		if i == n:
			return sa
		i += 1
		sb += 1
		sa = sb
t = int(input())
ans = []
for i in range(t):
	n = int(input())
	m = list(map(int, input().split()))
	res = solve(n, m)
	ans.append(res)
ans = list(map(str, ans))
print('\n'.join(ans))


t = int(input())

def sol(a):
	a = list(sorted(a))
	i = len(a) - 1
	while i >= 0:
		if a[i] <= i + 1:
			return i + 1
		i -= 1
	return 0
for _ in range(t):
	input()
	print(1 + sol(map(int, input().split())))


def solve():
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	t = len(a) - 1
	while t >= 0:
		if t + 1 >= a[t]:
			print(t + 2)
			return
		else:
			t -= 1
	print(1)
	return
t = int(input())
for tt in range(t):
	solve()


import os
import sys
from math import *
from collections import *
from bisect 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')

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 = sorted(array())
	granny = 1
	tot = 1
	for i in range(n):
		if tot + 1 > a[i]:
			tot += 1
			granny = tot
		else:
			tot += 1
	print(granny)


for _ in range(int(input())):
	n = int(input())
	lis = list(map(int, input().split()))
	lis.sort()
	val = 0
	for i in range(n):
		if lis[i] <= i + 1:
			val = i + 1
	print(val + 1)


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	n = int(input())
	ar = [int(x) for x in input().split()]
	ar.sort()
	d = {}
	count = 1
	ans = 1
	for i in ar:
		if count >= i:
			count += 1
			ans = count
		else:
			count += 1
	print(ans)


for s in [*open(0)][2::2]:
	i = r = 0
	for x in sorted(map(int, s.split())):
		i += 1
		r = (i, r)[x > i]
	print(r + 1)


t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort(reverse=True)
	ln = len(l)
	count = ln
	for e in l:
		if count >= e:
			break
		else:
			count -= 1
	print(count + 1)


t = int(input())
for i in range(t):
	clen = int(input())
	len = clen
	grns = list(map(int, input().split()))
	grns.sort()
	for i in range(clen):
		if grns[-1] <= len:
			break
		else:
			del grns[-1]
			len -= 1
	print(len + 1)


from sys import stdin
input = stdin.readline
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	g = 0
	curr = 1
	for (j, i) in enumerate(a):
		if curr >= i:
			g = j + 1
		curr += 1
	print(g + 1)


import sys, math, cmath, time
start_time = time.time()
global tt

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 solve():
	n = inp()
	a = inlt()
	a.sort()
	for i in reversed(range(len(a))):
		if i + 1 >= a[i]:
			print(i + 2)
			break
	else:
		print(1)

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 counter(a):
	q = [0] * max(a)
	for i in range(len(a)):
		q[a[i] - 1] = q[a[i] - 1] + 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
ONLINE_JUDGE = __debug__
if ONLINE_JUDGE:
	input = sys.stdin.readline
main()


strInp = lambda : input().strip().split()
intInp = lambda : list(map(int, strInp()))
for t in range(int(input())):
	n = int(input())
	arr = intInp()
	arr.sort()
	ans = 1
	for i in range(n):
		if arr[i] <= i + 1:
			ans = i + 2
	print(ans)


def main():
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	cnt = 1
	i = 0
	while i < n:
		if cnt >= a[i]:
			cnt += 1
		else:
			temp = cnt + 1
			index = 0
			flag = True
			for j in range(i + 1, n):
				if temp >= a[j]:
					flag = False
					break
				else:
					temp += 1
					index += 1
			if flag:
				print(cnt)
				return
			else:
				i += index
				cnt = temp
		i += 1
	print(cnt)
	return

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


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort(reverse=True)
	ans = 0
	for i in range(n):
		if l[i] <= n - i:
			ans = n - i
			break
	print(ans + 1)


T = int(input())
for _ in range(T):
	M = int(input())
	N = map(int, input().split())
	N = sorted(N)
	backlog = 0
	in_backyard = 1
	for i in N:
		i = int(i)
		if i <= in_backyard + backlog:
			in_backyard += backlog + 1
			backlog = 0
		else:
			backlog += 1
	print(in_backyard)


from collections import Counter
for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	cnt = Counter(arr)
	n_g = 1
	ans = 1
	l = list(cnt.items())
	l.sort()
	t_g = 1
	for (val, cn) in l:
		if t_g + cn - 1 >= val:
			t_g += cn
			ans = max(ans, t_g)
		else:
			t_g += cn
	print(ans)


from sys import stdin
input = stdin.buffer.readline
for _ in range(int(input())):
	n = int(input())
	a = sorted(map(int, input().split()))
	y = 1
	for i in range(n):
		if i + 1 >= a[i]:
			y = i + 2
	print(y)


t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().rstrip().split()))
	arr.sort()
	pos = 0
	prev = 1
	while pos < len(arr):
		cnt = 0
		starting = pos - 1
		while True and pos < len(arr):
			if arr[pos] <= pos - starting - 1 + prev:
				cnt += 1
			elif cnt > 0:
				break
			pos += 1
		if cnt == 0:
			break
		prev += pos - 1 - starting
	print(prev)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	now = 1
	lim = n
	for i in range(n - 1, -1, -1):
		if a[i] <= lim:
			now += 1
		else:
			lim -= 1
	print(now)


def solve(arr, n):
	for i in range(n - 1, -1, -1):
		if arr[i] <= i + 1:
			print(i + 2)
			return
	print(1)
	return
for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	solve(arr, n)


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


import math
t = int(input())
while t:
	t -= 1
	n = int(input())
	a = list(map(int, input().split()))
	a.insert(0, 0)
	a.sort()
	x = [i for i in range(1, n + 2)]
	l = n
	for i in range(n, -1, -1):
		if x[i] > a[i]:
			print(i + 1)
			break


import sys
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())
t = inp()
for i in range(t):
	n = inp()
	a = inlt()
	a = sorted(a)
	cnt = 1
	res = 1
	for i in range(len(a)):
		if cnt >= a[i]:
			res = cnt + 1
		cnt += 1
	print(res)


t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	cur = 1
	for i in range(n):
		if i + 2 > arr[i]:
			cur = i + 2
	print(cur)


from collections import defaultdict
import sys
import math
sys.setrecursionlimit(1000000)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep='\n')
p2S = lambda x: print(*x, sep=' ')

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]

def main():
	for _ in range(II()):
		a = II()
		b = LI()
		b.sort()
		ans = 1
		for i in range(a - 1, -1, -1):
			if i + 1 >= b[i]:
				ans += i + 1
				break
		print(ans)
main()


for i in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	hasFound = False
	for person in range(n - 1, -1, -1):
		if a[person] <= person + 1:
			print(person + 2)
			hasFound = True
			break
	if not hasFound:
		print(1)


from collections import Counter
for _ in ' ' * int(input()):
	n = int(input())
	a = sorted(list(map(int, input().split())))
	a = Counter(a)
	s = 1
	s1 = 0
	lst = [1]
	for key in sorted(a):
		s += a[key]
		if s - 1 >= key:
			lst.append(s)
	print(lst[-1])


t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.append(1)
	arr.sort()
	max_count = 0
	for i in range(1, n + 1):
		if arr[i] <= i:
			max_count = i
	print(max_count + 1)


from collections import defaultdict
from itertools import accumulate
import sys
input = sys.stdin.readline
inf = 100000000000000000
mod = 998244353
for CASES in range(int(input())):
	n = int(input())
	A = list(map(int, input().split()))
	A = sorted(A)
	ans = 1
	for i in range(n):
		if A[i] <= i + 1:
			ans = i + 2
	print(ans)


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort(reverse=True)
	m = arr[0]
	if m <= n:
		print(n + 1)
		continue
	count = n
	for i in range(0, n):
		if count < arr[i]:
			count -= 1
		elif count >= arr[i]:
			break
	print(count + 1)


from collections import Counter
t = int(input())
for i in range(t):
	n = int(input())
	As = [int(x) for x in input().split()]
	c = Counter(As)
	arr = sorted(c.items())
	ans = 1
	m = len(arr)
	grannies = 1
	for j in range(m):
		if arr[j][0] <= grannies + arr[j][1] - 1:
			ans = grannies + arr[j][1]
		grannies += arr[j][1]
	print(ans)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	for i in range(n - 1, -1, -1):
		if a[i] > n:
			a.pop(i)
			n -= 1
		else:
			break
	print(len(a) + 1)


test_cases = int(input())
for tt in range(test_cases):
	n = int(input())
	grannies = [int(i) for i in input().split(' ')]
	grannies.sort()
	num_of_grannies = 1
	left = 0
	right = len(grannies) - 1
	counter = 0
	viable = 1
	for index in range(len(grannies) - 1, -1, -1):
		if grannies[index] <= index + 1:
			print(index + 2)
			break
		elif index == 0:
			print(1)


t = int(input())
for i in range(t):
	(n, k) = (int(input()), 0)
	s = sorted((int(i) for i in input().split()))
	for i in range(n):
		if i + 1 >= s[i]:
			k = i + 1
	if s[n - 1] <= n:
		print(n + 1)
	else:
		print(k + 1)


import math
t = int(input())
for _ in range(t):
	n = int(input())
	a = [int(x) for x in input().split()]
	a.sort()
	dic = dict()
	for i in a:
		if i not in dic:
			dic[i] = 1
		else:
			dic[i] += 1
	gr = list(dic.keys())
	num = 1
	for i in range(len(gr)):
		if gr[i] <= dic[gr[i]] + num - 1:
			num += dic[gr[i]]
		elif i + 1 != len(gr):
			dic[gr[i + 1]] += dic[gr[i]]
	print(num)


import sys, heapq
from collections import *
from functools import lru_cache
sys.setrecursionlimit(10 ** 6)

def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		arr = list(map(int, input().split(' ')))
		cnt = Counter(arr)
		(presum, tmp) = (0, 0)
		for i in sorted(cnt):
			tmp += cnt[i]
			if presum + tmp >= i:
				presum += tmp
				tmp = 0
		print(presum + 1)
main()


import sys
for _ in range(int(sys.stdin.readline().rstrip())):
	n = int(sys.stdin.readline().rstrip())
	a = list(map(int, sys.stdin.readline().rstrip().split()))
	a.sort()
	chk = 1
	re = 1
	for i in a:
		if chk >= i:
			re = chk + 1
		chk += 1
	print(re)


t = int(input())
for _ in range(t):
	l1 = input()
	A = list(map(int, input().split()))
	A = sorted(A)
	i = len(A) - 1
	flag = 0
	while flag == 0 and i >= 0:
		if A[i] <= i + 1:
			flag = 1
		else:
			i = i - 1
	print(i + 2)


def solve():
	n = int(input())
	s = list(map(int, input().split()))
	s.sort()
	for i in range(n - 1, -1, -1):
		if s[i] <= i + 1:
			print(i + 2)
			return
	print(1)

def main():
	t = int(input())
	for i in range(t):
		solve()
main()


def Gen():
	k = 1
	while 1:
		yield y
num = int(input())
for _ in range(num):
	n = int(input())
	l = [int(i) for i in input().split()]
	l.sort()
	gen = Gen()
	k = 1
	ans = 1
	f = 0
	for i in range(n):
		if f and l[i] == k - 1:
			f = 0
			k += 1
			ans = k
		elif l[i] <= k:
			k += 1
			ans = k
		else:
			f = k
			k += 1
	print(ans)


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	d = dict()
	for i in l:
		if i not in d:
			d[i] = 0
		d[i] += 1
	ans = 1
	carry = 0
	for i in sorted(d.keys()):
		temp = ans + d[i] + carry
		if temp - 1 >= i:
			ans += d[i] + carry
			carry = 0
		else:
			carry += d[i]
	print(ans)


t = int(input())

def grannies(n, array):
	maps = {}
	array.sort()
	for i in array:
		if i not in maps:
			maps[i] = 1
		else:
			maps[i] += 1
	count = 1
	biggest = 1
	for i in maps:
		count += maps[i]
		if i <= count - 1:
			biggest = count
	return biggest
for i in range(t):
	n = int(input())
	array = list(map(int, input().split()))
	print(grannies(n, array))


from collections import defaultdict
t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	c = 0
	for i in range(n, 0, -1):
		if i >= a[i - 1]:
			c = i
			break
	print(c + 1)


def solve():
	n = int(input())
	arr = list(map(int, input().split()))
	arr = sorted(arr, key=lambda x: x)
	for i in range(n - 1, -1, -1):
		if arr[i] <= i + 1:
			return i + 2
	return 1

def main():
	t = int(input())
	for i in range(t):
		print(solve())
main()


t = int(input())
for j in range(t):
	n = int(input())
	grandmas = sorted([int(x) for x in input().split()])
	max_c = 1
	for i in range(1, len(grandmas) + 1):
		if grandmas[i - 1] <= i:
			max_c = i + 1
	print(max_c)


import sys
input = lambda : sys.stdin.readline().rstrip()
inp = sys.stdin.buffer.readline

def I():
	return list(map(int, inp().split()))
from collections import Counter
for _ in range(I()[0]):
	(n,) = I()
	a = I()
	ind = 0
	ans = 1
	a.sort()
	for i in range(n):
		if i + 1 >= a[i]:
			ind = i + 1
	print(ind + 1)


for _ in range(int(input())):
	granny = 1
	n = int(input())
	condn = list(map(int, input().split()))
	condn.sort()
	condn.insert(0, 0)
	for i in range(n, 0, -1):
		if condn[i] <= i:
			granny = i + 1
			break
	print(granny)


from collections import Counter
for _ in range(int(input())):
	n = int(input())
	r = list(map(int, input().split()))
	r.sort()
	for i in range(n - 1, -1, -1):
		if r[i] <= i + 1:
			print(i + 2)
			break
	else:
		print(1)


t = int(input())
for iterations in range(t):
	n = int(input())
	a = [int(x) for x in input().split()]
	a.sort()
	ans = 1
	for i in reversed(range(n)):
		if a[i] <= i + 1:
			ans = i + 2
			break
	print(ans)


t = int(input())
for i in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	l = sorted(l)
	a = 1
	b = -1
	while True:
		if n == 0:
			break
		if l[b] <= n:
			a = n + 1
			break
		n -= 1
		b -= 1
	print(a)


from collections import defaultdict
for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	acc = 0
	g = n + 1
	for i in range(n - 1, -1, -1):
		if g - 1 >= arr[i]:
			pass
		else:
			g -= 1
	print(g)


import sys, math
I = sys.stdin.readline
ans = ''
for _ in range(int(I())):
	n = int(I())
	arr = list(map(int, I().split()))
	arr.sort(reverse=True)
	x = 1
	i = 0
	while i < n:
		if arr[i] > n - i:
			i += 1
		else:
			x = n - i + 1
			break
	ans += str(x) + '\n'
print(ans)


t = int(input())
for i in range(t):
	n = int(input())
	s = input().split()
	for j in range(n):
		s[j] = int(s[j])
	s.sort()
	sum = 1
	tree = sum
	flag = 0
	for j in range(n):
		if sum >= s[j]:
			tree = sum
			flag = 1
		sum += 1
	if flag:
		print(tree + 1)
	else:
		print(tree)


for i in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	ans = 1
	j = 0
	count = 1
	arr.sort()
	while j < n:
		if arr[j] <= count:
			ans = count + 1
		count += 1
		j += 1
	print(ans)


import math
for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	ans = 0
	l.sort()
	maxx = -1
	for i in range(n):
		if l[i] <= i + 1:
			maxx = i
	print(maxx + 2)


q = int(input())
for i in range(q):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	wyn = 1
	ind = 0
	for i in range(n):
		if l[i] <= i + 1:
			wyn = i + 2
	print(wyn)


t = int(input())
while t:
	n = int(input())
	a = [int(i) for i in input().split()]
	cf = [0] * (n + 1)
	for ele in a:
		if ele <= n:
			cf[ele] += 1
	for i in range(1, n + 1):
		cf[i] += cf[i - 1]
	ans = 0
	for i in range(1, n + 1):
		if cf[i] >= i:
			ans = cf[i]
	print(ans + 1)
	t -= 1


for _ in range(int(input())):
	n = int(input())
	arr = sorted(map(int, input().split()))
	cur = 0
	maxi = 1
	for i in range(n - 1, -1, -1):
		if cur != arr[i]:
			cur = arr[i]
			if i + 1 >= arr[i]:
				maxi = i + 2
				break
	print(maxi)


from itertools import groupby
t = int(input())
for _ in range(t):
	input()
	k = 1
	s = 0
	for g in [(i, len(list(j))) for (i, j) in groupby(sorted(list(map(int, input().split()))))]:
		if k + g[1] + s > g[0]:
			k += g[1] + s
			s = 0
		else:
			s += g[1]
	print(k)


import sys
max_int = 1000000001
min_int = -max_int
t = int(sys.stdin.readline())
for _ in range(t):
	n = int(sys.stdin.readline())
	a = list(map(int, sys.stdin.readline().split()))
	a.sort()
	ans = 0
	for (num, one) in enumerate(a, 1):
		if num >= one:
			ans = num
	print(ans + 1)


def time(nk, n):
	nk.sort()
	oh = []
	while len(nk) > 0:
		if nk[-1] <= n:
			oh.append(n + 1)
			break
		else:
			nk.pop(-1)
			n = n - 1
	if len(oh) == 1:
		return oh[0]
	else:
		return 1
t = int(input())
ans = []
for i in range(t):
	n = int(input())
	nk = list(map(int, input().rstrip().split()))
	r = time(nk, n)
	ans.append(r)
for i in ans:
	print(i)


for _ in ' ' * int(input()):
	a = int(input())
	d = dict()
	s = 0
	k = 0
	for i in map(int, input().split()):
		d[i] = d.get(i, 0) + 1
	z = sorted(d)
	for i in z:
		if s + k + d[i] >= i:
			s += k + d[i]
			k = 0
		else:
			k += d[i]
	print(s + 1)


num = int(input())
for i in range(num):
	le = int(input())
	w = [int(j) for j in input().split()]
	w.sort()
	counter = 1
	for j in range(le - 1, -1, -1):
		if w[j] - j <= 1:
			counter = j + 2
			break
	print(counter)


for i in range(int(input())):
	n = int(input())
	l = sorted(list(map(int, input().split())))
	a = 1
	for i in range(n):
		if l[i] <= i + 1:
			a = i + 2
	print(a)


t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().strip().split()))[:n]
	arr.sort(reverse=True)
	k = n
	i = 0
	while i < n and k < arr[i]:
		i += 1
		k -= 1
	print(n - i + 1)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	gran = 1
	(i, j, k) = (0, 0, 0)
	dikh = 1
	while i < n:
		if a[i] <= dikh:
			dikh += 1
			if k == 0:
				gran += 1
			else:
				gran += j + 1
				j = 0
			k = 0
		else:
			j += 1
			dikh += 1
			k = 1
		i += 1
	print(gran)


from bisect import bisect
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	court = 1
	a.sort()
	flag = False
	for i in range(n - 1, -1, -1):
		if a[i] <= i + 1:
			flag = True
			break
	if flag:
		print(i + 2)
	else:
		print(1)


def answer(arr):
	arr.sort()
	outside = 0
	waiting = 1
	for i in range(len(arr)):
		if arr[i] <= outside + waiting:
			outside += waiting
			waiting = 1
		else:
			waiting += 1
	return outside + 1
testCount = int(input())
for _ in range(testCount):
	n = int(input())
	arr = list(map(int, input().split()))
	print(answer(arr))


from collections import Counter as cn
from collections import OrderedDict as od
for t in range(int(input())):
	l = int(input())
	arr = list(map(int, input().split()))
	d = od(sorted(cn(arr).items()))
	(a, b) = (list(d.keys()), list(d.values()))
	n = len(a)
	ans = {}
	(granny, mx) = (1, 1)
	for i in range(n):
		if a[i] <= granny + (b[i] - 1):
			granny += b[i]
			ans[a[i]] = granny
			mx = max(mx, ans[a[i]])
		else:
			granny += b[i]
	print(mx)


import math
import sys
input = sys.stdin.readline
t = int(input())
for ii in range(t):
	n = int(input())
	ans = 1
	a = [int(i) for i in input().split()]
	a.sort()
	pref = [1]
	for j in range(len(a)):
		pref.append(pref[-1] + 1)
	count = 0
	for i in range(1, len(pref)):
		if a[i - 1] <= pref[i - 1]:
			ans += pref[i] - ans
	print(ans)


from collections import Counter
test = int(input())
for _ in range(test):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	sumval = 0
	for i in range(n - 1, -1, -1):
		if arr[i] <= i + 1:
			sumval = i + 1
			break
	print(sumval + 1)


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a = sorted(a)
	guest = 0
	for i in range(n):
		if i + 1 >= a[i]:
			guest = i + 1
	print(guest + 1)


import sys

def input():
	return sys.stdin.readline().rstrip()
t = int(input())
answers = []
for _ in range(t):
	n = int(input())
	arr = [int(i) for i in input().split()]
	arr.sort()
	flag = False
	for (i, a) in enumerate(arr):
		if a <= i + 1:
			best = i
			flag = True
	if flag:
		answers.append(best + 2)
	else:
		answers.append(1)
print(*answers, sep='\n')


T = int(input())
for _ in range(0, T):
	N = int(input())
	a = list(map(int, input().split()))
	cnt = 1
	a.sort()
	for i in range(0, len(a)):
		if a[i] <= i + 1:
			cnt = i + 2
	print(cnt)


t = int(input())
while t != 0:
	t = t - 1
	n = int(input())
	arr = list(map(int, input().strip().split()))[:n]
	arr.sort()
	count = 1
	ans = 1
	for i in range(0, n):
		if ans + (count - 1) >= arr[i]:
			ans = ans + count
			count = 1
		else:
			count = count + 1
	print(ans)


import math
for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	a = -2
	for i in range(n - 1, -1, -1):
		if l[i] <= i + 1:
			a = i
			break
	if a == -2:
		print(1)
	else:
		print(a + 2)


for _ in range(int(input())):
	n = int(input())
	a = [0] + sorted(list(map(int, input().split())))
	max_ = n
	for i in range(n, -1, -1):
		if a[i] <= i:
			max_ = i
			break
	print(max_ + 1)


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	s = 1
	ct = 1
	ct1 = 0
	flag = 0
	for i in range(n):
		if a[i] <= ct + ct1:
			ct += 1 + ct1
			ct1 = 0
		else:
			ct1 += 1
	print(ct)


for i in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	x = dict()
	for i in range(n):
		if l[i] not in x:
			x[l[i]] = 1
		else:
			x[l[i]] += 1
	g = l[:]
	g = list(set(g))
	g.sort()
	rep = [0] * len(g)
	rep[0] = x[g[0]]
	for i in range(1, len(g)):
		rep[i] = rep[i - 1] + x[g[i]]
	sum = 0
	for j in range(len(g) - 1, -1, -1):
		if rep[j] >= g[j]:
			sum = rep[j]
			break
	print(sum + 1)


from sys import stdin
from collections import defaultdict

def inp():
	return stdin.readline().strip()
t = int(inp())
for _ in range(t):
	n = int(inp())
	a = [int(x) for x in inp().split()]
	g = 1
	a.sort()
	f = defaultdict(int)
	for curr in a:
		f[curr] += 1
	fAr = [f.get(key) for key in f]
	a = list(set(a))
	for i in range(len(a)):
		if fAr[i] - 1 + g >= a[i]:
			g += fAr[i]
		elif i < len(a) - 1:
			fAr[i + 1] += fAr[i]
	print(g)


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 fact(x):
	if x == 0:
		return 1
	else:
		return x * fact(x - 1)

def lower_bound(li, num):
	answer = -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
for _ in range(int(input())):
	n = int(input())
	grn = list(map(int, input().split()))
	grn.sort()
	grn.insert(0, 0)
	people = 0
	for i in range(n + 1):
		if people >= grn[i]:
			index = i
		people += 1
	print(index + 1)


from sys import stdin, stdout

def input():
	return stdin.readline()
t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	x = 1
	(c, s) = (0, 0)
	c1 = 0
	for i in range(n):
		if a[i] <= x:
			x += 1
		else:
			n = a[i] - x
			s += 1
			if n == c1:
				x += s
				s = 0
				c1 = 0
			else:
				c1 += 1
	print(x)


import math
el = int(input())
for k in range(el):
	num = int(input())
	ar = []
	for i in input().split(' '):
		ar.append(int(i))
	ar.sort()
	count = 1
	curr = 0
	val = 0
	for i in ar:
		if i <= count:
			count = count + 1
		elif val != 0:
			val = i
			curr = curr + 1
			if val <= count + curr - 1:
				val = 0
				count = count + curr
				curr = 0
		else:
			val = i
			curr = 1
	print(count)


import math
import os
import random
import re
import sys
t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	grannies = sorted(list(map(int, input().split())))
	g_frnd = []
	g_count = []
	g_frnd.append(grannies[0])
	g_count.append(1)
	for g in grannies[1:]:
		if g_frnd[-1] == g:
			g_count[-1] += 1
		else:
			g_frnd.append(g)
			g_count.append(1)
	court = 1
	queue = 0
	for i in range(len(g_frnd)):
		if court + queue + g_count[i] - 1 >= g_frnd[i]:
			court += queue + g_count[i]
			queue = 0
		else:
			queue += g_count[i]
	print(court)


for ii in range(int(input())):
	n = int(input())
	a = [int(i) for i in input().split()]
	a.sort()
	ans = 1
	along = 0
	i = 0
	while i < n:
		while i < n and ans + along < a[i]:
			along += 1
			i += 1
		if i < n and ans + along >= a[i]:
			ans += along + 1
			along = 0
		i += 1
	print(ans)


t = int(input())
for T in range(t):
	n = int(input())
	a = [int(x) for x in input().split()]
	a.sort()
	(ans, cur) = (0, 1)
	for i in range(n):
		if a[i] <= cur:
			ans = i + 1
			cur += 1
		else:
			cur += 1
	print(ans + 1)


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())
	s = sorted(list(set(a)))
	d = {}
	count = 1
	for i in a:
		if i not in d:
			d[i] = 1
		else:
			d[i] += 1
	for i in range(1, len(s)):
		d[s[i]] += d[s[i - 1]]
	for i in s:
		if i <= d[i]:
			count = d[i] + 1
	print(count)


import math
t = int(input())
for _ in range(t):
	n = int(input())
	seq = list(map(int, input().split()))
	seq.sort()
	i = 0
	c = 1
	ans = 1
	d = 1
	for i in range(n):
		if seq[i] <= c:
			c += 1
		else:
			d = 0
			ans = c
			while i < n:
				if seq[i] > c:
					c += 1
				else:
					c += 1
					ans = c
				i += 1
			break
	if d == 1:
		ans = c
	print(ans)


t = int(input())
for i in range(t):
	f = int(input())
	s = list(map(int, input().split()))
	s.sort()
	value = 0
	for j in range(len(s) - 1, -1, -1):
		if j + 1 >= s[j]:
			value = j + 1
			break
	print(value + 1)


sInt = lambda : int(input())
mInt = lambda : map(int, input().split())
lInt = lambda : list(map(int, input().split()))
t = sInt()
for _ in range(t):
	n = sInt()
	a = lInt()
	a.sort()
	for j in range(n - 1, -1, -1):
		if a[j] > len(a):
			a.pop()
		else:
			break
	print(len(a) + 1)


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split(' ')))
	b = a
	b.sort(reverse=True)
	total = len(b)
	for i in b:
		if i > total:
			total -= 1
		else:
			break
	total += 1
	print(total)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	s = 1
	a.sort()
	c = 0
	i = 0
	while i < n:
		if a[i] <= s + c:
			s = s + c + 1
			c = 0
		else:
			c = c + 1
		i = i + 1
	print(s)


import math
import sys
from sys import stdin
input = sys.stdin.readline
for _ in range(int(input())):
	n = int(input())
	arr = [int(j) for j in input().split()]
	arr.sort()
	dic = dict()
	for i in arr:
		if i not in dic:
			dic[i] = 1
		else:
			dic[i] += 1
	key = list(dic.keys())
	count = 1
	for i in range(len(key)):
		if key[i] <= dic[key[i]] + count - 1:
			count += dic[key[i]]
		elif i + 1 != len(key):
			dic[key[i + 1]] += dic[key[i]]
	print(count)


t = int(input())
for _ in range(t):
	n = int(input())
	A = sorted(list(map(int, input().split())))
	res = 1
	t = 0
	for a in A:
		if res + t >= a:
			res += t
			t = 0
		if a <= res:
			res += 1
		else:
			t += 1
	print(res)


import sys
input = sys.stdin.readline
t = int(input())
res = []
for cs in range(t):
	n = int(input())
	a = [int(x) for x in input().split()]
	a.sort()
	ans = 1
	opt = 0
	for i in range(n):
		if a[i] <= i + 1:
			opt = i + 1
	res.append(str(ans + opt))
print('\n'.join(res))


t = int(input())
for i in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	l = sorted(l)
	c = 0
	x = 0
	for i in range(len(l)):
		c += 1
		if l[i] <= c:
			x = c
	print(x + 1)


outputs = []
for __ in range(int(input())):
	N = int(input())
	A = sorted([int(num) for num in input().split()])
	grannies = 1
	imaginary_grannies = 1
	for i in A:
		if imaginary_grannies >= i:
			grannies = imaginary_grannies + 1
		imaginary_grannies += 1
	outputs.append(grannies)
for output in outputs:
	print(output)


t = int(input())
p = []
q = []
for i in range(t):
	k = int(input())
	h = list(map(int, input().split()))
	p.append(h)
	q.append(k)

def granny(l_arr, arr):
	o = []
	for i in range(l_arr):
		if arr[i] <= l_arr:
			o.append(arr[i])
	if o:
		count = []
		for i in range(max(o)):
			count.append(0)
		for i in range(len(o)):
			count[o[i] - 1] += 1
		su = sum(count)
		for i in range(len(count) - 1, -1, -1):
			retval = 0
			if su >= i + 1:
				retval = su
				break
			else:
				su = su - count[i]
	else:
		retval = 0
	return retval + 1
for i in range(t):
	y = granny(q[i], p[i])
	print(y)


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


def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		arr = [int(i) for i in input().split()]
		arr.sort()
		tmp = [i + 1 for i in range(n)]
		last_i = -1
		for i in range(n):
			arr[i] = arr[i] - (i + 1)
			if arr[i] <= 0:
				last_i = i
		print(last_i + 2)
main()


import sys
t = int(sys.stdin.readline())
for i in range(t):
	n = int(sys.stdin.readline())
	a = [int(x) for x in sys.stdin.readline().split()]
	a.sort()
	res = 0
	for j in range(n):
		if j + 1 >= a[j]:
			res = j + 1
	print(res + 1)


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

def solve():
	n = int(input())
	a = list(inp())
	a.sort()
	count = 1
	for i in range(n):
		if a[i] <= i + 1:
			count = i + 2
	return count

def main():
	t = int(input())
	while t:
		print(solve())
		t -= 1
main()


a = int(input())
for i in range(0, a):
	x = int(input())
	l = list(map(int, input().split()))
	l.sort()
	g = 1
	mx = g
	s = 0
	f = 9
	for j in range(0, len(l)):
		if f == 0:
			g = g + s
			f = 1
		if l[j] <= g:
			g = g + 1
			if g > mx:
				mx = g
		else:
			if f == 1:
				s = 0
			s = s + 1
			f = 0
	print(mx)


from collections import defaultdict as dd
from collections import deque
import bisect
import heapq

def ri():
	return int(input())

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

def solve():
	n = ri()
	A = sorted(rl())
	best = 1
	for (i, a) in enumerate(A):
		if a <= i + 1:
			best = i + 2
	print(best)
mode = 'T'
if mode == 'T':
	t = ri()
	for i in range(t):
		solve()
else:
	solve()


t = int(input())
for o in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	c = 1
	for i in range(n):
		if l[i] <= i + 1:
			c = i + 2
	print(c)


def solve(nums, n):
	nums.sort()
	for idx in range(n - 1, -1, -1):
		if idx + 1 >= nums[idx]:
			return idx + 2
	return 1
t = int(input())
for i in range(t):
	n = int(input())
	nums = [int(i) for i in input().split()]
	ans = solve(nums, n)
	print(ans)


import sys
input = sys.stdin.readline
T = int(input())
for _ in range(T):
	n = int(input())
	L = sorted(map(int, input().split()))
	ans = 1
	for i in range(n):
		if i + 1 >= L[i]:
			ans = i + 2
	print(ans)


t = int(input())
for j in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort(reverse=True)
	k = 1
	i = 0
	size = len(a) + 1
	while i < n and k == 1:
		size -= 1
		if size >= a[i]:
			k += size
		i += 1
	print(k)


import sys
input = sys.stdin.readline
t = int(input())
for r in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	ans = 1
	possible_counter = 1
	l.sort()
	i = 0
	j = 0
	while j < n:
		if possible_counter >= l[j]:
			ans += abs(i - j) + 1
			possible_counter += 1
			j += 1
			i = j
		else:
			j += 1
			possible_counter += 1
	print(ans)


t = int(input())
for tt in range(t):
	count_of_grandma_friends = int(input())
	list_of_grandma_friends = list(map(int, input().split()))
	list_of_grandma_friends = sorted(list_of_grandma_friends)
	count_of_outside_grandmas = 1
	have_to_out = 0
	for i in range(len(list_of_grandma_friends)):
		may_to_out = i + 1
		if may_to_out >= list_of_grandma_friends[i]:
			have_to_out = may_to_out
	count_of_outside_grandmas += have_to_out
	print(count_of_outside_grandmas)


def main():
	from sys import stdin
	from sys import stdout
	input = stdin.readline
	print = stdout.write
	t = int(input())
	for _ in range(t):
		n = int(input())
		a = list(map(int, input().split()))
		a.sort()
		possible_counter = 1
		counter = 0
		for i in range(n):
			if possible_counter >= a[i]:
				counter = possible_counter
			possible_counter += 1
		print(f'{counter + 1}\n')
main()


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	c = 0
	present = 1
	waiting = 0
	for i in range(n):
		if l[i] <= present + waiting:
			present += waiting + 1
			waiting = 0
		else:
			waiting += 1
	print(present)


def main():
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	ans = 1
	for i in range(0, n):
		if arr[i] <= i + 1:
			ans = i + 1 + 1
	print(ans)
t = int(input())
for _ in range(t):
	main()


import sys
import math
input = sys.stdin.readline

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

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

def insr():
	s = input()
	s = list(s[:len(s)])
	if s[-1] == '\n':
		del s[-1]
	return s

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

def f(n, a):
	cg = 1
	a.sort()
	ps = 0
	pos = 0
	while pos < n:
		if cg >= a[pos]:
			cg += 1
		else:
			while pos - ps + cg < a[pos]:
				pos += 1
				if pos >= n:
					return cg
			cg += pos - ps + 1
			ps = pos
		ps += 1
		pos += 1
	return cg
	return ()
t = inp()
result = []
for i in range(t):
	n = inp()
	a = inlt()
	result.append(f(n, a))
for i in range(t):
	print(result[i])


t = int(input())
for _ in range(t):
	n = int(input())
	arr = [int(j) for j in input().split()]
	arr.sort()
	arr2 = [i + 1 for i in range(n)]
	flag = 0
	for i in range(len(arr) - 1, -1, -1):
		if arr[i] <= arr2[i]:
			ans = i + 1
			flag = 1
			break
	if flag == 0:
		print(1)
	else:
		print(ans + 1)


import sys
import string
input = sys.stdin.readline
import math
t = int(input())
for i in range(2 * t):
	if i % 2 == 0:
		k = input()
	else:
		n = list(map(int, input().split()))
		n.sort()
		best = -1
		for j in range(len(n)):
			if n[j] < j + 2:
				best = j
		print(best + 2)


t = int(input())
for i in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	x = 0
	arr.sort()
	for i in range(len(arr)):
		if i + 1 >= arr[i]:
			x = i + 1
	print(x + 1)


q = int(input())
import sys
for i in range(q):
	n = int(input())
	a = [int(i) for i in sys.stdin.readline().split()]
	a.sort()
	s = n - 1
	while s >= 0:
		if a[s] > s + 1:
			s -= 1
		else:
			break
	print(s + 2)


import sys
import math

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

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

def input():
	return sys.stdin.readline().strip()
for _ in range(int(input())):
	n = int(input())
	a = get_array()
	count = 0
	a.sort()
	x = 0
	start = 0
	l = 1
	if n == 1 and a[0] == 1:
		print(2)
		continue
	for i in range(n):
		if a[i] <= i + 1:
			l = 0
		if a[i] > i + 1:
			if l == 0:
				count += i - start
				l = 1
				start = i
	if i != start and l == 0:
		count += i - start + 1
	print(count + 1)


t = int(input())
for _ in range(t):
	n = int(input())
	m = list(map(int, input().split(' ')))
	m.sort()
	count = 0
	for i in range(n, 0, -1):
		if i >= m[i - 1]:
			count = i
			break
	print(count + 1)


for _ in range(int(input())):
	n = int(input())
	arr = sorted(list(map(int, input().split())))
	count = 1
	count_1 = 1
	val = 1
	for i in range(n):
		if count_1 >= arr[i]:
			count += val
			val = 0
		count_1 += 1
		val += 1
	print(count)


for _ in range(int(input())):
	n = int(input())
	s = map(int, input().split())
	s = sorted(s)
	ans = 0
	for (i, x) in enumerate(s):
		i += 1
		if i >= x:
			ans = i
	print(ans + 1)


for _ in range(int(input())):
	n = int(input())
	arr = [int(x) for x in input().split()]
	arr.sort()
	ans = 1
	for i in range(n - 1, -1, -1):
		if arr[i] <= i + 1:
			ans = i + 2
			break
	print(ans)


for _ in range(int(input())):
	n = int(input())
	a = sorted([int(x) for x in input().split()])
	k = 1
	ans = 0
	for i in range(n):
		if k >= a[i]:
			ans = max(ans, k)
		k += 1
	print(ans + 1)


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

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

def primeFactor(n):
	if n % 2 == 0:
		return 2
	i = 3
	while i ** 2 <= n:
		if n % i == 0:
			return i
		i += 1
	return n

def main():
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	curr = 1
	ans = 0
	for i in range(n):
		if arr[i] - curr <= 0:
			ans = i + 1
		curr += 1
	print(ans + 1)
t = int(input())
for _ in range(t):
	main()


import sys
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()

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

def li():
	return list(mi())
abc = 'abcdefghijklmnopqrstuvwxyz'
abd = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}
mod = 1000000007
inf = float('inf')
vow = ['a', 'e', 'i', 'o', 'u']
(dx, dy) = ([-1, 1, 0, 0], [0, 0, 1, -1])

def read():
	tc = 0
	if tc:
		input = sys.stdin.readline
	else:
		sys.stdin = open('input1.txt', 'r')
		sys.stdout = open('output1.txt', 'w')

def solve():
	for _ in range(ii()):
		n = ii()
		a = li()
		m = {}
		ans = 0
		a.sort()
		c = 0
		ans = 0
		for i in a:
			c += 1
			if i <= c:
				ans = c
		print(ans + 1)
solve()


def f(n, G):
	G.sort()
	x = 1
	for i in range(n):
		if G[i] <= i + 1:
			x = i + 2
	return x
t = int(input())
for i in range(t):
	n = int(input())
	G = input().split(' ')
	for i in range(n):
		G[i] = int(G[i])
	print(f(n, G))


import math
for i in range(int(input())):
	n = int(input())
	r = 0
	q = list(map(int, input().split()))
	q.sort()
	for i in range(n - 1, -1, -1):
		if q[i] > i + 1:
			continue
		else:
			r = i + 1
			break
	print(r + 1)


t = int(input())
for z in range(t):
	n = int(input())
	l = [int(i) for i in input().split()]
	d = {}
	l.sort()
	for i in l:
		if i in d:
			d[i] += 1
		else:
			d[i] = 1
	g = 1
	ex = 0
	for i in d:
		if d[i] != 0:
			if g + d[i] + ex - 1 >= i:
				g += d[i] + ex
				ex = 0
			else:
				ex += d[i]
	print(g)


from collections import Counter
import math
t = int(input())
while t > 0:
	t = t - 1
	n = int(input())
	a = list(map(int, input().split()))
	ans = 1
	a.sort(reverse=True)
	for i in range(n):
		if a[i] <= n - i - 1 + ans:
			ans += 1
	print(ans)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	d = [0] * (n + 2)
	d[0] = 1
	for i in a:
		if i < n + 2:
			d[i] += 1
	s = 1
	cur = 1
	for i in range(1, len(d)):
		cur += d[i]
		if cur - 1 >= i:
			s = cur
	print(s)


t = int(input())
for _ in range(t):
	n = int(input())
	a = sorted([int(i) for i in input().split()])
	k = 1
	for i in range(n):
		if a[i] <= i + 1:
			k = i + 2
	print(k)


import sys, bisect
input = sys.stdin.readline

def solve():
	n = int(input())
	al = list(map(int, input().split()))
	al.sort()
	cur = 1
	ans = 1
	for i in range(n):
		if al[i] <= cur:
			ans = cur + 1
		cur += 1
	print(ans)

def main():
	t = int(input())
	for i in range(t):
		solve()
main()


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
for _ in range(INT()):
	n = INT()
	arr = LIST()
	i = 0
	ans = 1
	arr.sort()
	i = 0
	while i < n:
		if arr[i] <= ans:
			ans += 1
			i += 1
		else:
			c = ans - 1
			for j in range(i, n):
				c += 1
				i += 1
				if arr[j] <= c:
					ans = c + 1
					break
	print(ans)


test = int(input())
for _ in range(test):
	n = int(input())
	alist = map(int, input().split())
	adict = {}
	for i in alist:
		if i in adict:
			adict[i] += 1
		else:
			adict[i] = 1
	asort = sorted(adict.items(), key=lambda x: x[0])
	count = 1
	nanny = 1
	need = 0
	for i in asort:
		nanny += i[-1]
		need = i[0]
		if nanny - 1 >= need:
			count = nanny
	print(count)


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	a = []
	l.sort(reverse=True)
	c = 0
	for i in range(1, n + 1):
		a.append(i)
	a.reverse()
	for i in range(n):
		if l[i] <= a[i]:
			break
		else:
			c += 1
	print(n + 1 - c)


t = int(input())
for _ in range(t):
	n = int(input())
	it = list(map(int, input().split()))
	it.sort()
	ans = 1
	ma = 0
	for i in range(n):
		ma = max(ma, it[i])
		if ma <= i + 1:
			ans = max(ans, i + 2)
	print(ans)


t = int(input())
count = 0
while count < t:
	count += 1
	n = int(input())
	l = list(map(int, input().split(' ')))
	l = sorted(l)
	num = 1
	i = 0
	while i < n:
		if num >= l[i]:
			num += 1
			i += 1
		elif i == n - 1:
			break
		else:
			test = i
			for j in range(test + 1, n):
				if j + 1 >= l[j]:
					num += j - test + 1
					i = j + 1
					break
				i += 1
	print(num)


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a = sorted(a)
	count = 1
	for i in range(len(a) - 1, -1, -1):
		if a[i] <= i + 1:
			count += i + 1
			break
	print(count)


T = int(input())
while T:
	n = int(input())
	A = list(map(int, input().split()))
	A.sort()
	i = 0
	x = 1
	while i < n:
		if A[i] <= i + 1:
			x = i + 2
		i = i + 1
	print(x)
	T = T - 1


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

def main():
	for _ in range(int(input())):
		n = int(input())
		arr = [int(k) for k in input().split()]
		arr.sort()
		res = 1
		counter = 1
		for i in range(n):
			if res >= arr[i]:
				res += 1
				counter = res
				continue
			else:
				res += 1
		print(counter)
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
import random
tc = int(input())
for _ in range(tc):
	cnt = dict()
	n = int(input())
	idx = set()
	element = list(map(int, sys.stdin.readline().split()))
	i = 0
	while i < n:
		if element[i] > 100000:
			i = i + 1
			continue
		try:
			cnt[str(element[i])] += 1
		except KeyError:
			cnt[str(element[i])] = 1
		i += 1
	max_num = 0
	ans = 0
	idx = list(map(int, cnt.keys()))
	idx.sort()
	for i in idx:
		max_num += cnt[str(i)]
		if i <= max_num:
			ans = max_num
	print(ans + 1)


from collections import Counter

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

def read_ints():
	ints = [int(x) for x in input().split(' ')]
	return ints

def solve(n, a):
	cntr = Counter(a)
	glist = list(cntr.keys())
	glist.sort()
	grannies = 1
	gacc = 0
	for i in range(len(glist)):
		gmin = glist[i]
		ngrannies = cntr[gmin] + grannies + gacc
		if ngrannies > gmin:
			grannies += cntr[gmin] + gacc
			gacc = 0
		else:
			gacc += cntr[gmin]
	return grannies
t = read_int()
for case in range(t):
	n = read_int()
	a = read_ints()
	sol = solve(n, a)
	print(sol)


import sys
pprint = lambda s: print(' '.join(map(str, s)))
input = lambda : sys.stdin.readline().strip()
ipnut = input
for i in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	ans = 1
	a.sort()
	for i in range(n):
		if i + 1 >= a[i]:
			ans = i + 2
	print(ans)


import sys, heapq
input = sys.stdin.buffer.readline
T = int(input())
for _ in range(T):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	res = 1
	for i in range(n - 1, -1, -1):
		if a[i] <= i + 1:
			res = i + 2
			break
	print(res)


for t in range(int(input())):
	n = int(input())
	x = [int(x) for x in input().split()]
	x.sort(reverse=True)
	i = n
	bool = False
	for g in range(n):
		if i < x[g]:
			i -= 1
		else:
			bool = True
			break
	if bool:
		print(i + 1)
	else:
		print(1)


from __future__ import division, print_function
mod = int(1000000000.0 + 7)
from sys import stdin, stdout
import bisect
from bisect import bisect_left as bl
from bisect import bisect_right as br
import itertools
from collections import Counter
import collections
import math
import heapq
import re

def modinv(n, p):
	return pow(n, p - 2, p)

def cin():
	return map(int, sin().split())

def ain():
	return list(map(int, sin().split()))

def sin():
	return input()

def inin():
	return int(input())

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

def most_frequent(list):
	return max(set(list), key=list.count)

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

def ncr(n, r, p):
	t = fact[n] * (ifact[r] * ifact[n - r] % p) % p
	return t

def Convert(string):
	li = list(string.split(''))
	return li

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[-1]
prime = []
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

def nextPerfectSquare(N):
	nextN = math.floor(math.sqrt(N)) + 1
	return nextN * nextN

def main():
	for _ in range(inin()):
		n = inin()
		a = ain()
		a.sort()
		count = 1
		temp = 1
		for i in range(n):
			if a[i] <= count:
				count += 1
				temp = count
			else:
				count += 1
		print(temp)
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()


test = int(input())
for i in range(test):
	n = int(input())
	arr = [int(x) for x in input().split()]
	arr.sort()
	size = len(arr)
	flag = True
	c = 0
	for i in range(size - 1, -1, -1):
		val = arr[i]
		if val <= size:
			print(size + 1)
			c = 1
			break
		else:
			size -= 1
	if c == 0:
		print(1)


for i in range(int(input())):
	a = input()
	a = [int(i) for i in input().split()]
	a.sort()
	maxgc = 0
	gc = 1
	for i in a:
		if i <= gc:
			gc += 1
		elif i <= maxgc + gc:
			gc += maxgc + 1
			maxgc = 0
		else:
			maxgc += 1
	print(gc)


n = int(input())
for i in range(n):
	m = int(input())
	l = sorted(list(map(int, input().split())))
	a = 0
	for k in range(m):
		if l[k] <= k + 1:
			a = k + 1
	print(a + 1)


from sys import stdin, stdout
from collections import Counter
t = int(input())
ans = []
for _ in range(t):
	n = int(stdin.readline())
	alist = list(map(int, stdin.readline().strip().split()))
	alist.sort()
	curr = 1
	for (i, num) in enumerate(alist):
		ssf = i + 1
		if ssf >= num:
			curr = ssf + 1
	ans.append(curr)
print(*ans, sep='\n')


for _ in range(int(input())):
	grannies = 1
	num = int(input())
	condn = list(map(int, input().split()))
	condn.sort()
	condn.insert(0, 0)
	for i in range(num, 0, -1):
		if condn[i] <= i:
			grannies = i + 1
			break
	print(grannies)


def Iint():
	return int(input())

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

def main():
	t = Iint()
	for _ in range(t):
		n = Iint()
		a = sorted(Ilist(), reverse=True)
		countg = n + 1
		for (i, ai) in enumerate(a):
			if ai >= countg:
				countg -= 1
			else:
				break
		print(countg)
main()


from sys import stdin
for _ in range(int(stdin.readline())):
	n = int(stdin.readline())
	arr = sorted(list(map(int, stdin.readline().split())))
	cou = 1
	x = 1
	for j in arr:
		if j > x:
			x += 1
		else:
			x += 1
			cou = x
	print(cou)


import sys
import math
t = int(sys.stdin.readline().strip())
for i in range(t):
	n = int(sys.stdin.readline().strip())
	l = sorted(list(map(int, sys.stdin.readline().strip().split(' '))))
	best = 0
	for (index, value) in enumerate(l):
		if value <= index + 1:
			best = index + 1
	print(best + 1)


import sys
import math
read = sys.stdin.buffer.read
input = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
t = int(input())
for case in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	ans = 0
	for i in range(n):
		if a[-1 - i] <= n - i:
			ans = n - i
			break
	print(ans + 1)


for _ in range(int(input())):
	n = int(input())
	lst = [int(i) for i in input().split()]
	lst.sort()
	flag = 0
	for i in range(n - 1, -1, -1):
		if lst[i] <= i + 1:
			print(i + 2)
			flag = 1
			break
	if flag == 0:
		print(1)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort(reverse=True)
	d = 10 ** 6
	for i in range(n):
		if a[i] <= n - i:
			d = i
			break
	if d == 10 ** 6:
		print(1)
	else:
		print(n - d + 1)


import sys
import math
import collections

def set_debug(debug_mode=False):
	if debug_mode:
		fin = open('input.txt', 'r')
		sys.stdin = fin
t = int(input())
for ti in range(1, t + 1):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	find = False
	for index in range(len(a) - 1, -1, -1):
		if index + 1 >= a[index]:
			print(index + 1 + 1)
			find = True
			break
	if not find:
		print(1)


t = int(input())
for q in range(t):
	n = int(input())
	li = list(map(int, input().split()))
	li = sorted(li)
	tot = 1
	flag = 1
	count = 0
	for i in range(n):
		if li[i] <= i + 1:
			tot += 1
			tot += count
			count = 0
		else:
			count += 1
	print(tot)


from collections import Counter
for _ in range(int(input())):
	input()
	a = Counter(map(int, input().split()))
	ans = 1
	new = 0
	for k in sorted(a.keys()):
		new += a[k]
		if ans + new > k:
			ans += new
			new = 0
	print(ans)


from collections import Counter, defaultdict, deque
from math import *
import sys
input = sys.stdin.readline

def solve():
	n = int(input())
	arr = [int(x) for x in input().split()]
	arr.sort()
	best = 1
	for i in range(n):
		if arr[i] <= i + 1:
			best = max(best, i + 2)
	print(best)
tt = int(input())
for test in range(tt):
	solve()


t = int(input())
for i in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort(reverse=True)
	j = 0
	while j < len(l):
		if l[j] <= len(l) - j:
			break
		j = j + 1
	s = len(l) + 1 - j
	print(s)


def ceremony(n, grannies):
	grannies.sort()
	for i in range(n - 1, -1, -1):
		if grannies[i] <= i + 1:
			return i + 2
	return 1
t = int(input())
for i in range(t):
	n = int(input())
	grannies = [int(s) for s in input().split()]
	print(ceremony(n, grannies))


t = int(input())
for x in range(t):
	n = int(input())
	l1 = [int(x) for x in input().split()]
	l1.sort()
	done = 0
	l2 = l1.copy()
	l2.reverse()
	i = 0
	while i < n and l2[i] > n - i:
		i += 1
	print(n - i + 1)


for _ in range(int(input())):
	granies = int(input())
	array = list(map(int, input().split()))
	array.sort()
	entered = 1
	remaining = 0
	position = 0
	for (x, y) in enumerate(array):
		if y < x + 2:
			remaining = x + 1
	print(remaining + 1)


import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush
from math import ceil, floor, gcd, fabs, factorial, fmod, sqrt, inf, log
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
mod = 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)]
for _ in range(int(data())):
	n = int(data())
	arr = l()
	arr.sort()
	s = 1
	answer = 1
	r = False
	for i in range(n):
		if s >= arr[i]:
			r = True
			answer = max(answer, i + 1)
		s += 1
	if r:
		answer += 1
	out(answer)


t = int(input())
while t:
	t -= 1
	n = int(input())
	a = input()
	a = a.split()
	a = list(map(int, a))
	a.sort()
	granies = 1
	i = 0
	while i < n:
		cur = 0
		while i < n and a[i] > granies + cur:
			cur += 1
			i += 1
		if i < n and a[i] <= granies + cur:
			if cur == 0:
				granies += 1
			else:
				granies += cur + 1
		i += 1
	print(granies)


numberofcases = int(input())
for _ in range(numberofcases):
	n = int(input())
	l = [int(t) for t in input().split()]
	l.sort()
	output = 1
	for i in range(n):
		if l[i] <= i + 1:
			output = i + 2
	print(output)


from sys import stdin
input = stdin.readline
import bisect
import math
for xoxo in range(1):
	for _ in range(int(input())):
		n = int(input())
		ans = 1
		a = list(map(int, input().split()))
		a.sort()
		(i, j) = (0, 1)
		while i < n:
			if a[i] < ans + j:
				ans = i + 2
				j = 0
			j += 1
			i += 1
		print(ans)


total_case = int(input())
for i in range(total_case):
	n = int(input())
	aline = input().split()
	aline = sorted([int(x) for x in aline])
	current = 1
	i = 0
	grannies = 0
	while i < n:
		grannies += 1
		i += 1
		if current + grannies - 1 >= aline[i - 1]:
			current = current + grannies
			grannies = 0
	print(current)


from itertools import groupby
t = int(input())
for _ in range(t):
	ans = 1
	cnt = 0
	input()
	for A in [(x, len(list(y))) for (x, y) in groupby(sorted(list(map(int, input().split()))))]:
		if A[0] < A[1] + ans + cnt:
			ans += A[1] + cnt
			cnt = 0
		else:
			cnt += A[1]
	print(ans)


t = int(input())
while t > 0:
	n = int(input())
	arr1 = input().split()
	arr1 = [int(i) for i in arr1]
	arr1.sort(reverse=True)
	ans = 0
	for i in range(len(arr1)):
		if len(arr1) - i - 1 + 1 >= arr1[i]:
			ans = len(arr1) - i
			break
	ans += 1
	print(ans)
	t -= 1


t = int(input())
for _ in range(t):
	n = int(input())
	a = [int(x) for x in input().split()]
	a.sort()
	i = n - 1
	while i >= 0:
		if a[i] <= i + 1:
			break
		i -= 1
	else:
		print(1)
		continue
	print(i + 2)


ans = []
for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	count = 0
	i = 0
	temp = [0] * n
	for i in range(n):
		if count + 1 >= l[i]:
			temp[i] = 1
		else:
			temp[i] = 0
		count += 1
	flag = 0
	for i in range(n - 1, -1, -1):
		if temp[i] == 1:
			flag = 1
			ans.append(i + 2)
			break
	if flag == 0:
		ans.append(1)
for i in ans:
	print(i)


from sys import stdin
from math import ceil
inp = lambda : stdin.readline().strip()
t = int(inp())
for _ in range(t):
	n = int(inp())
	a = [int(x) for x in inp().split()]
	a.sort()
	ans = 1
	maximum = -1
	total = 1
	array = []
	for i in a:
		maximum = max(maximum, i)
		array.append(i)
		if maximum <= total:
			ans += len(array)
			maximum = -1
			array = []
		total += 1
	print(ans)


def babushka(v, u):
	for i in range(v - 1, -1, -1):
		if u[i] <= i + 1:
			return i + 2
	return 1
t = int(input())
for _ in range(t):
	n = int(input())
	b = sorted([int(__) for __ in input().split()])
	print(babushka(n, b))


from math import *
t = int(input())
while t > 0:
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	g = 1
	backup = 0
	for i in a:
		if g + backup >= i:
			if backup == 0:
				g += 1
			else:
				backup += 1
				g += backup
				backup = 0
		else:
			backup += 1
	print(g)
	t -= 1


for loop in range(int(input())):
	n = int(input())
	(*a,) = map(int, input().split())
	a.sort()
	ans = 1
	for i in range(n):
		z = i + 1 - a[i]
		if z >= 0:
			ans = i + 2
	print(ans)


t = int(input())
Ans = []
for i in range(0, t):
	n = int(input())
	A = sorted([int(i) for i in input().split()])
	x = 1
	y = 0
	for j in range(0, n):
		if A[j] <= x:
			x += 1
		elif A[j] <= x + y:
			x += 1 + y
			y = 0
		else:
			y += 1
	Ans.append(x)
	x = 0
	y = 0
print(*Ans, sep='\n', end='')


num = int(input())
lst = []
for i in range(num):
	n = int(input())
	count = 0
	lst1 = sorted(list(map(int, input().split())))
	for j in range(n - 1, -1, -1):
		if lst1[j] <= j + 1:
			lst.append(j + 2)
			count += 1
			break
	if count == 0:
		lst.append(1)
for var in lst:
	print(var)


from __future__ import division, print_function
import os, sys
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip

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

def si():
	return input()

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

def msi():
	return map(str, input().strip().split(' '))

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

def dmain():
	sys.setrecursionlimit(1000000)
	threading.stack_size(1024000)
	thread = threading.Thread(target=main)
	thread.start()
abc = 'abcdefghijklmnopqrstuvwxyz'
abd = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}
mod = 1000000007
inf = float('inf')
vow = ['a', 'e', 'i', 'o', 'u']
(dx, dy) = ([-1, 1, 0, 0], [0, 0, 1, -1])

def getKey(item):
	return item[1]

def sort2(l):
	return sorted(l, key=getKey, reverse=True)

def d2(n, m, num):
	return [[num for x in range(m)] for y in range(n)]

def isPowerOfTwo(x):
	return x and (not x & x - 1)

def decimalToBinary(n):
	return bin(n).replace('0b', '')

def ntl(n):
	return [int(i) for i in str(n)]

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

def ceil(x, y):
	if x % y == 0:
		return x // y
	else:
		return x // y + 1

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

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

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 read():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		a = list(map(int, input().split()))
		a.sort()
		flag = 0
		for i in range(n - 1, -1, -1):
			if a[i] <= i + 1:
				print(i + 2)
				flag = 1
				break
		if flag != 1:
			print(1)
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))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


t = int(input())
while t != 0:
	t -= 1
	n = int(input())
	a = list(map(int, input().strip().split()))[:n]
	a.sort()
	m = 1
	j = len(a) - 1
	while j >= 0:
		if a[j] <= j + 1:
			m = j + 2
			break
		j -= 1
	print(m)


for i in range(int(input())):
	a = int(input())
	x = [int(x) for x in input().split()]
	x.sort(reverse=True)
	ans = 0
	for j in x:
		if j <= a:
			ans = a + 1
		else:
			a -= 1
	if ans == 0:
		print(1)
	else:
		print(ans)


for i in range(int(input())):
	n = int(input())
	a = sorted([int(x) for x in input().split()], reverse=True)
	k = -1
	while k != 0:
		a.append(n)
		a = sorted(a, reverse=True)
		t = a.index(n)
		if t != 0:
			n -= len(a[:t])
			a = a[t + 1:]
		elif not a:
			print(1)
			k = 0
		else:
			print(n + 1)
			k = 0


def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		s = list(map(int, input().split()))
		s.sort()
		cnt = 1
		i = 0
		while i < n:
			if s[i] <= cnt:
				cnt += 1
				i += 1
			else:
				while i < n:
					if s[i] == i + 1:
						cnt = i + 1
						break
					i += 1
		print(cnt)
main()


def solve(n, s):
	s.sort()
	for i in range(n - 1, -1, -1):
		if s[i] <= i + 1:
			return i + 2
	return 1
t = int(input())
for test in range(1, t + 1):
	n = int(input())
	s = list(map(int, input().rstrip().split()))
	result = solve(n, s)
	print(result)


import sys
import math
input = sys.stdin.readline

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()
	l = ain()
	l.sort()
	c = 0
	for i in range(n):
		if i + 1 >= l[i]:
			c = i + 1
	print(c + 1)


t = int(input())
import math
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	t = 0
	ans = 0
	while t < n:
		if t != n - 1 and a[t] == a[t + 1]:
			t += 1
			continue
		if a[t] <= t + 1:
			t += 1
			ans = t
		else:
			t += 1
	print(ans + 1)


t = int(input())
for i in range(t):
	n = int(input())
	inp = input().split(' ')
	inp = [int(x) for x in inp]
	inp = sorted(inp)
	max_index = 0
	for i in range(len(inp)):
		if i + 1 >= inp[i]:
			max_index = i + 1
	print(max_index + 1)


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	k = 1
	x = 1
	for j in range(n):
		if a[j] <= j + 1:
			k += x
			x = 1
		else:
			x += 1
	print(k)


t = int(input())
for j in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	total = 1
	for i in range(n - 1, -1, -1):
		if l[i] <= i + 1:
			total += i + 1
			break
	print(total)


t = int(input())
for _ in range(t):
	n = int(input())
	grands = list(map(int, input().split()))
	grands.sort()
	count = 1
	ans = 1
	m = 0
	for x in grands:
		m = x
		count += 1
		if count > m:
			ans = count
	print(ans)


from collections import Counter

def solve():
	n = int(input())
	l = list(map(int, input().split()))
	c = Counter(l)
	ans = n + 1
	res = [[i, j] for (i, j) in c.items()]
	res.sort()
	res = res[::-1]
	for i in res:
		if i[0] > ans - 1:
			ans -= i[1]
		else:
			break
	print(max(ans, 1))
t = int(input())
for _ in range(t):
	solve()


t = int(input())
for i in range(t):
	n = int(input())
	g = list(map(int, input().split()))
	g.sort()
	ini = 0
	for j in range(len(g)):
		if g[j] <= j + 1:
			ini = j + 1
	print(ini + 1)


from collections import defaultdict as dd
import math
import sys
input = sys.stdin.readline

def nn():
	return int(input())

def li():
	return list(input())

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

def lm():
	return list(map(int, input().split()))
q = nn()
for _ in range(q):
	n = nn()
	ex = lm()
	ex.sort()
	maxg = 1
	for i in range(n):
		if i + 1 >= ex[i]:
			maxg = i + 2
	print(maxg)


from sys import stdin
import math

def readline():
	return stdin.readline()
tests = int(readline())

def solve(n, a):
	result = n + 1
	a.sort(reverse=True)
	for i in range(0, n):
		if a[i] >= result:
			result -= 1
	return result
for t in range(0, tests):
	n = int(readline())
	a = list(map(int, readline().rstrip('\n').split(' ')))
	print(solve(n, a))


import sys
input = sys.stdin.readline
for nt in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	sub = 0
	for i in range(n - 1, -1, -1):
		if l[i] > i + 1:
			sub += 1
		else:
			break
	print(n - sub + 1)


def main():
	n = int(input())
	a = sorted(map(int, input().split()), reverse=True)
	for (i, b) in enumerate(a):
		if b > n:
			n -= 1
		else:
			print(n + 1)
			return
	print(1)
for _ in range(int(input())):
	main()


for q in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	ans = n + 1
	for i in range(n - 1, -1, -1):
		if arr[i] >= ans:
			ans -= 1
		else:
			break
	print(ans)


t = int(input())
for _ in range(t):
	n = int(input())
	al = list(map(int, input().split()))
	al.sort()
	gra = 1
	req = al[0]
	cnt = 1
	ind = 0
	while ind < n:
		if ind < n and cnt >= al[ind]:
			while ind < n and cnt >= al[ind]:
				cnt += 1
				ind += 1
		else:
			tc = 0
			while ind < n and tc + cnt < al[ind]:
				ind += 1
				tc += 1
			if ind < n:
				cnt += tc + 1
				ind += 1
			elif ind == n and al[-1] <= cnt + tc - 1:
				cnt += tc
		if ind == n:
			break
	print(cnt)


def main():
	t = int(input())
	for _ in range(t):
		_ = int(input())
		arr = [int(x) for x in input().split()]
		arr.sort(reverse=True)
		found = False
		for (i, n) in enumerate(arr):
			if len(arr) - i >= n:
				print(len(arr) - i + 1)
				found = True
				break
		if found == False:
			print('1')
main()


t = int(input())
i = 0
while i < t:
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	count = n
	for x in range(n - 1, -1, -1):
		a = x + 1
		if arr[x] <= a:
			break
		else:
			count = count - 1
	print(count + 1)
	i = i + 1


t = int(input())
while t:
	t -= 1
	n = int(input())
	a = [int(i) for i in input().split()]
	a.sort()
	curr = 1
	temp = 0
	for i in range(n):
		if curr + temp >= a[i]:
			curr += temp + 1
			temp = 0
		else:
			temp += 1
	print(curr)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	count = 1
	l = []
	for i in range(n):
		if a[i] <= count:
			count += 1
		else:
			l.append(a[i])
			if count + len(l) - 1 >= a[i]:
				count = count + len(l)
				l = []
	print(count)


t = int(input())
for u in range(t):
	n = int(input())
	a = [int(x) for x in input().split()]
	g = 1
	a.sort()
	w = 0
	for i in range(0, n):
		if g >= a[i]:
			g += 1
		elif g + w >= a[i]:
			g += w + 1
			w = 0
		else:
			w += 1
	print(g)


for i in range(int(input())):
	a = int(input())
	b = sorted(list(map(int, input().split())))
	r = 1
	z = 1
	q = 0
	for j in b:
		if j <= r:
			z += 1
			z += q
			q = 0
		else:
			q += 1
		r += 1
	print(z)


t = int(input())
while t:
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	c = 0
	p = -1
	for i in range(n):
		c += 1
		if a[i] <= c:
			p = i
	print(p + 2)
	t -= 1


from sys import stdin, stdout, exit as sys_ret
(f_input, f_print, f_flush) = (stdin.readline, stdout.write, stdout.flush)

def solve():
	size = int(f_input())
	babushka = sorted([int(i) for i in f_input().split()])
	for i in range(size - 1, -1, -1):
		if babushka[i] <= i + 1:
			f_print(str(i + 2) + '\n')
			return
	f_print('1\n')
for _ in range(int(f_input())):
	solve()


from math import ceil
import sys
input = sys.stdin.readline
from collections import defaultdict as dd
t = int(input())
while t:
	n = int(input())
	l = list(map(int, input().split()))
	d = dd(int)
	cou = 1
	for i in l:
		d[i] += 1
	res = 0
	l = set(l)
	l = list(l)
	l.sort()
	i = 0
	res = -1
	while i < len(l):
		if cou + d[l[i]] - 1 >= l[i]:
			res = i
			cou += d[l[i]]
		else:
			cou += d[l[i]]
		i += 1
	su = 0
	for i in range(res + 1):
		su += d[l[i]]
	print(su + 1)
	t -= 1


T = int(input())
for t in range(T):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	for k in range(n, -1, -1):
		if a[k - 1] <= k:
			print(k + 1)
			break
	if k == 0:
		print(1)


from collections import Counter
for _ in range(int(input())):
	(N, Max) = (int(input()), 1)
	X = sorted(list(map(int, input().split())))
	for i in range(N):
		if X[i] <= i + 1:
			Max = max(Max, i + 2)
	print(Max)


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

def ri():
	return int(input())

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

def ia_to_s(a):
	return ' '.join([str(s) for s in a])

def solve(n, a):
	a = sorted(a)
	i = n - 1
	while i >= 0 and a[i] > i + 1:
		i -= 1
	return i + 2

def main():
	for _ in range(ri()):
		n = ri()
		a = ria()
		print(solve(n, a))
main()


import sys
input = sys.stdin.readline

def main():
	t = int(input())
	for _ in range(t):
		_ = int(input())
		a = list(map(int, input().split()))
		a.sort()
		l = [i for (i, x) in enumerate(a) if i + 1 >= x]
		print(1 if len(l) == 0 else l[-1] + 2)
main()


t = int(input())
for i in range(t):
	n = int(input())
	a = [int(v) for v in input().split()]
	a.sort()
	j = n - 1
	m = n
	while j >= 0:
		if m >= a[j]:
			break
		else:
			m = m - 1
			j = j - 1
	print(m + 1)


n = int(input())
for i in range(n):
	k = int(input())
	l = list(map(int, input().split()))
	l.sort()
	m = 1
	la = -1
	for i in range(k):
		if m >= l[i]:
			la = i
		m = m + 1
	print(la + 2)


for test_i in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	ans = -1
	while ans >= -n and arr[ans] > n + ans + 1:
		ans -= 1
	print(n + ans + 2)


T = int(input())
for t_itr in range(T):
	N = int(input())
	A = list(map(int, input().rstrip().split()))
	A.sort()
	result = 0
	for i in range(N - 1, -1, -1):
		if A[i] <= i + 1:
			result = i + 1
			break
	print(result + 1)


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	k = -1
	for i in range(n):
		if a[n - i - 1] > n - i:
			pass
		else:
			k = n - i - 1
			break
	print(k + 2)


import sys
input = lambda : sys.stdin.readline().strip()
t = int(input())
while t:
	t -= 1
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	i = 0
	for j in range(n):
		if j + 1 >= a[j]:
			i = j + 1
	print(i + 1)


def read_ints():
	return [int(i) for i in input().strip().split()]
t = int(input())
for i in range(t):
	n = int(input())
	arr = read_ints()
	arr.sort()
	ans = 0
	for i in range(n):
		if i + 1 >= arr[i]:
			ans = i + 1
	print(ans + 1)


from collections import defaultdict
import sys, math
f = None
try:
	f = open('q1.input', 'r')
except IOError:
	f = sys.stdin
if 'xrange' in dir(__builtins__):
	range = xrange

def print_case_iterable(case_num, iterable):
	print('Case #{}: {}'.format(case_num, ' '.join(map(str, iterable))))

def print_case_number(case_num, iterable):
	print('Case #{}: {}'.format(case_num, iterable))

def print_iterable(A):
	print(' '.join(A))

def read_int():
	return int(f.readline().strip())

def read_int_array():
	return [int(x) for x in f.readline().strip().split(' ')]

def rns():
	a = [x for x in f.readline().split(' ')]
	return (int(a[0]), a[1].strip())

def read_string():
	return list(f.readline().strip())

def bi(x):
	return bin(x)[2:]
from collections import deque

def solution(A, n):
	A.sort()
	for i in range(n - 1, -1, -1):
		num_total = i + 1
		if A[i] <= num_total:
			return num_total + 1
	return 1

def main():
	T = read_int()
	for i in range(T):
		n = read_int()
		A = read_int_array()
		x = solution(A, n)
		if 'xrange' not in dir(__builtins__):
			print(x)
		else:
			(print >> output, str(x))
	if 'xrange' in dir(__builtins__):
		print(output.getvalue())
		output.close()
if 'xrange' in dir(__builtins__):
	import cStringIO
	output = cStringIO.StringIO()
main()


t = int(input())
for c in range(t):
	n = int(input())
	a = list(map(int, input().split(' ')))
	a.sort()
	ans = n + 1
	for i in range(n - 1, -1, -1):
		if a[i] > ans - 1:
			ans -= 1
		else:
			break
	print(ans)


def arr():
	return list(map(int, input().split()))
import sys
input = sys.stdin.readline
import math
for _ in range(int(input())):
	N = int(input())
	L = arr()
	L.sort()
	ans = 0
	for i in range(N):
		if L[i] <= i + 1:
			ans = i + 1
	print(ans + 1)


import sys
readline = sys.stdin.readline
T = int(readline())
Ans = [None] * T
for qu in range(T):
	N = int(readline())
	A = list(map(int, readline().split()))
	A.sort(reverse=True)
	ans = N + 1
	for i in range(N):
		if N - i >= A[i]:
			break
		ans -= 1
	Ans[qu] = ans
print('\n'.join(map(str, Ans)))


import math
t = int(input())
for i in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	tl = 1 + n
	c = 1
	arr.sort()
	for i in range(n - 1, -1, -1):
		if arr[i] < tl:
			if arr[i] <= i + 1:
				c = c + i + 1
				break
	print(c)


t = int(input())
res = [0] * t
for k in range(t):
	n = int(input())
	a = list(sorted(map(int, input().split())))
	i = len(a) - 1
	while i >= 0 and a[i] > i + 1:
		i -= 1
	res[k] = i + 2
print(*res, sep='\n')


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	dec = []
	for i in range(n):
		if i + 1 >= a[i]:
			dec.append('Y')
		else:
			dec.append('N')
	for ii in range(n):
		if dec[-1] == 'N':
			dec.pop()
		else:
			break
	print(len(dec) + 1)


t = int(input())
ladies = []
demand = [0] * t
last = 0
for i in range(t):
	n = int(input())
	ladies.append(n)
	demand[i] = sorted(list(map(int, input().split())))
for i in range(t):
	last = 0
	for j in range(ladies[i]):
		if demand[i][j] <= j + 1:
			last = j + 1
	print(last + 1)


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


import math
import time
from collections import defaultdict, deque
from sys import stdin, stdout
from bisect import bisect_left, bisect_right
t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, stdin.readline().split()))
	a.sort()
	ans = 1
	for i in range(n - 1, -1, -1):
		if a[i] <= i + 1:
			ans += i + 1
			break
	print(ans)


t = int(input())
cases = []
for i in range(t):
	n = int(input())
	case = list(map(int, input().split()))
	cases.append(case)
for case in cases:
	g = 1 + len(case)
	case.sort()
	for i in range(len(case)):
		if case[-1] <= len(case):
			print(g)
			break
		elif case[-1] > len(case):
			del case[-1]
			g -= 1
			if g == 1:
				print(g)


def solve(N, A):
	total = -1
	A.sort()
	for i in range(N - 1, -1, -1):
		if A[i] <= i + 1:
			total = i
			break
	if total == -1:
		print(1)
	else:
		print(total + 2)
t = int(input())
while t != 0:
	n = int(input())
	a = list(map(int, input().split(' ')))
	solve(n, a)
	t -= 1


t = int(input())
for i in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort(reverse=True)
	a = 0
	c = 0
	for j in l:
		if j <= n - a:
			c += n - a
			break
		else:
			a += 1
	print(c + 1)


c = int(input())
for i in range(c):
	cur = 1
	gm_num = int(input())
	gm_list = [int(i) for i in input().split()]
	gm_list.sort()
	gm_list.reverse()
	gm_len = len(gm_list)
	dec = 1
	for i in gm_list:
		if i <= cur + gm_len - dec:
			cur += 1
		dec += 1
	print(cur)


import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a = sorted(a)
	ans = 1
	for (i, val) in enumerate(a):
		cnt = i + 2
		if val + 1 <= cnt:
			ans = cnt
	print(ans)


from math import *
import sys
input = sys.stdin.buffer.readline
a = int(input())
for _ in range(a):
	b = int(input())
	c = list(map(int, input().split()))
	c.sort()
	t = b
	for x in range(b - 1, -1, -1):
		if c[x] > t:
			t -= 1
		else:
			break
	print(t + 1)


t = int(input())
while t > 0:
	n = input()
	arr = [int(x) for x in input().strip().split()]
	arr.sort()
	ans = 1
	pseudoAns = 1
	i = 0
	while i < len(arr):
		if ans >= arr[i]:
			ans += 1
		elif pseudoAns >= arr[i]:
			ans = pseudoAns + 1
		pseudoAns += 1
		i += 1
	print(ans)
	t -= 1


import sys
input = sys.stdin.readline
t = int(input())
import math
for t1 in range(t):
	n = int(input())
	l = list(map(int, input().split(' ')))
	l.sort()
	i = 0
	count = 1
	while i < n:
		left = l[i] - count
		if l[i] <= count:
			count += 1
			i += 1
		else:
			ind = i
			if i + left <= n - 1:
				while ind < n and ind + 1 < l[ind]:
					ind += 1
				if ind < n:
					count = ind + 2
				i = ind + 1
			else:
				break
	print(count)


def read():
	return list(map(int, input().split()))
for i in range(int(input())):
	n = int(input())
	arr = sorted(read())
	done = 0
	for i in range(n):
		if arr[~i] <= n - i:
			print(n - i + 1)
			done = 1
			break
	if not done:
		print(1)


t = int(input())
for _ in range(t):
	n = int(input())
	li = list(map(int, input().split()))
	li.sort()
	ans = 0
	cnt = 1
	g = 1
	for i in li:
		if i <= cnt + g - 1:
			cnt += g
			g = 1
		else:
			g += 1
	print(cnt)


import sys
import math
import collections
t = int(input())
for ti in range(1, t + 1):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	find = False
	for i in range(len(a) - 1, -1, -1):
		if i + 1 >= a[i]:
			print(i + 1 + 1)
			find = True
			break
	if not find:
		print(1)


t = int(input())
while t:
	t -= 1
	n = int(input())
	a = [int(x) for x in input().split()]
	a.sort()
	mx = 0
	for i in range(n):
		if a[i] <= i + 1:
			mx = i + 1
	print(mx + 1)


t = int(input())
for i in range(t):
	n = int(input())
	a = [int(s) for s in input().split()]
	a.sort()
	k = 1
	s = 1
	j = 0
	while j < n:
		if a[j] <= k:
			k += 1
			s = k
		else:
			k += 1
		j += 1
	print(s)


import math
a = int(input())
for i in range(0, a):
	b = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	c = 1
	for i in range(0, len(arr)):
		if i + 1 >= arr[i]:
			c = i + 2
	if c == 1:
		print(1)
	else:
		print(c)


t = int(input())
for i in range(t):
	n = int(input())
	w = [int(k) for k in input().split()]
	w.sort()
	while n and w[-1] > n:
		w.pop()
		n -= 1
	print(n + 1)


import math
for _ in range(int(input())):
	n = int(input())
	ar = list(map(int, input().split()))
	ar.sort()
	ans = 1
	for i in range(n - 1, -1, -1):
		if ar[i] <= i + 1:
			ans += 1 + i
			break
	print(ans)


t = int(input())
while t:
	t = t - 1
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	temp = n
	a = reversed(a)
	for j in a:
		if j <= n and temp >= j:
			break
		else:
			temp = temp - 1
	print(temp + 1)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a = sorted(a)
	count = True
	for i in range(n - 1, -1, -1):
		if a[i] <= i + 1:
			print(i + 2)
			count = False
			break
	if count:
		print(1)


for _ in range(int(input())):
	n = int(input())
	li = sorted(map(int, input().split()))
	while li[-1] > n:
		li.pop()
		n -= 1
		if n == 0:
			break
	print(len(li) + 1)


v = int(input())
for i in range(v):
	b = int(input())
	a = [int(x) for x in input().split()]
	a = sorted(a, reverse=True)
	count = 0
	for i in a:
		if i > b:
			b -= 1
		else:
			break
	print(b + 1)


for _ in range(int(input())):
	am = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	n = 1
	for i in range(am - 1, -1, -1):
		if arr[i] <= i + 1:
			print(i + 2)
			break
	else:
		print(1)


test_cases = int(input())

def testCase():
	amount_of_grannies = int(input().strip())
	granny_A = [int(x) for x in input().strip().split()]
	granny_A_sorted = sorted(granny_A)
	max_grannies = 1
	for i in range(amount_of_grannies - 1, -1, -1):
		if i + 1 >= granny_A_sorted[i]:
			max_grannies = i + 2
			break
	print(max_grannies)
for t in range(test_cases):
	testCase()


import math

def check(n, k):
	return n // 2 * k + math.ceil(k / 2) * (n % 2)

def solution():
	n = int(input())
	arr = list(map(int, input().split()))
	arr = sorted(arr)
	count = 1
	ans = 1
	for i in arr:
		if i <= count:
			ans = count + 1
		count += 1
	print(ans)
for _ in range(int(input())):
	solution()


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	max_num = 0
	for i in range(n):
		if i + 2 > l[i]:
			max_num = i + 1
	print(max_num + 1)


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	(x, cnt, p) = ([], 0, 0)
	for i in range(n):
		x.append(l[i])
		p += 1
		if x[-1] <= cnt + p:
			cnt += p
			p = 0
			x = []
	print(cnt + 1)


t = int(input())
ans = [1] * t
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	for j in reversed(range(n)):
		if a[j] <= j + 1:
			ans[i] += j + 1
			break
for i in range(t):
	print(int(ans[i]))


def solve(arr):
	ans = 1
	arr.sort()
	n = len(arr)
	for j in range(n - 1, -1, -1):
		if arr[j] <= j + 1:
			return j + ans + 1
	return 1

def main():
	t = int(input())
	i = 1
	while i <= t:
		n = int(input())
		arr = list(map(int, input().split()))
		print(solve(arr))
		i += 1
main()


for _ in range(int(input())):
	n = int(input())
	L = list(map(int, input().split()))
	L.sort()
	j = 0
	ans = 1
	for i in range(n):
		if L[i] <= ans + j:
			ans += 1 + j
			j = 0
		if L[i] > ans + j:
			j += 1
	print(ans)


def ques2(n, a):
	a = sorted(a)
	count = 1
	for i in range(n):
		if a[i] <= count:
			count += 1
		elif a[i] <= i + 1:
			count = a[i] + 1
	print(count)
t = int(input())
for i in range(t):
	n = int(input())
	a = [int(i) for i in input().split()]
	ans = ques2(n, a)
	ans


t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort(reverse=True)
	total = n
	for i in l:
		if i > total:
			total -= 1
	print(total + 1)


tst = input()
tst = int(tst)
while tst > 0:
	n = int(input())
	ls = list()
	ls.append(0)
	ipt = input().split()
	for idx in range(len(ipt)):
		var = int(ipt[idx])
		ls.append(var)
	ls.sort()
	ans = 0
	for idx in range(len(ls)):
		if ls[idx] <= idx:
			ans = idx + 1
	print(ans)
	tst = tst - 1


def shef(n, arr):
	arr.sort()
	count = n
	i = n - 1
	while True:
		if arr[i] <= count:
			return count + 1
		if i <= 0:
			return 1
		i -= 1
		count -= 1
for t in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	print(shef(n, arr))


t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	cnt = 1
	for (i, val) in enumerate(arr):
		if val <= i + 1:
			cnt = i + 2
	print(cnt)


from sys import stdin, stdout
import math
T = int(stdin.readline())
for i in range(T):
	n = int(stdin.readline())
	a = sorted(map(int, stdin.readline().split()), reverse=True)
	count = n
	for i in a:
		if count >= i:
			break
		else:
			count -= 1
	out = count + 1
	stdout.write(str(out) + '\n')


t = int(input())
res = []
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	f = 0
	for i in range(n - 1, -1, -1):
		if a[i] <= i + 1:
			f = 1
			res.append(i + 2)
			break
	if f == 0:
		res.append(1)
for i in res:
	print(i)


for i in range(int(input())):
	n = int(input())
	l = sorted(list(map(int, input().split())))
	flag = True
	a = 0
	ans = 0
	for i in range(n):
		if not flag:
			a += l[i] - l[i - 1] - 1
			if a == 0:
				flag = True
		if flag and i + 1 < l[i]:
			a = l[i] - i - 1
			flag = False
		if flag:
			ans = i + 1
	if flag:
		print(n + 1)
	else:
		print(ans + 1)


t = int(input())
while t:
	t -= 1
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	n = len(a)
	while a:
		n = len(a)
		if a[-1] > n:
			a.pop()
		else:
			break
	print(max(1, len(a) + 1))


import sys
from math import ceil, sqrt, sin, pi, tan
from collections import defaultdict
read = sys.stdin.buffer.readline
import heapq
mi = lambda : map(int, read().split())
li = lambda : list(mi())
cin = lambda : int(read())

def isp(n):
	i = 2
	while i * i <= n:
		if n % i == 0:
			return False
		i += 1
	return True
primes = []

def ps(sm):
	if sm < 0:
		return 1
	sq = int(sqrt(sm))
	if sq * sq == sm:
		return 0
	return 1

def check(s, d):
	for el in s:
		if int(el) in d:
			return False
	return True
for _t in range(cin()):
	n = cin()
	a = li()
	a.sort()
	ans = 0
	for i in range(n):
		if a[i] <= i + 1:
			ans = i + 1
	print(ans + 1)


for _ in range(int(input())):
	n = int(input())
	a = [int(x) for x in input().split()]
	a.sort()
	c = 1
	l = 0
	r = 0
	while r < n:
		if c >= a[l]:
			c += 1
			l += 1
			r += 1
		elif a[r] <= c + r - l:
			c += r - l + 1
			l = r + 1
			r = l
		else:
			r += 1
	print(c)


from collections import Counter
T = int(input())
for _ in range(T):
	n = int(input())
	a = list(map(int, input().split()))
	a = sorted(a)
	cnt = Counter(a)
	b = sorted(set(a))
	cur = 1
	ans = 1
	i = 0
	m = len(b)
	while i < m:
		if cur + cnt[b[i]] - 1 >= b[i]:
			cur += cnt[b[i]]
			ans = cur
			i += 1
		else:
			j = i
			while j < m:
				cur += cnt[b[j]]
				if cur - 1 >= b[j]:
					ans = cur
					break
				else:
					j += 1
			i = j + 1
	print(ans)


for _ in range(int(input())):
	lens = int(input())
	arrs = sorted([int(x) for x in input().split()])
	answ = 1
	for i in range(lens - 1, -1, -1):
		if arrs[i] <= i + 1:
			answ = i + 2
			break
	print(answ)


def solve():
	n = int(input())
	a = sorted(list(map(int, input().split())))
	result = 0
	for i in range(1, n + 1):
		if a[i - 1] <= i:
			result = i
	print(result + 1)

def main():
	for _ in range(int(input())):
		solve()
main()


import sys
input = sys.stdin.buffer.readline
t = int(input())
ans = []
for _ in range(t):
	n = int(input())
	(*a,) = map(int, input().split())
	a.sort()
	r = 0
	for (i, x) in enumerate(a):
		if x <= i + 1:
			r = i + 1
	ans.append(r + 1)
print('\n'.join(map(str, ans)))


for i in range(int(input())):
	s = int(input())
	l = list(map(int, input().split()))
	res = 1
	flag = 0
	l = sorted(l)
	for j in range(s):
		if j + 1 >= l[j]:
			res = j + 2
	print(res)


for i in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	p = 1
	for i in range(n):
		if a[i] <= i + 1:
			p = i + 2
	print(p)


for i in range(int(input())):
	a = int(input())
	l = list(map(int, input().split()))
	l.sort()
	l.reverse()
	for i in range(len(l)):
		if a >= l[i]:
			break
		else:
			a = a - 1
	print(a + 1)


import math
t = int(input())
while t > 0:
	n = int(input())
	l1 = [int(x) for x in input().split()]
	l = [1 for i in range(n + 1)]
	for i in range(1, n + 1):
		l[i] = l1[i - 1]
	l.sort()
	ans = 1
	for i in range(n + 1):
		if n - i >= l[n - i]:
			ans = n - i + 1
			break
	print(ans)
	t = t - 1


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())
entries = inp()
for i in range(entries):
	x = inp()
	l = inlt()
	l.sort()
	res = 0
	ll = range(x)
	for i in range(x):
		if l[i] <= i + 1:
			res = i + 1
	res += 1
	print(res)


from sys import stdin
T = int(stdin.readline().strip())
for caso in range(T):
	n = int(stdin.readline().strip())
	s = list(map(int, stdin.readline().strip().split()))
	s.sort()
	l = 0
	ans = 1
	x = 0
	for i in range(n):
		x += 1
		if x >= s[i]:
			ans = i + 2
	print(ans)


t = int(input())
for i in range(t):
	n = int(input())
	a = []
	a = list(map(int, input().split()))
	a = sorted(a)
	z = 0
	ans = 1
	for i in range(n):
		if a[i] <= ans + z:
			ans += 1
			ans += z
			z = 0
		else:
			z += 1
	print(ans)


import sys
_INPUT_LINES = sys.stdin.read().splitlines()
input = iter(_INPUT_LINES).__next__
tc = int(input())
for zzz in range(tc):
	n = int(input())
	arr1 = list(map(int, input().split()))
	arr1.sort()
	arr = []
	arr.append(0)
	for ele in arr1:
		arr.append(ele)
	cur = 0
	ans = 0
	for i in range(n + 1):
		if arr[i] <= cur:
			ans = i
		cur += 1
	print(ans + 1)


for _ in range(int(input())):
	n = input()
	a = [int(x) for x in input().split()]
	n = 1
	a.sort()
	for i in range(len(a)):
		if a[i] <= i + 1:
			n = i + 2
	print(n)


from sys import stdin, stdout
import collections
import heapq
import itertools
import functools
import math
import operator
import string
ALPHABET = string.ascii_lowercase
DIGITS = string.digits

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

def read_int():
	return int(read_line())

def read_arr():
	return read_line().split(' ')

def read_int_arr():
	return [int(x) for x in read_arr()]

def query_interactive(s):
	print(s)
	stdout.flush()

def solve():
	n = read_int()
	a = read_int_arr()
	f = collections.Counter(a)
	k = sorted(f.keys())
	cur = 1
	awaiting = 0
	for key in k:
		if f[key] + awaiting + cur > key:
			cur += f[key] + awaiting
			awaiting = 0
		else:
			awaiting += f[key]
	print(cur)

def main():
	T = 1
	T = read_int()
	for _ in range(T):
		solve()
main()


import sys
from collections import deque
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	total = n
	for i in range(n - 1, -1, -1):
		if a[i] > total:
			total -= 1
		else:
			break
	print(total + 1)


testy = int(input())
results = []
for i in range(testy):
	n = int(input())
	wejscie = list(map(int, input().split()))
	counts = [0] * (n + 1)
	for granny in wejscie:
		if granny < n + 1:
			counts[granny] += 1
	outside = 1
	missed = 0
	for j in range(len(counts)):
		if counts[j] > 0:
			if counts[j] + outside + missed - 1 >= j:
				outside = outside + counts[j] + missed
				missed = 0
			else:
				missed = missed + counts[j]
	results.append(outside)
for result in results:
	print(result)


t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	g = 1
	se = 0
	vg = 1
	for i in l:
		if vg >= i:
			se = 0
			g = vg + 1
		elif se >= 0:
			se = se - 1 + vg - i
		vg += 1
	print(g)


import sys
for t in range(int(input())):
	res = 0
	n = int(sys.stdin.readline().strip())
	s = list(map(int, sys.stdin.readline().strip().split()))
	s.sort()
	for i in range(n):
		if s[i] <= i + 1:
			res = i + 1
	print(res + 1)


import atexit
import io
import sys
import math
from collections import defaultdict, Counter
t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	c = 0
	start = -1
	for j in range(n):
		if a[j] <= j + 1:
			if start == -1:
				c += 1
			else:
				c += j - start + 1
				start = -1
		elif start == -1:
			start = j
	print(c + 1)


from sys import stdin, gettrace
if not gettrace():

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

def main():

	def solve():
		n = int(input())
		aa = [int(a) for a in input().split()]
		aa.sort()
		aan = list(enumerate(aa, 1))
		for (i, a) in aan[::-1]:
			if a <= i:
				print(i + 1)
				return
		print(1)
	q = int(input())
	for _ in range(q):
		solve()
main()


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

def solve():
	n = int(input())
	l1 = list(map(int, input().split()))
	l1.sort(reverse=True)
	c = 1
	while 1:
		if len(l1) == 0:
			print(c)
			return
		if l1[-1] <= c:
			l1.pop()
			c = c + 1
		else:
			m = 0
			while 1:
				try:
					p = c + m
					if p == l1[-1]:
						c = c + 1
						c = c + m
						m = 0
						l1.pop()
						break
					else:
						l1.pop()
						m = m + 1
				except:
					print(c)
					return
for _ in range(int(input())):
	solve()


n = int(input())
while n > 0:
	t = int(input())
	l = list(map(int, input().split(' ')))
	ans = 1
	l = sorted(l)
	for i in range(1, t + 1):
		if l[i - 1] <= i:
			ans = i + 1
		else:
			pass
	print(ans)
	n -= 1


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	d = {}
	for x in arr:
		if x not in d:
			d[x] = 1
		else:
			d[x] += 1
	ans = 1
	c = 1
	for x in sorted(d.keys()):
		c += d[x]
		if c - 1 >= x:
			ans = c
	print(ans)


for _ in range(int(input())):
	n = int(input())
	a = [int(a) for a in input().split()]
	a = sorted(a)
	c = 1
	l = [1]
	for i in range(n):
		if c >= a[i]:
			c = c + 1
			l.append(c)
		else:
			c = c + 1
	print(max(l))


import heapq

def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		a = list(map(int, input().split()))
		heapq.heapify(a)
		m = 0
		ans = 1
		for i in range(n):
			k = heapq.heappop(a)
			m += 1
			if ans + m > k:
				ans += m
				m = 0
		print(ans)
main()


test = int(input())
respostas = []

def calcular(granies):
	q = 1
	acompanhantes = 0
	for x in granies:
		if x <= q + acompanhantes:
			q += acompanhantes + 1
			acompanhantes = 0
		if x > q + acompanhantes:
			acompanhantes += 1
	return q
for x in range(test):
	n = int(input())
	granies = list(map(int, input().split()))
	granies.sort()
	respostas.append(calcular(granies))
for x in respostas:
	print(x)


t = int(input())
while t:
	t -= 1
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	p = 1
	c = 1
	n = 0
	for i in l:
		if p >= i:
			c += n + 1
			n = 0
		else:
			n += 1
		p += 1
	print(c)


for i in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	babushki_dict = {}
	for j in range(len(a)):
		if a[j] not in babushki_dict:
			babushki_dict[a[j]] = 1
		else:
			babushki_dict[a[j]] += 1
	a = set(a)
	a = sorted(list(a))
	babushki_sum = []
	k = 0
	for j in range(len(a)):
		k += babushki_dict[a[j]]
		babushki_sum.append(k)
	f = False
	j = len(a) - 1
	while not f and j >= 0:
		if babushki_sum[j] >= a[j]:
			f = True
		else:
			j -= 1
	if f:
		print(babushki_sum[j] + 1)
	else:
		print(1)


t = int(input())
for _ in range(t):
	n = int(input())
	s = list(map(int, input().split(' ')))
	s.sort()
	lis = []
	cur = s[0]
	count = 1
	for i in range(1, n):
		if cur == s[i]:
			count += 1
		else:
			lis.append([cur, count])
			cur = s[i]
			count = 1
	if n != 1:
		if cur == i:
			count += 1
		else:
			lis.append([cur, count])
			cur = s[i]
			count = 1
	else:
		lis.append([cur, count])
	abhi = 1 + len(s)
	for i in range(len(lis) - 1, -1, -1):
		if lis[i][0] >= abhi:
			abhi -= lis[i][1]
		else:
			break
	print(abhi)


t = int(input())
for j in range(t):
	n = int(input())
	x = [int(i) for i in input().split()]
	x = sorted(x)
	res = 1
	for i in range(n):
		if 1 + i >= x[i]:
			res = 2 + i
	print(res)


from sys import stdin, stdout

def maria_breaks_the_self_isolation(n, a):
	a.sort()
	res = 0
	for i in range(n):
		if a[i] <= i + 1:
			res = i + 1
	return res + 1
t = int(stdin.readline())
for i in range(t):
	n = int(stdin.readline())
	a = list(map(int, stdin.readline().split()))
	stdout.write(str(maria_breaks_the_self_isolation(n, a)) + '\n')


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, grannies):
	latest = -1
	for i in range(len(grannies)):
		total = i + 2
		if total >= grannies[i] + 1:
			latest = i
	if latest == -1:
		return 1
	return latest + 2
test_cases = inp()
for i in range(test_cases):
	N = inp()
	grannies = inlt()
	grannies = sorted(grannies)
	print(solve(N, grannies))


from sys import stdin, stdout
for _ in range(int(stdin.readline())):
	n = int(stdin.readline())
	arr = list(map(int, stdin.readline().split()))
	arr.sort()
	prev = -1
	ans = 1
	for i in range(n):
		if arr[i] <= i + 1:
			ans += i - prev
			prev = i
	stdout.write(str(ans) + '\n')


from sys import stdin
t = int(input())
for _ in range(t):
	n = int(stdin.readline())
	l = list(map(int, stdin.readline().split()))
	l.sort()
	x = 1
	y = 0
	for e in l:
		if e <= x + y:
			x += 1
			x += y
			y = 0
		else:
			y += 1
	print(x)


for _ in range(int(input())):
	n = int(input())
	A = sorted(map(int, input().split()))
	for i in range(1, n):
		A[-i - 1] = min(A[-i - 1], A[-i] - 1)
	k = 1
	for i in range(n):
		if A[i] > i + 1:
			break
		k += 1
	print(k)


t = int(input())
while t:
	n = int(input())
	l1 = list(map(int, input().split()))
	l1.sort()
	count = 1
	for i in range(0, n):
		if l1[i] > i + 1:
			pass
		else:
			count = i + 2
	print(count)
	t = t - 1


import math
inp = lambda : map(int, input().split())
t = int(input())
for _ in range(t):
	n = int(input())
	l = list(inp())
	l = sorted(l)
	l.insert(0, 0)
	pre = 1
	count = pre
	res = 0
	for i in range(n, 0, -1):
		if l[i] <= i:
			pre += i
			break
	print(pre)


for _ in range(int(input())):
	n = int(input())
	a = sorted(list(map(int, input().split())))
	c = 1
	i = 0
	while i < n:
		if a[i] <= c:
			i += 1
			c += 1
		else:
			j = i + 1
			while j < n and a[j] > c + j - i:
				j += 1
			if j < n and a[j] <= c + j - i:
				c += j - i
				i = j
			else:
				break
	print(c)


import io
import os
from collections import Counter, defaultdict, deque

def solve(N, A):
	counts = Counter(A)
	curr = 0
	waiting = 0
	for k in sorted(counts.keys()):
		v = counts[k]
		if curr + waiting + v >= k:
			curr += waiting + v
			waiting = 0
		else:
			waiting += v
	return curr + 1
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
T = int(input())
for t in range(T):
	(N,) = [int(x) for x in input().split()]
	A = [int(x) for x in input().split()]
	ans = solve(N, A)
	print(ans)


n = int(input())
while n:
	ans = 0
	count = 0
	m = input()
	a = input()
	a = a.split()
	a = list(map(int, a))
	a.sort()
	for ele in a:
		count += 1
		if ele <= count:
			ans = count
	print(ans + 1)
	n -= 1


T = int(input())
for _ in range(T):
	n = int(input())
	a = [int(x) for x in input().split()]
	a.sort()
	count = 1
	for (i, x) in enumerate(a):
		if x <= i + 1:
			count = i + 2
	print(count)


import math

def rn():
	a = int(input())
	return a

def rl():
	a = list(map(int, input().split()))
	return a
for _ in range(int(input())):
	n = rn()
	a = rl()
	a.sort()
	ans = 1
	for i in range(n - 1, -1, -1):
		if a[i] <= i + 1:
			ans = i + 2
			break
	print(ans)


t = int(input())
for i in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	sum = 1
	p = 1
	for i in range(n):
		if sum + 1 > arr[i]:
			p = sum + 1
		sum += 1
	print(p)


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort(reverse=True)
	total = n
	for i in range(len(arr)):
		if arr[i] > total:
			total -= 1
	print(total + 1)


def process(n, a):
	ans = 1
	for i in range(n):
		x = a[i]
		if x <= i + 1:
			ans = i + 2
	print(ans, '\n')

def main():
	n = int(input())
	a = map(int, input().split())
	a = list(a)
	a.sort()
	process(n, a)
test = int(input())
while test > 0:
	test -= 1
	main()


for i in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a = sorted(a)
	b = []
	for i in range(n):
		b.append(0)
		if i + 1 >= a[i]:
			b[i] = i + 2
	print(max(max(b), 1))


import math
t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	z = 0
	for i in range(n - 1, -1, -1):
		if i + 1 >= a[i]:
			z = -1
			break
	if z == 0:
		print(1)
	else:
		print(i + 1 + 1)


def answer(n, A):
	A.sort()
	l = [i for i in range(2, n + 2)]
	for i in range(n - 1, -1, -1):
		if A[i] <= l[i] - 1:
			return l[i]
	return 1
t = int(input())
for i in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	print(answer(n, arr))


def solve():
	input()
	arr = input().split()
	arr = list(map(lambda x: int(x), arr))
	arr.sort()
	total = 1
	ans = 1
	for el in arr:
		if total >= el:
			ans = total + 1
		total += 1
	return ans
cases = int(input())
ans = []
for case in range(cases):
	ans.append(solve())
for el in ans:
	print(el)


import sys
reader = (s.rstrip() for s in sys.stdin)
input = reader.__next__

def gift():
	for _ in range(t):
		n = int(input())
		granny = list(map(int, input().split()))
		granny.sort()
		ans = 1
		for i in range(n):
			currgr = granny[n - 1 - i]
			if currgr <= n - i:
				ans = n - i + 1
				break
		yield ans
t = int(input())
ans = gift()
print(*ans, sep='\n')


for _ in range(int(input())):
	a = int(input())
	b = list(map(int, input().split()))
	b.sort()
	l = 1
	for i in range(a):
		if b[i] <= i + 1 and b[i] <= a:
			l = i + 2
	print(l)


t = int(input())
for i in range(t):
	n = int(input())
	grannies = sorted([int(x) for x in input().split()])
	count = 1
	maxcount = 1
	for k in grannies:
		if k < count + 1:
			maxcount = count + 1
		count += 1
	print(maxcount)


for t in range(int(input())):
	l = int(input())
	arr = sorted(list(map(int, input().split())))
	m = 0
	for i in range(l - 1, -1, -1):
		if arr[i] <= i + 1:
			m = i + 1
			break
	print(m + 1)


t = int(input())
while t:
	n = int(input())
	a = list(map(int, input().rstrip().split()))
	b = sorted(a)
	ans = 1
	for i in range(n):
		if i + 1 >= b[i]:
			ans = i + 2
	print(ans)
	t -= 1


import sys

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()
	A.sort()
	ans = sm = 1
	for a in A:
		if sm >= a:
			ans = sm + 1
		sm += 1
	print(ans)


import sys
input = sys.stdin.readline
import math
import bisect

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

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

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

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

def from_file(f):
	return f.readline

def solution(n, A):
	A.sort()
	s = 0
	e = len(A)
	cur = 1
	index = 0
	while index < len(A):
		ai = A[index]
		if ai <= cur:
			cur += 1
			index += 1
			continue
		w = 0
		tmp = index
		while tmp < len(A):
			d = A[tmp] - cur
			w += 1
			if w > d:
				cur += tmp - index + 1
				index = tmp + 1
				break
			tmp += 1
		if tmp == len(A):
			break
	return cur
t = inp()
for _ in range(t):
	n = inp()
	A = inlt()
	print(solution(n, A))


from math import ceil, floor
from queue import LifoQueue

def print_sol(c, sol):
	print('Case #{}: {}'.format(c, sol))

def rd_int():
	return int(input())

def rd_str():
	return input()

def rd_str_lst():
	return input().split(' ')

def sp_str_lst():
	return list(input())

def rd_int_lst():
	return [int(i) for i in rd_str_lst()]

def sp_int_lst():
	return [int(i) for i in sp_str_lst()]

def dfs(g, i, v):
	v[i] = True
	for j in g[i]:
		if not v[j]:
			dfs(g, j, v)
	print(i)

def dfs_iter(g, i, n):
	v = [False] * n
	stack = LifoQueue()
	stack.put(i)
	while stack.not_empty:
		u = stack.get()
		v[u] = True
		print(u)
		for i in g[u]:
			if not v[i]:
				stack.put(i)

def main():
	t = rd_int()
	for c in range(1, t + 1):
		n = rd_int()
		a = rd_int_lst()
		a.sort()
		gin = 1
		i = 0
		while i < n:
			if gin >= a[i]:
				gin += 1
				i += 1
			else:
				inc = 0
				while i < n:
					if gin + inc >= a[i]:
						gin += inc
						break
					else:
						i += 1
						inc += 1
		print(gin)
main()


import sys
input = sys.stdin.readline

def solve(a):
	premax = [0] * len(a)
	premax[0] = a[0]
	for i in range(1, len(a)):
		premax[i] = max(premax[i - 1], a[i])
	for i in range(len(a) - 1, -1, -1):
		if i + 1 >= premax[i]:
			return i + 2
	return 1
t = int(input())
for _ in range(t):
	n = int(input())
	a = map(int, input().split())
	print(solve(sorted(a)))


for _ in range(int(input())):
	n = int(input())
	l = [int(j) for j in input().split()]
	l.sort()
	s = 1
	for i in range(n - 1, -1, -1):
		if l[i] <= i + 1:
			s += i + 1
			break
	print(s)


for i in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	ans = n + 1
	j = len(arr) - 1
	while j >= 0:
		if arr[j] > n:
			ans -= 1
			n -= 1
		else:
			break
		j -= 1
	print(ans)


def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		a = list(map(int, input().split()))
		if n == 1:
			if a[0] == 1:
				print(2)
			else:
				print(1)
			continue
		a.sort()
		ans = 1
		for (idx, i) in enumerate(a):
			if idx + 1 >= i:
				ans = idx + 2
		print(ans)
	return
main()


n = int(input())
for i in range(0, n):
	a = int(input())
	t = 0
	l = [int(x) for x in input().split()]
	l.sort()
	for j in range(a - 1, -1, -1):
		if l[j] <= j + 1:
			ans = j + 2
			print(ans)
			t = 1
			break
	if t == 0:
		print(1)


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 main():
	t = I()
	rr = []
	for _ in range(t):
		n = I()
		a = LI()
		r = 0
		a = sorted(a)
		for i in range(n):
			if a[i] <= i + 1:
				r = i + 1
		rr.append(r + 1)
	return JA(rr, '\n')
print(main())


for _ in range(int(input())):
	n = int(input())
	l = sorted(list(map(int, input().split())))
	k = 1
	for i in range(n):
		if l[i] <= i + 1:
			k = i + 2
	print(k)


t = int(input())
while t:
	n = int(input())
	grannies = [int(x) for x in input().split()]
	grannies.sort()
	bgs = 1
	bpgs = 1
	for g_count in grannies:
		if g_count <= bgs:
			bgs += 1
		elif g_count <= bpgs:
			bgs = bpgs + 1
		bpgs += 1
	print(bgs)
	t -= 1


def getCnt(l: list) -> int:
	cnt = len(l) + 1
	for i in range(len(l) - 1, -1, -1):
		if l[i] > cnt - 1:
			cnt -= 1
		else:
			break
	return cnt
t = int(input())
while t > 0:
	n = int(input())
	l = list(map(lambda x: int(x), input().strip().split()))
	l.sort()
	print(getCnt(l))
	t -= 1


I = lambda : list(map(int, input().split()))
t = I()[0]
while t:
	t -= 1
	n = I()[0]
	arr = I()
	arr.sort()
	c = 1
	ans = 0
	for i in range(n):
		if c >= arr[i]:
			ans = i + 1
		c += 1
	print(ans + 1)


import sys, math
input = sys.stdin.readline
T = int(input())
for _ in range(T):
	n = int(input())
	A = list(map(int, input().split()))
	A.sort()
	(cv, tv, rv) = (1, 1, 0)
	for i in range(n):
		if A[i] - cv <= 0:
			tv = i + 2
			rv = 0
			cv = tv
		else:
			rv = A[i] - cv - 1
			cv = cv + 1
	print(tv)


T = int(input())
for t in range(T):
	n = int(input())
	l = sorted(list(map(int, input().rstrip().split())))
	granny = 1
	for i in range(len(l)):
		if l[i] <= i + 1:
			granny = i + 2
	print(granny)


import sys
input = sys.stdin.readline
flush = sys.stdout.flush
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	if a[n - 1] <= n:
		print(n + 1)
		continue
	print(max([i for i in range(n) if a[i] <= i + 1] + [-1]) + 2)


from sys import stdin, stdout
read = stdin.readline
puts = stdout.write

def solve():
	read()
	grannies = [1] + [int(i) for i in read().split()]
	grannies.sort()
	i = 1
	selected = 1
	while i < len(grannies):
		temp_selected = selected
		if selected >= grannies[i]:
			selected += 1
			i += 1
			continue
		while i < len(grannies) and temp_selected < grannies[i]:
			temp_selected += 1
			i += 1
		if i < len(grannies):
			selected = temp_selected
	print(f'{selected}')
for i in range(int(read())):
	solve()


for _ in range(0, int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	a.reverse()
	flag = 1
	for i in range(0, n):
		zz = n - i
		if a[i] <= zz:
			flag += zz
			print(flag)
			break
		else:
			continue
	if flag == 1:
		print(flag)


n = int(input())
for _ in range(n):
	t = int(input())
	l = [int(x) for x in input().split()]
	l.sort()
	temp = 0
	for i in range(t):
		l[i] = l[i] - i - 1
	for j in range(t):
		if l[j] <= 0:
			temp = j + 1
	print(temp + 1)


t = int(input())
while t > 0:
	n = int(input())
	arr = [int(x) for x in input().split()]
	temp = arr.copy()
	temp.sort()
	ans = 1
	for i in reversed(range(n)):
		if i + 1 >= temp[i]:
			ans = i + 2
			break
	print(ans)
	t -= 1


t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	ct = 0
	ideal = [i for i in range(1, n + 1)]
	for i in range(n):
		if arr[i] <= ideal[i]:
			ct = ideal[i]
		else:
			pass
	print(ct + 1)


import sys
import math
from collections import defaultdict

def solve(test):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	ans = 1
	count = 1
	for i in range(n):
		if a[i] <= count:
			count += 1
			ans = count
		else:
			count += 1
	print(ans)
test_cases = int(input())
for t in range(1, test_cases + 1):
	solve(t)


def solve():
	nu = int(input())
	l = list(map(int, input().rstrip().split()))
	l.sort()
	sub = 0
	grannies = 1
	for i in range(len(l)):
		if l[i] <= grannies + sub:
			grannies += 1 + sub
			sub = 0
		else:
			sub += 1
	print(grannies)
test = int(input())
for i in range(test):
	solve()


def solution():
	n = int(input())
	a = sorted(list(map(lambda x: int(x), input().split())))
	lf = 0
	rf = 0
	while lf < n and rf < n:
		while lf < n and lf + 1 >= a[lf]:
			lf += 1
		rf = lf
		while rf < n and rf + 1 < a[rf]:
			rf += 1
		if rf < n and rf + 1 <= a[rf]:
			lf = rf
	print(lf + 1)
t = int(input())
for _ in range(t):
	solution()


t = int(input())
for i in range(t):
	n = int(input())
	a = [int(i) for i in input().split()]
	a.sort()
	g = 1
	for i in range(n):
		if a[i] <= g:
			g += 1
		else:
			for k in range(i + 1, n):
				if a[k] <= k + 1:
					g = k + 2
			break
	print(g)


for t in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	ga = 1
	j = 0
	f = True
	for i in range(n):
		if a[i] <= ga:
			ga += 1
			f = True
		else:
			if f:
				j = i
				f = False
			if i + 1 - j + ga > a[i]:
				ga += i + 1 - j
				f = True
	print(ga)


T = int(input())
while T > 0:
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	d = {}
	for j in l:
		if j in d.keys():
			d[j] += 1
		else:
			d[j] = 1
	p = 1
	s = 0
	for (k, v) in d.items():
		if p + v - 1 + s >= k:
			p = p + v + s
			s = 0
		else:
			s += v
	print(p)
	T -= 1


T = int(input())
for t in range(0, T):
	n = int(input())
	A = list(map(int, input().split()))
	count = 1
	A.sort()
	i = 0
	flag = 0
	while flag == 0:
		if A[i] <= i + 1:
			count = i + 2
		i += 1
		if i == n:
			flag = 1
	print(count)


import sys
input = sys.stdin.readline

def intInput():
	return int(input())

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

def strInput():
	return input()
from collections import Counter

def soln(arr):
	ctr = Counter(arr)
	result = 0
	currSum = 0
	for num in sorted(ctr):
		currSum += ctr[num]
		if currSum > num:
			result = currSum
	return result

def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		arr = [0] + [int(x) for x in input().split()]
		result = soln(arr)
		print(result)
main()


cases = int(input())
for i in range(cases):
	n = int(input())
	l2 = input().split(' ')
	arr = []
	for a in l2:
		arr.append(int(a))
	arr.sort(reverse=True)
	ans = 0
	for j in range(len(arr)):
		ele = arr[j]
		length = len(arr) - j - 1
		if ele <= length + 1:
			ans = length + 1
			break
	print(ans + 1)


from sys import stdin, stdout
t = int(stdin.readline())
for _ in range(t):
	n = int(stdin.readline())
	arr = list(map(int, stdin.readline().strip().split()))
	arr = sorted(arr)
	gran = 1
	for i in range(n):
		if arr[i] < i + 2:
			gran = i + 2
	print(gran)


t = int(input())
for case in range(t):
	n = int(input())
	a = [int(x) for x in input().split(' ')]
	a.sort()
	ans = 1
	for i in range(n):
		if a[i] <= i + 1:
			ans = i + 2
	print(ans)


cases = int(input())
while cases:
	cases -= 1
	num = int(input())
	arr = sorted(map(int, input().split()))
	granny = 0
	ans = 1
	added = False
	for n in arr:
		granny += 1
		if granny >= n:
			ans = granny
			added = True
	if not added:
		print(ans)
	else:
		print(ans + 1)


t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	dic = {}
	for i in l:
		if i in dic.keys():
			dic[i] += 1
		else:
			dic[i] = 1
	party = 1
	spare = 0
	for (k, v) in dic.items():
		if party + v - 1 + spare >= k:
			party = party + v + spare
			spare = 0
		else:
			spare += v
	print(party)


for i in range(int(input())):
	n = int(input())
	arr = [int(i) for i in input().split()]
	arr.sort()
	t = -1
	for i in range(n):
		if arr[i] <= i + 1:
			t = i
	print(t + 2)


for u in range(int(input())):
	n = int(input())
	x = [int(w) for w in input().split()]
	y = sorted(x)
	s = n
	for i in range(n - 1, -1, -1):
		if y[i] > s:
			s -= 1
	print(s + 1)


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	x = 1
	for i in range(len(a)):
		if i + 1 >= a[i]:
			x = i + 1 + 1
	print(x)


for q in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	i = n - 1
	max_number = n
	while i >= 0 and a[i] > max_number:
		i -= 1
		max_number -= 1
	print(max_number + 1)


t = int(input())
for _ in range(t):
	m = int(input())
	s = input()
	n = list(map(int, s.split()))
	c = 1
	k = 0
	f = 0
	n.sort()
	for i in range(m):
		if n[i] <= c:
			c += 1
			f = 1
		elif c + k >= n[i]:
			c = c + k + 1
			k = 0
		else:
			k += 1
	print(c)


def solve(a, n):
	invite = n
	d = {}
	li = []
	for el in a:
		if el in d:
			d[el] += 1
		else:
			d[el] = 1
			li.append(el)
	i = len(li) - 1
	while i >= 0:
		if invite >= li[i]:
			break
		else:
			invite -= d[li[i]]
			i -= 1
	print(invite + 1)
test = 1
test = int(input())
for t in range(0, test):
	n = int(input())
	arr = [int(x) for x in input().split()]
	arr.sort()
	solve(arr, n)


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')
import bisect
t = int(input())
for j in range(t):
	n = int(input())
	vals = list(map(int, input().split()))
	vals.sort()
	norms = list(range(1, n + 1))
	init = 1
	for k in range(n - 1, -1, -1):
		if vals[k] <= norms[k]:
			init = k + 2
			break
	print(init)


test = int(input())
while test != 0:
	n = input()
	lists = list(map(int, input().split()))
	lists.sort()
	ans = 0
	count = 0
	for each in lists:
		count = count + 1
		if each <= count:
			ans = count
	print(ans + 1)
	test = test - 1


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	max_a = len(a)
	for value in a[::-1]:
		if value > max_a:
			max_a -= 1
		else:
			break
	print(max_a + 1)


for t in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort(reverse=True)
	while len(l) > 0 and l[0] > len(l):
		l.pop(0)
	print(len(l) + 1)


import math as mt
import sys, string
input = sys.stdin.readline
from collections import defaultdict
L = lambda : list(map(int, input().split()))
Ls = lambda : list(input().split())
M = lambda : map(int, input().split())
I = lambda : int(input())
t = I()
for i in range(t):
	n = I()
	l = L()
	l.append(0)
	l.sort(reverse=True)
	for i in range(n + 1):
		if l[i] <= n - i:
			print(n - i + 1)
			break


T = int(input())
for i in range(T):
	n = int(input())
	l = list(map(int, input().split()))
	l = sorted(l)
	ans = 0
	for i in range(n - 1, -1, -1):
		e = l[i]
		if e <= i + 1:
			ans = i + 1
			break
	print(ans + 1)


for i in range(int(input())):
	a = int(input())
	b = sorted(list(map(int, input().split())))
	r = 1
	for j in range(a - 1, -1, -1):
		if b[j] <= j + 1:
			r = j + 2
			break
	print(r)


a = int(input())
for i in range(0, a):
	o = int(input())
	i = list(map(int, input().split()))
	j = sorted(i)
	l = 1
	h = len(i)
	for k in j:
		if j[h - 1] <= h:
			l += h
			break
		h -= 1
	print(l)


def solve(n, a):
	a = sorted(a)
	i = n
	while i > 0:
		if a[i - 1] <= i:
			return i + 1
		i -= 1
	return 1

def main():
	inp = lambda : [int(x) for x in input().split()]
	inn = lambda : int(input())
	t = inn()
	for _ in range(t):
		n = inn()
		a = inp()
		print(solve(n, a))
main()


from sys import stdin
for _ in range(int(input())):
	n = int(input())
	list1 = list(map(int, stdin.readline().strip().split()))
	list1.sort()
	c = 1
	s = 0
	m = 0
	l = 0
	for i in range(n):
		l += 1
		if list1[i] > m:
			m = list1[i]
		if m <= l:
			if l > s:
				s = l
	print(s + 1)


def solve():
	n = int(input())
	li = [int(x) for x in input().split()]
	li.sort()
	curr = 1
	i = 0
	while i < n:
		temp = curr
		while temp < li[i]:
			i += 1
			temp += 1
			if i >= n:
				print(curr)
				return
		else:
			i += 1
			curr = temp + 1
			if i >= n:
				print(curr)
				return
t = int(input())
for i in range(t):
	solve()


for ii in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	l = n
	ans = 1
	for i in reversed(a):
		if i <= n and l >= i:
			ans += l
			break
		else:
			l -= 1
	print(ans)


def solve():
	n = int(input())
	a = sorted(map(int, input().split()))
	ans = 1
	for i in range(1, n + 1):
		if a[i - 1] < i + 1:
			ans = max(ans, i + 1)
	print(ans)
t = int(input())
for _ in range(t):
	solve()


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	count = 1
	idx = 0
	while idx < n:
		curr = count
		while idx < n:
			if arr[idx] <= curr:
				curr += 1
				idx += 1
				count = curr
				break
			idx += 1
			curr += 1
	print(count)


from sys import stdin, stdout

def find(arr, N):
	arr.sort()
	for i in range(N)[::-1]:
		if i + 1 >= arr[i]:
			return i + 1 + 1
	return 1

def main():
	for _ in range(int(stdin.readline())):
		N = int(stdin.readline())
		arr = list(map(int, stdin.readline().split()))
		print(find(arr, N))
main()


for i in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	ct = 1
	ct1 = 1
	a.sort()
	b = {}
	for i in a:
		if i in b:
			b[i] += 1
		else:
			b[i] = 1
	for i in b:
		ct1 += b[i]
		if i <= ct or ct + b[i] - 1 >= i or ct1 - 1 >= i:
			ct = ct1
	print(ct)


import sys
import collections
input = sys.stdin.readline

def main():
	t = int(input())
	for _ in range(t):
		N = int(input())
		A = [int(x) for x in input().split()]
		A.sort()
		ans = 1
		for (i, aa) in enumerate(A):
			if i + 1 >= aa:
				ans = i + 2
		print(ans)
main()


t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	final = 1
	i = 0
	while i < n:
		if final >= arr[i]:
			final += 1
			i += 1
		else:
			j = i
			x = False
			pot = 0
			while j < n:
				if final + pot >= arr[j]:
					x = True
					final += j - i + 1
					i = j + 1
					break
				else:
					pot += 1
					j += 1
			if not x:
				break
	print(final)


t = int(input())
for i in range(0, t):
	n = int(input())
	a = [int(i) for i in input().split()]
	b = 1
	a.sort()
	for j in range(0, n):
		if j + 1 >= a[j]:
			b = j + 2
	print(b)


def solN():
	n = int(input())
	r = list(map(int, input().split()))
	r.sort()
	i = n - 1
	while i >= 0:
		if r[i] <= n:
			break
		else:
			n -= 1
			i -= 1
	print(n + 1)

def main():
	for _ in range(int(input())):
		solN()
main()


from sys import stdin, stdout
from math import gcd, ceil, 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()
mod = 1000000007
tc = ii1()
for _ in range(tc):
	n = ii1()
	arr = sorted(iia())
	last = 0
	for i in range(1, n + 1):
		if arr[i - 1] <= i:
			last = i
	print(last + 1)


t = int(input())
dl = 2 * 10 ** 5 + 1
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	cur = 1
	res = 1
	for aa in a:
		cur += 1
		if cur > aa:
			res = cur
	print(res)


def findAns(arr, n):
	for i in range(n - 1, -1, -1):
		if i >= arr[i] - 1:
			return i + 2
	return 1
for t in range(int(input())):
	n = int(input())
	arr = sorted(list(map(int, input().split())))
	print(findAns(arr, n))


for t in range(int(input())):
	n = input()
	a = list(map(int, input().split()))
	cnt = {}
	for ai in a:
		cnt[ai] = cnt.setdefault(ai, 0) + 1
	cnt = sorted(cnt.items())
	total = 1
	ans = 1
	for item in cnt:
		total += item[1]
		if item[0] <= total - 1:
			ans = total
	print(ans)


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 factorial
from collections import Counter, defaultdict, deque
from heapq import heapify, heappop, heappush

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)
mod = 998244353
INF = float('inf')

def main():
	for _ in range(N()):
		n = N()
		arr = RLL()
		arr.sort()
		res = 0
		now = 0
		for i in arr:
			now += 1
			if now >= i:
				res = max(res, now)
		print(res + 1)
main()


from collections import *
for u in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	ka = 1
	i = 0
	while i < n:
		s = 0
		while i < n and l[i] > s + ka:
			s = s + 1
			i += 1
		if i < n:
			s = s + 1
			ka = ka + s
			i += 1
	print(ka)


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, grannies):
	sorted_indicies = sorted(range(N), key=lambda i: grannies[i])
	current_count = 1
	max_so_far = 1
	i = 0
	while i < N:
		called_people = 0
		needed = grannies[sorted_indicies[i]]
		while i < N and current_count + called_people < needed:
			called_people += 1
			i += 1
			if i < N:
				needed = max(needed, grannies[sorted_indicies[i]])
			else:
				return max_so_far
		current_count += called_people + 1
		max_so_far = current_count
		i += 1
	return max_so_far
T = inp()
for i in range(T):
	N = inp()
	grannies = inlt()
	print(solve(N, grannies))


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	c = 1
	w = 0
	for i in range(len(l)):
		if c + w >= l[i]:
			if l[i] == 1:
				c += 1
			else:
				c = c + w + 1
			w = 0
		else:
			w += 1
	print(c)


T = int(input())
for i in range(T):
	n = int(input())
	s = list(map(int, input().split()))
	temp = 1
	count = 1
	s = sorted(s)
	for i in range(n):
		if s[i] <= count:
			temp = max(temp, count + 1)
		count += 1
	print(temp)


for o in range(int(input())):
	n = int(input())
	m = list(map(int, input().split()))
	m.sort()
	k = 1
	c = 1
	for i in range(n):
		if m[i] <= i + 1:
			k = i + 2
	print(k)


def solution():
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	in_court = 1
	for c in range(n):
		if a[c] <= c + 1:
			in_court = c + 2
	print(in_court)
T = int(input())
for t in range(T):
	solution()


for _ in range(int(input())):
	n = int(input())
	a = [int(s) for s in input().split()]
	a.sort()
	d = {}
	for i in range(n):
		if a[i] not in d:
			d[a[i]] = 1
		else:
			d[a[i]] += 1
	a.sort()
	s = n
	for i in range(n):
		if s >= a[n - 1 - i]:
			break
		s -= 1
	print(s + 1)


a = input()
for x in range(int(a)):
	b = input()
	c = input().split(' ')
	list1 = [int(i) for i in c]
	list1.sort()
	tag = 0
	for i in range(len(list1) - 1, -1, -1):
		if list1[i] <= i + 1:
			tag = i + 1
			break
	print(1 + tag)


for _ in range(int(input().strip())):
	n = int(input().strip())
	L = list(map(int, input().strip().split()))
	L.sort()
	present = 1
	i = n - 1
	while i >= 0:
		if L[i] <= n:
			present += 1
			i -= 1
		else:
			n -= 1
			i -= 1
	print(present)


n = int(input())
for w in range(n):
	a = int(input())
	l = list(map(int, input().split()))
	l.sort()
	s = 1
	c = 0
	for i in range(a):
		if l[i] <= s:
			s = s + 1
		else:
			flag = 1
			c = c + 1
			if s + c - 1 >= l[i]:
				s = s + c
				c = 0
				flag = 0
	print(s)


T = int(input())
for _ in range(T):
	N = int(input())
	A = list(map(int, input().split()))
	A.sort()
	n = 1
	l = -1
	for i in range(N):
		if n + i >= A[i]:
			l = i
	print(1 + l + 1)


from sys import stdin
t = int(input())
for _ in range(t):
	n = int(stdin.readline())
	arr = list(map(int, stdin.readline().rstrip().split(' ')))
	arr = sorted(arr)
	inside = 1
	i = 0
	current = 0
	while i < len(arr):
		currentMax = arr[i]
		i += 1
		current += 1
		if inside + current - 1 >= currentMax:
			inside += current
			current = 0
	print(inside)


for t in range(int(input())):
	res = 0
	n = int(input())
	s = list(map(int, input().strip().split()))
	s.sort()
	for i in range(n):
		if s[i] <= i + 1:
			res = i + 1
	print(res + 1)


t = int(input())
for i in range(t):
	n = int(input())
	nums = list(map(int, input().split()))
	ans = False
	nums.sort()
	for j in range(n - 1, -1, -1):
		if nums[j] <= j + 1:
			print(j + 2)
			ans = True
			break
	if not ans:
		print(1)


for _ in range(int(input())):
	n = int(input())
	a = sorted(list(map(int, input().split())))
	b = [0] * n
	for i in range(n - 1, -1, -1):
		if a[i] <= i + 1:
			b[i] = 1
	for i in range(n):
		if b[i] == 1:
			j = i + 1
	if 1 in b:
		print(j + 1)
	else:
		print(1)


for i in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	sum = 0
	for i in range(0, len(a)):
		sum += a[i]
	my_sum = sum
	k = 0
	while 1:
		flag = 0
		sum = my_sum
		for i in range(0, len(a) - k):
			if a[len(a) - i - 1] <= len(a) - i:
				k += len(a) - i
				flag = 1
				break
			sum -= a[i]
		if k == n:
			break
		if flag == 0:
			break
	print(k + 1)


import sys
t = int(input().strip())
for a0 in range(t):
	n = int(input().strip())
	a = list(map(int, input().split()))
	a.sort()
	i = len(a) - 1
	k = n + 1
	while i >= 0 and a[i] > k - 1:
		i -= 1
		k -= 1
		a.pop()
	print(k)


from sys import stdin, stdout
import math
fastinput = stdin.buffer.readline
t = int(fastinput())
while t:
	t -= 1
	n = int(fastinput())
	a = [0] * (n + 2)
	for i in fastinput().split():
		x = int(i)
		if x > n + 1:
			continue
		else:
			a[x] += 1
	count = 1
	present = 0
	for i in range(1, n + 2):
		if a[i] + count + present > i:
			count += present + a[i]
			present = 0
		else:
			present += a[i]
	print(count)


t = int(input())
for i in range(t):
	n = int(input())
	array = list(map(int, input().split()))
	array = sorted(array)
	count = 1
	for j in range(len(array)):
		if array[j] <= j + 1:
			count = j + 2
	print(count)


import sys
input = sys.stdin.buffer.readline
t = int(input())
for _ in range(t):
	n = int(input())
	A = list(map(int, input().split()))
	A.sort()
	ans = 0
	for (i, a) in enumerate(A):
		if i + 1 >= a:
			ans = i + 1
	print(ans + 1)


from sys import stdout, stdin
(_input, _print) = (stdin.buffer.readline, stdout.write)
(_int, _range, _sorted, _enumerate) = (int, range, sorted, enumerate)

def solution():
	for _ in _range(_int(_input())):
		n = _int(_input())
		arr = (_int(i) for i in _input().split())
		ans = 0
		for (i, v) in _enumerate(_sorted(arr)):
			if i + 1 >= v:
				ans = i + 1
		print(ans + 1)
solution()


import sys
t = int(sys.stdin.readline())
for _ in range(t):
	n = int(sys.stdin.readline())
	m = []
	a = list(map(int, sys.stdin.readline().split()))
	a = sorted(a)
	maxVal = 0
	for i in range(n):
		if i + 1 >= a[i]:
			maxVal = i + 1
	maxVal += 1
	print(maxVal)


t = int(input())
while t > 0:
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	c = n + 1
	i = n - 1
	while i >= 0 and l[i] > c - 1:
		c -= 1
		i -= 1
	print(c)
	t -= 1


for _ in range(int(input())):
	n = int(input())
	dic = {}
	ans = 1
	for el in input().split():
		try:
			dic[int(el)] += 1
		except:
			dic[int(el)] = 1
	keys = list(dic.keys())
	keys.sort()
	c = 0
	for el in keys:
		c += dic[el]
		if ans + c - 1 >= el:
			ans += c
			c = 0
	print(ans)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a = sorted(a)
	(count, temp, flag) = (1, 1, -1)
	(i, j) = (0, 0)
	while i < n:
		if a[i] <= count:
			count += 1
			i += 1
			j += 1
		else:
			temp = count
			while i < n:
				if a[i] <= temp:
					flag = 1
					break
				i += 1
				temp += 1
			if flag == 1:
				flag = -1
				count = temp
	print(count)


for _ in range(int(input())):
	n = int(input())
	a = sorted(list(map(int, input().split())))
	m = [i for i in range(1, n + 1)]
	m = m[::-1]
	a = a[::-1]
	f = True
	for i in range(n):
		if m[i] >= a[i]:
			print(n - i + 1)
			f = False
			break
	if f:
		print(1)


t = int(input())
a = []
n = []
for i in range(t):
	n += [int(input())]
	l = list(map(int, input().split()))
	a += [l]
for i in range(t):
	k = n[i]
	m = k
	a[i].sort()
	for j in range(n[i], 0, -1):
		if a[i][j - 1] <= j:
			b = 1
			break
		else:
			b = 0
	print(b * j + 1)


from sys import stdout
import io
import os
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
for t in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	ans = 1
	for i in range(n - 1, -1, -1):
		if a[i] <= i + 1:
			ans = i + 2
			break
	stdout.write(str(ans) + '\n')


res = ''
for _ in range(int(input())):
	n = int(input())
	grannies = list(map(int, input().split()))
	grannies.sort(reverse=True)
	cant_come = 0
	for granny in grannies:
		if granny > n - cant_come:
			cant_come += 1
		else:
			break
	res += '%d\n' % (n - cant_come + 1)
print(res)


t = int(input())
while t > 0:
	n = int(input())
	arr = [int(x) for x in input().split()]
	arr.sort()
	max = 1
	for i in range(len(arr)):
		if i + 1 >= arr[i]:
			max = i + 2
	print(max)
	t = t - 1


t = int(input())
for itr in range(t):
	n = int(input())
	a = input().split()
	for (i, item) in enumerate(a):
		a[i] = int(item)
	a.sort()
	p = 1
	for i in range(n):
		if a[i] <= i + 1:
			p = i + 2
	print(p)


t = int(input())
for i in range(0, t):
	n = int(input())
	l = list(map(int, input().split()))
	c = 1
	l.sort()
	w = 1
	for j in range(0, n):
		if c + w - 1 >= l[j]:
			c += w
			w = 1
		else:
			w += 1
	print(c)


for _ in range(int(input())):
	(n, tg, max) = (int(input()), 1, 1)
	a = sorted(list(map(int, input().split())))
	for i in range(n):
		if a[i] <= tg:
			tg += 1
			max = tg
		else:
			tg += 1
	print(max)


from sys import stdin
for _ in range(int(stdin.readline())):
	n = int(stdin.readline())
	a = sorted(map(int, stdin.readline().split()))
	res = 1
	for (i, v) in enumerate(a):
		if i + 1 >= v:
			res = i + 2
	print(res)


def solve(n, s):
	s.sort()
	for i in range(n - 1, -1, -1):
		if s[i] <= n:
			print(n + 1)
			return
		else:
			n -= 1
	print(1)
t = int(input())
for _ in range(t):
	n = int(input())
	ar = list(map(int, input().split()))
	solve(n, ar)


for _ in range(int(input())):
	n = int(input())
	l = sorted(map(int, input().split()))
	grany_c = 1
	flag = False
	i = 0
	while i < n:
		j = i
		curr = grany_c
		while j < n:
			curr += 1
			if curr > l[j]:
				grany_c = curr
				flag = True
			j += 1
		if not flag:
			break
		i = j
	print(grany_c)


T = int(input())
for t in range(T):
	n = int(input())
	grannies = list(map(int, input().strip().split()))
	grannies.sort()
	total = 1
	temp = 0
	for (i, g) in enumerate(grannies):
		if g <= total + temp:
			total += temp + 1
			temp = 0
		else:
			temp += 1
	print(total)


t = int(input())
import math
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	pref = 0
	gran = 1
	curr = 0
	for i in range(n):
		if pref + gran >= a[i]:
			pref += 1
			curr = pref
		else:
			pref += 1
	print(curr + 1)


import sys
input = sys.stdin.readline

def solve(n, arr):
	total = 0
	cur_group = 0
	for g in arr:
		cur_group += 1
		if total + cur_group >= g:
			total += cur_group
			cur_group = 0
	return total + 1
t = int(input())
for _ in range(t):
	n = int(input())
	arr = sorted(map(int, input().split()))
	print(solve(n, arr))


from __future__ import division, print_function
import sys
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip
import os, sys, bisect, copy
from collections import defaultdict, Counter, deque
if os.path.exists('in.txt'):
	sys.stdin = open('in.txt', 'r')
if os.path.exists('out.txt'):
	sys.stdout = open('out.txt', 'w')

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

def mapi(arg=0):
	return map(int if arg == 0 else str, input().split())
for _ in range(int(input())):
	n = int(input())
	a = list(mapi())
	res = 1
	a.sort()
	cnt = 1
	i = 0
	while i < n:
		cnt += 1
		if cnt - 1 - a[i] >= 0:
			res = max(res, cnt)
		i += 1
	print(res)


import sys
lines = sys.stdin.readlines()
T = int(lines[0].strip())
for t in range(T):
	n = int(lines[2 * t + 1].strip())
	As = list(map(int, lines[2 * t + 2].strip().split(' ')))
	cnt = {}
	for i in range(n):
		if As[i] not in cnt:
			cnt[As[i]] = 0
		cnt[As[i]] += 1
	kinds = list(cnt.keys())
	kinds.sort()
	res = 1
	cache = 0
	for i in range(len(kinds)):
		k = kinds[i]
		if res + cnt[k] + cache > k:
			res += cnt[k] + cache
			cache = 0
		else:
			cache += cnt[k]
	print(res)


t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().strip().split()))
	l.sort()
	c = 1
	aux = 0
	for i in range(len(l)):
		if l[i] <= c:
			aux = i + 1
		c += 1
	print(aux + 1)


t = int(input())
for i in range(t):
	n = int(input())
	lis = list(map(int, input().split(' ')))
	lis.sort()
	maxGran = n + 1
	flag = True
	i = n - 1
	sum = n + 1
	while i != -1:
		if lis[i] >= sum:
			i = i - 1
			sum = sum - 1
		else:
			print(sum)
			break
	if i == -1:
		print(1)


t = int(input())
for k in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	gc = 1
	temp = 0
	for i in range(len(l)):
		if l[i] <= gc:
			temp = i + 1
		gc += 1
	print(temp + 1)


from collections import Counter
from collections import OrderedDict
from collections import defaultdict

def SOCountR(mylist):
	return OrderedDict(sorted(Counter(mylist).items(), reverse=True))

def SOCount(mylist):
	return OrderedDict(sorted(Counter(mylist).items()))

def freq_count(mylist):
	return Counter(mylist)
t = int(input())
for _ in range(t):
	n = int(input())
	arr = [int(x) for x in input().split()]
	arr.sort()
	ind = 0
	for i in range(n):
		if arr[i] <= i + 1:
			ind = i + 1
	print(ind + 1)


nTest = int(input())
for i in range(nTest):
	input()
	grannies = list(map(int, input().strip().split()))
	grannies.sort()
	sobra = 0
	res = 1
	for i in range(len(grannies)):
		if grannies[i] <= res:
			sobra = i + 1
		res += 1
	print(sobra + 1)


t = int(input())
while t != 0:
	n = int(input())
	list1 = list(map(int, input().split()))
	list1.sort()
	ans = 1
	number = 1
	for i in range(len(list1)):
		if number >= list1[i]:
			ans = number + 1
		number += 1
	print(ans)
	t -= 1


import sys
t = int(sys.stdin.readline())
for i in range(t):
	n = int(sys.stdin.readline())
	m = list(map(int, sys.stdin.readline().split()))
	m.sort()
	ans = 1
	for i in range(len(m) - 1, -1, -1):
		if i + 1 >= m[i]:
			ans = i + 2
			break
	print(ans)


for t in range(int(input())):
	n = int(input())
	a = sorted(map(int, input().split()))
	p = 1
	for i in range(n):
		if a[i] <= i + 1:
			p = i + 2
	print(p)


for _ in range(int(input())):
	n = int(input())
	gr = list(map(int, input().split()))
	gr = sorted(gr)
	a = n + 1
	i = n - 1
	while i >= 0:
		if gr[i] < a:
			break
		else:
			a = a - 1
			i -= 1
	print(a)