#include<bits/stdc++.h>
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);
#define pb emplace_back
#define all(v) v.begin(),v.end()
#define sz(x) (ll)x.size()
#define F first
#define S second
typedef long long ll;
using namespace std;

int main(){
    IOS

    int t;
    cin >> t;
    while(t--)
    {
    	int a[4];
    	for(int i = 0; i < 4; ++i)
    	{
    		cin >> a[i];
    	}
    	sort(a, a + 4);
    	cout << a[0] * a[2] << endl;
    }
    return 0;
}