#include <bits/stdc++.h>
using namespace std;
int main() {
  int T;
  cin >> T;
  while (T--) {
    int n, m, x, arr[1007];
    cin >> n;
    for (int i = 0; i < n; i++) cin >> arr[i];
    sort(arr, arr + n);
    m = 0;
    for (int i = 0; i < n; i++) m = max(m, min(arr[i], (n - i)));
    cout << m << "\n";
  }
  return 0;
}
