#include <bits/stdc++.h>
int n, i, v[1005], t, j, aux, ok;
int main() {
  scanf("%d", &t);
  for (j = 1; j <= t; j++) {
    scanf("%d", &n);
    for (i = 1; i <= n; i++) scanf("%d", &v[i]);
    do {
      ok = 1;
      for (i = 1; i < n; i++)
        if (v[i] > v[i + 1]) {
          aux = v[i];
          v[i] = v[i + 1];
          v[i + 1] = aux;
          ok = 0;
        }
    } while (ok == 0);
    for (i = n; i >= 1; i--) {
      if (v[i] < n - i + 1) break;
    }
    printf("%d\n", n - i);
  }
  return 0;
}
