#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 7;
const int M = 2e6 + 7;
const int lim = 2e5;
const int mod = 998244353;
const int inf = 0x3f3f3f3f;
int a[N];
int main() {
  int T;
  scanf("%d", &T);
  while (T--) {
    int n, mx = 0;
    scanf("%d", &n);
    for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
    sort(a + 1, a + 1 + n);
    for (int i = 1; i <= n; i++) mx = max(mx, min(a[i], n - i + 1));
    printf("%d\n", mx);
  }
  return 0;
}
