#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; i++) {
      cin >> a[i];
    }
    int ans = 1;
    sort(a.begin(), a.end());
    for (int i = n - 2; i >= 0; i--) {
      if (a[i] >= (ans + 1))
        ans++;
      else
        break;
    }
    cout << ans << "\n";
  }
  return 0;
}
