testnum=int(input())
result=''
while(testnum>0):
    testnum -= 1
    stick=int(input())
    length=input().split()
    for i in range(len(length)):
        length[i]=int(length[i])
    length.sort()
    length.reverse()
    for m in range(1,len(length)+1):
        if length[m-1]<m:
            break
    result = result+str(m-1)+'\n'
print(result)
43172092dff4b3ab23e9323d455368ffac7f6277
<mask token>

<mask token>
while testnum > 0:
    testnum -= 1
    stick = int(input())
    length = input().split()
    for i in range(len(length)):
        length[i] = int(length[i])
    length.sort()
    length.reverse()
    for m in range(1, len(length) + 1):
        if length[m - 1] < m:
            break
    result = result + str(m - 1) + '\n'
print(result)

testnum = int(input())
result = ''
while testnum > 0:
    testnum -= 1
    stick = int(input())
    length = input().split()
    for i in range(len(length)):
        length[i] = int(length[i])
    length.sort()
    length.reverse()
    for m in range(1, len(length) + 1):
        if length[m - 1] < m:
            break
    result = result + str(m - 1) + '\n'
print(result)

testnum=int(input())
result=''
while(testnum>0):
    testnum -= 1
    stick=int(input())
    length=input().split()
    for i in range(len(length)):
        length[i]=int(length[i])
    length.sort()
    length.reverse()
    for m in range(1,len(length)+1):
        if length[m-1]<m:
            break
    result = result+str(m-1)+'\n'
print(result)