#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  long long k;
  cin >> k;
  while (k--) {
    long long n;
    cin >> n;
    long long ar[n];
    for (long long i = 0; i < n; i++) cin >> ar[i];
    sort(ar, ar + n, greater<long long>());
    long long ans = 0;
    for (long long i = 0; i < n; i++) {
      if (ar[i] < i + 1) {
        break;
      }
      ans = i + 1;
    }
    cout << ans << "\n";
  }
  return 0;
}
