#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define ll long long
#define pb push_back
#define lop(i,n) for(int i=0;i<n;i++)
#define lop1(i,n) for(int i=1;i<=n;i++)
#define fast ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
#define mem(b,a) memset(a,b,sizeof(a))
#define yes cout<<"YES"<<endl
#define no cout<<"NO"<<endl
//setbit clearbit toggle k-1, k-1
#define setbit(x,k)   (x |=(1<<k))
#define clearbit(x,k) (x &= ~(1<<k))
#define togglebit(x,k)  (x ^=  (1<<k))
#define checkbit(x,k) (x& (1<<k))
// v.erase(unique(v.begin(),v.end()),v.end());
#define inf INT_MAX
#define nn cout<<endl
int main()
{
    fast
    ll t;
    cin>>t;
    while(t--)
    {
       ll a,b,c,d;
       cin>>a>>b>>c>>d;
       vector<ll>v;
       v.pb(a);
       v.pb(b);
       v.pb(c);
       v.pb(d);
       sort(v.begin(),v.end());
       ll k=min(v[0],v[1]);
       ll j=min(v[2],v[3]);
       cout<<k*j<<endl;

    }
}
