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