#include <bits/stdc++.h>
using namespace std;
int min(int x, int y){
	if(x<y) return x;
	else return y;
}
int main()
{
	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	#endif
	int t;
	cin>>t;
	while(t--){
		int n=4;
		int arr[n];
		for(int i=0; i<n; i++){
			cin>>arr[i];
		}
		sort(arr, arr+n);
		cout<<arr[0]*arr[2]<<endl;
	}
	return 0;
}