#include <iostream>
#include <algorithm>
using namespace std;

int get_max_area(int sides[]) {
	sort(sides, sides+4);

	return (sides[0] * sides[2]);
}

int main() {

	#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif

	int t;
	cin >> t;


	for (int i = 0; i < t; ++i) {
		int sides[4];

		for (int j = 0; j < 4; ++j) {
			cin >> sides[j];
		}

		cout << get_max_area(sides) << endl;
	}


	return 0;
}