#include "iostream"#include "vector"#include "algorithm"using namespace std;bool mycomp(int a, int b){return a >= b;}int main(){int TestCase;cin >> TestCase;while (TestCase--){vector<int> v;v.clear();int num, temp, max = 0;cin >> num;for (int i = 0; i < num; i++){cin >> temp;v.push_back(temp);}sort(v.begin(), v.end(), mycomp);for (int i = 0; i < num; i++){if (v[i] * (i+1) > max)max = v[i] * (i+1);}cout << max << endl;}}


