#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int t;
  cin >> t;
  while (t--) {
    long long int n;
    cin >> n;
    long long int arr[n], brr[n + 1], crr[n + 1];
    fill_n(brr, n + 1, 0);
    fill_n(crr, n + 1, 0);
    for (long long int i = 0; i < n; i++) {
      long long int a;
      cin >> a;
      brr[a]++;
    }
    crr[n] = brr[n];
    for (long long int i = n - 1; i > 0; i--) {
      crr[i] = brr[i] + crr[i + 1];
    }
    long long int max1 = 0;
    for (long long int i = 1; i <= n; i++) {
      if (crr[i] >= i) max1 = max(max1, i);
    }
    cout << max1 << endl;
  }
  return 0;
}
