#include <bits/stdc++.h>
#define pb push_back
#define fi first
#define se second
#define ins insert
#define sz(x) (long long)x.size()
typedef long long ll;
typedef long double ld;
const int N = 2e5 + 5;
const ld Pi = 3.141592653;
const ll mod = 1e9 + 7;
const ll Mod = 998244353;
const ll Inf = 4e18;

using namespace std;

int dx[9] = {1, -1, 0, 0, 1, 1, -1, -1, 0};
int dy[9] = {0, 0, 1, -1, 1, -1, 1, -1, 0};

int main()
{
        ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
        int T = 1;
        cin >> T;
        while(T--)
        {
                vector <int> a(4);
                for(int i = 0; i<4; i++) cin >> a[i];
                sort(a.begin(), a.end());
                cout << max(a[0] * a[1], a[0] * a[2]) << "\n";
        }
        return 0;
}