#include <bits/stdc++.h>
using namespace std;
const long long int maxn = 1e5;
const long long int inf = 1e9;
const double pi = acos(-1);
void solve() {
  int n;
  cin >> n;
  int a[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  sort(a, a + n);
  int ans = 0;
  for (int i = 0; i < n; i++) ans = max(ans, min((n - i), a[i]));
  cout << ans << "\n";
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    solve();
  }
  return 0;
}
