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