#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    std::vector<int> v;
    for (int i = 0; i < n; i++) {
      int x;
      cin >> x;
      v.push_back(x);
    }
    sort(v.begin(), v.end());
    std::vector<int> r;
    for (int i = n - 1; i >= 0; i--) {
      if (v[i] >= r.size() + 1)
        r.push_back(v[i]);
      else
        exit;
    }
    cout << r.size() << endl;
  }
  return 0;
}
