#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int t;
  cin >> t;
  while (t--) {
    long long int n;
    cin >> n;
    int a[n];
    for (int i = 0; i < n; i++) {
      cin >> a[i];
    }
    sort(a, a + n, greater<long long int>());
    long long int ans = 0;
    long long int f = 0;
    for (int i = 0; i < n; i++) {
      ans = max(ans, (long long int)min(i + 1, a[i]));
    }
    cout << ans << endl;
  }
}
