#include <bits/stdc++.h>
using namespace std;
int main() {
  int k;
  cin >> k;
  while (k--) {
    int n;
    cin >> n;
    int maximum = 0;
    vector<int> vec;
    for (int i = 0; i < n; i++) {
      int x;
      cin >> x;
      if (x > maximum) maximum = x;
      vec.push_back(x);
    }
    int ans = min(n, maximum);
    while (1) {
      int counter = 0;
      for (int i = 0; i < n; i++) {
        if (vec[i] >= ans) counter++;
      }
      if (counter >= ans) {
        cout << ans << endl;
        break;
      } else
        ans--;
    }
  }
  return 0;
}
