#include <bits/stdc++.h>
using namespace std;
const int maxn = 10000 + 10;
int a[maxn];
void read(int &x) {
  char c = getchar();
  int f = 1;
  x = 0;
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    x = x * 10 + c - '0';
    c = getchar();
  }
  x *= f;
}
bool cmp(int x, int y) { return x > y; }
int main() {
  int i, j, k, m, n;
  int T;
  read(T);
  while (T--) {
    read(n);
    for (register int i = 1; i <= n; i++) read(a[i]);
    sort(a + 1, a + n + 1, cmp);
    int flag = 0;
    for (register int i = 1; i <= n; i++)
      if (a[i] < i) {
        printf("%d\n", i - 1);
        flag = 1;
        break;
      }
    if (flag == 0) printf("%d\n", n);
  }
  return 0;
}
