trials = int(input())
area = ''
for i in range(trials):
segments = input()
segments_list = segments.split()
int_segments_list = []
for j in segments_list:
int_segments_list.append(int(j))
int_segments_list.sort()
if int_segments_list[0] == int_segments_list[1] == int_segments_list[2] == int_segments_list[3] or int_segments_list[0] == int_segments_list[1] == int_segments_list[2] or int_segments_list[1] == int_segments_list[2] == int_segments_list[3]:
area += (str(int_segments_list[0] * int_segments_list[1]) + '\n')
elif int_segments_list[0] == int_segments_list[1] and int_segments_list[2] == int_segments_list[3]:
area += (str(int_segments_list[0] * int_segments_list[2]) + '\n')
elif int_segments_list[0] == int_segments_list[1] or int_segments_list[1] == int_segments_list[2] or int_segments_list[2] == int_segments_list[3]:
if int_segments_list[0] == int_segments_list[1]:
area += (str(int_segments_list[0] * int_segments_list[2]) + '\n')
elif int_segments_list[1] == int_segments_list[2]:
area += (str(int_segments_list[0] * int_segments_list[1]) + '\n')
elif int_segments_list[2] == int_segments_list[3]:
area += (str(int_segments_list[0] * int_segments_list[2]) + '\n')
else:
area += (str(int_segments_list[0] * int_segments_list[2]) + '\n')
print(area)
//Think twice code once :))
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
typedef long double ld;
//typedef __int128 lll;
signed main(){ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
ll tt=1;cin>>tt;string pi = "3.141592653589793238462643383279";
while(tt--){ll arr[4];cin>>arr[0]>>arr[1]>>arr[2]>>arr[3];
sort(arr,arr+4);
cout<<arr[0]*arr[2]<<'\n';
}
return 0;
}
/*#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
*/
//sometimes long long ko int krne par tle nhi aata(kaafi ajeeb :())
// Binary search me r=n+1,l=0&&condition:l+1>r;
// for(int i=2;i<=N;i++){
// if(prime[i]==0){
//v.pb(i);
//for(int j=2*i;j<=N;j+=i){prime[j]++;}
//}
//}
/*int smallestdivisor(int n)
{
// if divisible by 2
if (n % 2 == 0)
return 2;
// iterate from 3 to sqrt(n)
for (int i = 3; i * i <= n; i += 2) {
if (n % i == 0)
return i;
}
return n;
}*/
/*ll binpow(ll a,ll b,ll m = LLONG_MAX){
ll res = 1;
while (b){
if (b&1) res = (res*a)%m;
a = (a*a)%m;
b>>=1;
}
return res;
}*/
/*for(int i=0;i<n;i++){
if(m[s[i]]==0){
if(i1==-1){ a[i]+=i+(n-1-i)*(i)+n-1-i;a[i]++;i1=i;}
else{
a[i]+=i-i1-1+(n-1-i)*(i-i1-1)+n-1-i;a[i]++;i1=i;
}
}
}
for(int i=0;i<n;i++){
ans-=a[i];
}*/
/////Favorites>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>............................................
/*ll n,k;cin>>n>>k;
if(n%2==0){
if(k%n)cout<<k%n<<'\n';
else{cout<<n<<'\n';}
}
else{ll n1=n-1;n1/=2;ll a=(k-1)/n1;ll b=k%n;
if(b==0){b=n;}b+=a;b%=n;if(b==0){b=n;}
cout<<b<<'\n';
}*/
1271A - Suits | 259B - Little Elephant and Magic Square |
1389A - LCM Problem | 778A - String Game |
1382A - Common Subsequence | 1512D - Corrupted Array |
667B - Coat of Anticubism | 284B - Cows and Poker Game |
1666D - Deletive Editing | 1433D - Districts Connection |
2B - The least round way | 1324A - Yet Another Tetris Problem |
246B - Increase and Decrease | 22E - Scheme |
1566A - Median Maximization | 1278A - Shuffle Hashing |
1666F - Fancy Stack | 1354A - Alarm Clock |
1543B - Customising the Track | 1337A - Ichihime and Triangle |
1366A - Shovels and Swords | 919A - Supermarket |
630C - Lucky Numbers | 1208B - Uniqueness |
1384A - Common Prefixes | 371A - K-Periodic Array |
1542A - Odd Set | 1567B - MEXor Mixup |
669A - Little Artem and Presents | 691B - s-palindrome |