#include<bits/stdc++.h>
using namespace std;
int main(){
	int t;
	cin>>t;
	
	vector<int> v;
	int a;
	
	while(t--){
		
		for(int i=0;i<4;i++){
			cin>>a;
			v.push_back(a);
		}
		
		sort(v.begin(),v.end());
		
		int breadth=v.front();
		cout<<breadth*v[2]<<endl;
		
		v.clear();
	}
}