#include <bits/stdc++.h>
using namespace std;
int main() {
  int k;
  cin >> k;
  while (k--) {
    int n;
    cin >> n;
    int arr[n];
    for (int i = 0; i < n; i++) {
      cin >> arr[i];
    }
    sort(arr, arr + n, greater<int>());
    int maxlen = 0;
    for (int i = 0; i < n; i++) {
      if (arr[i] >= maxlen + 1) {
        maxlen++;
      } else {
        break;
      }
    }
    cout << maxlen << endl;
  }
}
