#include <bits/stdc++.h>
using namespace std;
int k, n, a[1003], mn, ans, tc;
int main() {
  cin >> tc;
  while (tc--) {
    ans = 0;
    cin >> n;
    for (int i = 0; i < n; i++) {
      cin >> a[i];
    }
    sort(a, a + n);
    reverse(a, a + n);
    mn = a[0];
    for (int i = 0; i < n; i++) {
      mn = min(mn, a[i]);
      if (i + 1 <= mn) {
        ans = max(ans, i + 1);
      }
    }
    cout << ans << "\n";
  }
  return 0;
}
