#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <cassert>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <unordered_map>
/*#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template<class T> using oset =tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update> ;
//oset<int> a;
//a.insert(p);
//a.erase(p);
//int k = *a.find_by_order(id);
*/
using namespace std;
#define int long long
#define ii pair<int, int> 
#define fi first
#define se second
#define endl '\n'
#define mp make_pair
#define pb push_back
#define inf 1e18
int t, a[10];
signed main() {
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	cin >> t;
	while (t--)
	{
		cin >> a[1] >> a[2] >> a[3] >> a[4];
		sort(a + 1, a + 5);
		cout << a[1] * a[3] << endl;
	}
}