#include<bits/stdc++.h>
#include<algorithm>
#define 	IOS						ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define 	NIL 					-1
#define     all(v)            		v.begin(),v.end()
#define     pb                      push_back
#define		ll						long long
#define vll vector<ll>
#define uo unordered_map
#define     vi						vector<int>
#define     vvi(v,n,m)				vector<vi> v( n , vi (m))
#define		sz(x)					x.size()
#define 	int						int32_t



using namespace std;



vi vecinp(vi &x,int l){
	for(int i=0;i<l;i++)
	{
		int k;
		cin>>k;
		x.pb(k);
	}
	return x;
}
void vecout(vi &x){
	for(int i=0;i<x.size();i++)
	{
		cout<<x[i]<<" ";
	}
	cout<<endl;
}

int main(){
	IOS;
	int t;
	cin>>t;
	while(t--){
		vi a;
        a=vecinp(a,4);
        sort(all(a));
        cout<<a[0]*a[2]<<endl;
		
	}
	return 0;
}

