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