#include<bits/stdc++.h>
using namespace std;
void _IOS(){ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);cin.sync_with_stdio(0);}
typedef long long ll;
const ll mod = 1e9+7;
#define oo (long long)1e10
ll n,m,k,w;
//ll a[300009];
ll pr[200009];
void *malloc (size_t size);
int power(int x, unsigned int y)
{
    int temp;
    if( y == 0)
        return 1;
    temp = power(x, y/2);
    if (y%2 == 0)
        return temp*temp;
    else
        return x*temp*temp;
}
ll b[200009];
bool cmp(pair<int,int>p1,pair<int,int>p2)
{
    if(p1.first!=p2.first)
        return p1.first<p2.first;
    return p1.second>p2.second;
}
ll a[100009];
bool isvalid(int &i,int j)
{
    return i>=0&&i<n&&j>=0&&j<m;
}
struct x{
    int f,s;
};
ll ans=oo,x;
ll sum(ll y)
{
    ll s=0;
    while(y)
    {
        s+=(y%10);
        y/=10;
    }
    return s;
}
pair<int,int> f[500000];
set<pair<ll,ll>>s;
bool check(ll n)
{
    ll temp=n;
    while(n)
    {
        ll d=n%10;
        if(d&&temp%d)
            return 0;
        n/=10;
    }
    return 1;
}
int fun(int n)
{
    if(n==0) return 1;
    n+fun(n-1);
}
int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        for(int i=0;i<4;i++) cin>>a[i];
        sort(a,a+4);
        cout<<a[0]*a[2]<<endl;
    }
}
