#include <bits/stdc++.h>
using namespace std;
#define fast  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define setbit(x)   __builtin_popcount(x)  //count set bits in number
#define zerobit(x)  __builtin_ctz(x)       //find index of first set bits in right side add 1
#define ll       long long int 
#define ps(x,y)  fixed<<setprecision(y)<<x 
#define w()      int t=1;cin>>t;while(t--)
#define M        1000000007
#define P        4294967296
#define pb       push_back
#define pf       push_front
#define endl     '\n'
const int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
const ll MAXN=1e6;
int main(){
	fast;
	w(){
	    int a[4];
	    cin>>a[0]>>a[1]>>a[2]>>a[3];
	    sort(a,a+4);
	    cout<<a[0]*a[2];
	    cout<<endl;
	}
}