#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int t; cin >> t;
    for (int _t=0; _t<t;++_t) {
        int arr[4]; for (int i=0; i<4;++i) {cin >> arr[i];}
        sort(arr,arr+4);
        cout << arr[0]*arr[2] << '\n';
    }
}