#include <bits/stdc++.h>
#define ll long long
#define _n 2020
#define C continue
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define gc getchar
#define pc putchar
#define kg putchar(' ')
#define hh putchar('\n')
#define mem(a,b) memset(a,b,sizeof(a))
#define _for(i,a,b) for( int i=(a); i<=(b); i++)
#define _rep(i,a,b) for( int i=(a); i>=(b); i--)
//#define int __int128
using namespace std;
inline int rd(){
    int x=0,f=1;char ch=gc();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=gc();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=gc();}
    return x*f;
}
char chhh[200];
inline void rt(int x){
    int cnt=0,tmp=x>0?x:-x;
    if (!x) {pc('0');return;}
    if(x<0) pc('-');
    while(tmp>0) {chhh[cnt++]=tmp%10+'0';tmp/=10;}
    while(cnt>0) pc(chhh[--cnt]);
}
//signed main(){
int a[10];
int main(){
	int t;
	t=rd();
	while(t--){
		for(int i=1;i<=4;i++) a[i]=rd();
		sort(a+1,a+1+4);
		printf("%d\n",a[1]*a[3]);
	}

    return 0;
}



		  		 			 						    		   	  		