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