/**
* @author: Binoy Barman
* @created: 2024-11-05 20:56:16
**/
#include<bits/stdc++.h>
using namespace std;
#define nl '\n'
#define all(v) v.begin(), v.end()
#define Too_Many_Jobs int tts, tc = 1; cin >> tts; hell: while(tts--)
#define Dark_Lord_Binoy ios_base::sync_with_stdio(false); cin.tie(NULL);
#ifdef LOCAL
#include "debug/whereisit.hpp"
#else
#define dbg(...) 42
#endif
#define int long long
int32_t main() {
Dark_Lord_Binoy
#ifdef LOCAL
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
Too_Many_Jobs {
int n;
cin >> n;
multiset<int> f;
for (int i = 0; i < n; i++) {
int x;
cin >> x;
f.insert(x);
}
int l = 1;
while(1) {
auto mew = f.find(l);
if(mew != f.end()) {
f.erase(mew);
l++;
} else {
auto it = f.rbegin();
int cur = 0;
while(it != f.rend()) {
if(cur >= l) break;
cur += *it;
f.erase(f.find(*it));
it = f.rbegin();
}
if(cur < l) break;
f.insert(cur - l);
l++;
}
}
cout << l << nl;
}
return 0;
}