#include <bits/stdc++.h>

using namespace std;

int main(){

int t;
cin >> t;
vector<int> areas(t);

for (int j=0;j<t;j++){
vector<int> a(4);
for (int i=0;i<4;i++){
    cin >> a[i];
}
sort(a.begin(),a.end());
areas[j] = a[0]*a[2];
}


for(int h=0;h<t;h++){

    cout << areas[h] << endl;
}



}
