#include <bits/stdc++.h>
using namespace std;
int main() {
  int k, n;
  cin >> k;
  vector<int> ans(k, 0);
  int c, d, cnt = 0;
  d = k;
  while (k) {
    cin >> n;
    vector<int> num(n);
    for (int i = 0; i < n; i++) cin >> num[i];
    sort(num.begin(), num.end());
    for (int i = 0; i < n; i++) {
      c = n - i;
      if (c >= num[i])
        ans[cnt] = num[i];
      else if (c >= ans[cnt])
        ans[cnt] = c;
    }
    cnt++;
    k--;
  }
  for (int i = 0; i < d; i++) {
    cout << ans[i] << '\n';
  }
  return 0;
}
