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