#include<bits/stdc++.h>
#define ll long long int
using namespace std;

void solve()
{

		ll n,x,p=0,sum=0,ans1=0,ans2=0;

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


}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);

    ll t;
	cin>>t;
	while(t--){
            solve();
	}
    return 0;
}
