#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1.0);
const double eps = 1e-8;
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3f;
const int MX = 1e5 + 7;
const int mod = 1e9 + 7;
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long quimod(long long a, long long k) {
  long long res = 1;
  while (k) {
    if (k & 1) res = (res * a) % mod;
    a = (a * a) % mod;
    k >>= 1;
  }
  return res;
}
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
int a[MX];
int main() {
  int T;
  scanf("%d", &T);
  while (T--) {
    int res = 0;
    int n;
    scanf("%d", &n);
    for (int i = 1; i <= n; ++i) scanf("%d", &a[i]);
    sort(a + 1, a + 1 + n, greater<int>());
    for (int i = 1; i <= n + 1; ++i) {
      if (a[i] < i) {
        res = i - 1;
        break;
      }
    }
    printf("%d\n", res);
  }
  return 0;
}
