// four segments

#include<bits/stdc++.h>
using namespace std;
#define loop(i,a,b) for(i=a;i<=b;i++)
#define ll long long

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	
	int t;
	cin >> t;
	while(t--)
	{
		int a[4],i;
		
		loop(i,0,3)
			cin >> a[i];
			
		sort(a,a+4);
		ll area = a[0] * a[2];
		cout << area <<'\n';	
	}
	return 0;
}