#include<bits/stdc++.h>
#define lld long long int
#define ulld unsigned long long int
typedef long long ll;
using namespace std;
void solve(){
   lld n;
   lld arr[4];
   cin>>arr[0]>>arr[1]>>arr[2]>>arr[3];
   sort(arr,arr+4);
   cout<<arr[0]*arr[2]<<"\n";
  }
int main(){
   ios::sync_with_stdio(0);
   cin.tie(0);
   ll t;
   t=1;
   cin>>t;
   while(t--)
   { 
   solve();
   }
   return 0;
}