#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e18;
const long long N = 2e5 + 5;
const long long mod = 1000000007;
pair<long long, long long> a[N];
long long par[N];
long long dp[N];
long long ans[N];
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long tc;
  cin >> tc;
  while (tc--) {
    long long n;
    cin >> n;
    vector<long long> v(n);
    for (long long i = 0; i < n; i++) {
      cin >> v[i];
    }
    sort(v.begin(), v.end());
    for (long long i = 1000; i >= 1; i--) {
      auto it = lower_bound(v.begin(), v.end(), i) - v.begin();
      if (n - it >= i) {
        cout << i << endl;
        break;
      }
    }
  }
  return 0;
}
