#include <bits/stdc++.h>
using namespace std;
int main() {
  std::ios::sync_with_stdio(false);
  int k;
  cin >> k;
  while (k--) {
    int n;
    cin >> n;
    vector<long long> count(1011, 0);
    vector<long long> a(n);
    for (__typeof(n) i = (0) - ((0) > (n)); i != (n) - ((0) > (n));
         i += 1 - 2 * ((0) > (n))) {
      cin >> a[i];
      count[a[i]]++;
    }
    int mx = 0;
    for (int i = 1000; i >= 1; i--) {
      count[i] += count[i + 1];
      if (count[i] >= i) {
        mx = max(mx, i);
      }
    }
    cout << mx << "\n";
  }
}
