#include <bits/stdc++.h>
using namespace std;
long long int solve() {
  long long int dp[5000];
  memset(dp, 0, sizeof(dp));
  long long int n;
  cin >> n;
  int countt = 0;
  for (int i = 0; i <= n - 1; i++) {
    long long int temp;
    cin >> temp;
    dp[temp]++;
  }
  for (int i = 1000; i >= 0; i--) {
    dp[i] = dp[i] + dp[i + 1];
    if (dp[i] >= i) countt = max(countt, i);
  }
  return countt;
}
int main() {
  long long int t;
  cin >> t;
  for (int i = 0; i <= t - 1; i++) cout << solve() << endl;
}
