#include<bits/stdc++.h>
using namespace std;

#define   ulli                  unsigned long long int
#define   ll                    long long
#define   mx                    2000005


ll n,m,k,i;
ll ar[5];
char ch[mx];

void output()
{
    ll a,b,r=0;
    for(i=0;i<4;i++)
    {
        cin>>ar[i];

    }
    sort(ar,ar+4);
    cout<<ar[0]*ar[2]<<endl;
}

int main()
{
    int t;
    cin>>t;
    while(t--)
        output();
    return 0;
}

