#include <bits/stdc++.h>

#define int long long
#define ld long double
#define VI std::vector<int>
#define VPI std::vector<PII>
#define VVI std::vector<VI>
#define PII std::pair<int, int>
#define f(n) for (int i = 0; i < n; i++)
#define FOR(i, n) for (int i = 0; i < n; i++)
#define make(T, n) T n; std::cin >> n
#define makev(name, n) VI name(n); f(n) std::cin >> name[i]
#define ALL(q) q.begin(), q.end()
#define RALL(q) q.rbegin(), q.rend()

#define M7 1000000007
#define MFFT 998244353
#define INF 2000000000000000001
#define PI 3.14159265359

using namespace std;

void solve() {
    make(int, T);
    while (T--) {
        makev(a, 4);
        sort(ALL(a));
        cout << a[0] * a[2] << '\n';
    }
}

signed main(signed argc, char **argv) {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    if (argc > 1 && (string) argv[1] == "local") {
        freopen("output.txt", "w", stdout);
        freopen("input.txt", "r", stdin);
    }
    solve();
    return 0;
}