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

//#include <ext/pb_ds/tree_policy.hpp>
//#include <ext/pb_ds/assoc_container.hpp>
//using namespace __gnu_pbds;
//template <typename T> using orderSet =
//tree <T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

typedef long long ll;
typedef unsigned long long llu;
#define filein freopen("input.txt", "r", stdin)
#define fileout freopen("output.txt", "w", stdout)
#define inf 1e18
#define eps 1e-12
//#define mod 1000000007
#define ff first
#define ss second
#define pb push_back
#define mk make_pair
#define pii pair<int, int>
#define pll pair<ll, ll>
#define FastRead ios_base::sync_with_stdio(0);cin.tie(0);
#define cases ll test; scanf("%lld", &test); for(ll tno=1; tno<=test; ++tno)
ll power(ll b,ll p) {ll res=1,x=b; while(p > 0){if(p&1ll)res=res*x;x=x*x;p >>= 1;} return res;}
ll bigmod(ll b, ll p, ll m) {ll res=1, x=b%m; while(p>0){if(p&1)res=(res*x)%m;x=(x*x)%m;p>>=1;} return res;}

int main()
{
    int arr[4];

    cases {
        for(int i = 0; i < 4; i++) cin>>arr[i];

        sort(arr, arr+4);

        cout<<arr[0] * arr[2]<<endl;
    }
}
