#include <bits/stdc++.h>
using namespace std;
const int maxn = 1010;
int a[maxn];
int main() {
  int k;
  cin >> k;
  while (k--) {
    int n;
    cin >> n;
    for (int i = 1; i <= n; i++) cin >> a[i];
    sort(a + 1, a + n + 1);
    int ans = 0;
    for (int i = n; i >= 1; i--) {
      ans = max(ans, min(a[i], n - i + 1));
    }
    printf("%d\n", ans);
  }
}
