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