#include<bits/stdc++.h>
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<queue>
#include<map>
#include<stack>
#include<set>
#define iss ios::sync_with_stdio(false)
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
const int MAXN=1e4+5;
const int mod=77797;
int a[5];
int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        for(int i=1;i<=4;i++)
        {
            cin>>a[i];
        }
        sort(a+1,a+1+4);
        int ans=a[1]*a[3];
        cout<<ans<<endl;
    }
} 