#include <bits/stdc++.h>
using namespace std;
int main() {
  int t = 0;
  cin >> t;
  while (t-- > 0) {
    int n = 0;
    cin >> n;
    int arr[n];
    for (int i = 0; i < n; i++) {
      cin >> arr[i];
    }
    int max = 0;
    sort(arr, arr + n);
    for (int i = 0; i < n; i++) {
      if (arr[i] + i <= n) {
        if (max < arr[i]) {
          max = arr[i];
        }
      } else {
        if (max < n - i) {
          max = n - i;
        }
      }
    }
    cout << max << "\n";
  }
}
