#include <bits/stdc++.h>
using namespace std;
const int maxn = 1010;
int read() {
  int x = 0, f = 0;
  char ch = 0;
  while (!isdigit(ch)) {
    f |= ch == '-';
    ch = getchar();
  }
  while (isdigit(ch)) x = (x << 3) + (x << 1) + (ch ^ 48), ch = getchar();
  return f ? -x : x;
}
int N, K;
int a[maxn];
int cmp(int a, int b) { return a > b; }
int main() {
  K = read();
  while (K--) {
    N = read();
    for (int i = 1; i <= N; i++) {
      a[i] = read();
    }
    sort(a + 1, a + N + 1, cmp);
    int ret = 0;
    int l = 1, r = N + 1;
    int m = l + (r - l) / 2;
    while (l < r) {
      m = l + (r - l) / 2;
      if (m <= a[m]) {
        l = m + 1;
      } else {
        r = m;
      }
    }
    printf("%d\n", l - 1);
  }
  return 0;
}
