#include<cstdio>
#include<algorithm>
using namespace std;
long long i,_,a[100];
int main(){
	scanf("%lld",&_);
	while(_--){
		for(i=0;i<4;i++)scanf("%lld",&a[i]);
		sort(a,a+4);
		printf("%lld\n",min(a[0],a[1])*min(a[2],a[3]));
	}
}