#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline T read() {
  T f = 1, x = 0;
  char c = getchar();
  while (!isdigit(c)) {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (isdigit(c)) {
    x = x * 10 + c - '0';
    c = getchar();
  }
  return x * f;
}
int n, a[1007], flag;
int main() {
  int t = read<int>();
  while (t--) {
    n = read<int>(), flag = 1;
    for (int(i) = (1); (i) <= (n); ++(i)) a[i] = read<int>();
    sort(a + 1, a + n + 1, greater<int>());
    for (int(i) = (1); (i) <= (n); ++(i))
      if (a[i] < i) {
        printf("%d\n", i - 1);
        flag = 0;
        break;
      }
    if (flag) printf("%d\n", n);
  }
  return 0;
}
