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

#define int         long long
#define ull         unsigned long long
#define ll          long long
#define M           1000000007
#define pb          push_back
#define p_q         priority_queue
#define pii         pair<ll,ll>
#define vi          vector<ll>
#define vii         vector<pii>
#define mi          map<ll,ll>
#define mii         map<pii,ll>
#define all(a)      (a).begin(),(a).end()
#define sz(x)       (ll)x.size()
#define endl        '\n'
#define gcd(a,b)    __gcd((a),(b))
#define lcm(a,b)    ((a)*(b)) / gcd((a),(b))
#define ios         ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define mp          make_pair
#define lb          lower_bound
#define ub          upper_bound
#define F           first
#define S           second
#define rep(i, begin, end) for (int i=begin;i<end;i++)
#define repd(i, begin, end) for (int i=end-1;i>=begin;i--)
#define ini(a,n,b)  for(ll int i=0;i<n;i++) a[i]=0;
#define cset(a)     __builtin_popcountll(a)
#define hell        1000000007
#define re          resize
const int INF=1e18;
const int N=3e5+5;


int powm(int a,int b)
{
  int res=1;
  while(b)
  {
    if(b&1) 
    res=(res*a)%M;
      a=(a*a)%M;
      b>>=1;
  }
 
  return res;
}

int pow(int a,int b)
{
  int res=1;
  while(b)
  {
    if(b&1) 
    res=(res*a);
      a=(a*a);
      b>>=1;
  }
 
  return res;
}



signed main(void)
{ios
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);freopen("answer.txt", "w", stdout);
    #endif

    
    int q;
    cin>>q;
    while(q--)
    {
      vi a(4);
      rep(i,0,4) cin>>a[i];
      sort(all(a));
      cout<<a[0]*a[2]<<endl;
    }
    
      
    
    

  
}