#include <bits/stdc++.h>
using namespace std;
long long int super_max = 9000000000000000000;
long long int poww(long long int base, long long int power_number);
long long int big_mod(long long int b, long long int p, long long int m);
long long int mod_string_number(string str, long long int mod_num);
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long int test;
  cin >> test;
  while (test--) {
    long long int n;
    cin >> n;
    long long int arr[n];
    for (long long int i = 0; i < n; i++) cin >> arr[i];
    sort(arr, arr + n);
    long long int sq = 0, co = 1;
    for (long long int i = n - 1; i >= 0; i--) {
      long long int mx = min(co, arr[i]);
      sq = max(sq, mx * mx);
      co++;
    }
    cout << sqrt(sq) << endl;
  }
  return 0;
}
long long int poww(long long int base, long long int power_number) {
  long long int num1 = 1;
  for (long long int j = 1; j <= power_number; j++) num1 *= base;
  return num1;
}
long long int big_mod(long long int b, long long int p, long long int m) {
  if (p == 0) return 1;
  if (p % 2 == 0) {
    long long int c = big_mod(b, p / 2, m);
    return ((c % m) * (c % m)) % m;
  } else {
    return ((b % m) * (big_mod(b, p - 1, m))) % m;
  }
}
long long int mod_string_number(string str, long long int mod_num) {
  long long int res = 0;
  for (long long int i = 0; i < str.length(); i++)
    res = (res * 10 + (long long int)str[i] - '0') % mod_num;
  return res;
}
