#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    multimap<int, int> m;
    int a[n];
    for (int i = 0; i < n; i++) {
      cin >> a[i];
    }
    sort(a, a + n);
    for (int i = 0; i < n; i++) {
      m.insert(pair<int, int>(a[i], n - i));
    }
    int result = 0;
    for (auto i = m.begin(); i != m.end(); i++) {
      result = max(min(i->first, i->second), result);
    }
    cout << result << endl;
  }
  return 0;
}
