#include <bits/stdc++.h>
#define gc() getchar()
typedef long long LL;


int main()
{
	static int A[10];
	int T; scanf("%d",&T);
	for(; T--; )
	{
		for(int i=1; i<=4; ++i) scanf("%d",A+i);
		std::sort(A+1,A+5);
		printf("%lld\n",1ll*std::min(A[1],A[2])*std::min(A[3],A[4]));
	}
	
	
	
	return 0;
}