#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
#define N 500005
#define mod 1000000007
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep1(i,a,b) for(int i=a;i<b;i++)
#define endl "\n"
#define PI 3.14159265358979323846  /* pi */
#define is_pot(n) (n&& !(n&(n-1)))
#define all(v)  ((v).begin()),((v).end())
#define degreesToRadians(angleDegrees) (angleDegrees * PI / 180.0) // Converts degrees to radians.
#define radiansToDegrees(angleRadians) (angleRadians * 180.0 / PI) // Converts radians to degrees.
#define int long long
#define reallyfast ios_base::sync_with_stdio(false); cin.tie(NULL);
#define epsilon 1e-9
typedef long long ll;
typedef long double ld;

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

void debug_out(
vector<string> __attribute__ ((unused)) args,
__attribute__ ((unused)) int idx, 
__attribute__ ((unused)) int LINE_NUM) { cerr << endl; } 
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T) {
	if(idx > 0) cerr << ", "; else cerr << "Line(" << LINE_NUM << ") ";
	stringstream ss; ss << H;
	cerr << args[idx] << " = " << ss.str();
	debug_out(args, idx + 1, LINE_NUM, T...);
}
#ifdef XOX
#define debug(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)
#else
#define debug(...) 42
#endif

void solve()
{
	int a[4];
	rep(i, 4) cin>>a[i];
	sort(a, a+4);
	cout<<min(a[0], a[1])*min(a[2], a[3])<<endl;
 
}
 
signed main() {

   	reallyfast

    	int t;cin>>t;while(t--)
	    solve();
 
 
return 0;
}