#include <bits/stdc++.h>
using namespace std;
int main() {
  int t, a, b, c, d;
  cin >> t;
  for (int i = 0; i < t; i++) {
    cin >> a >> b;
    c = min(a, b);
    d = max(a, b);
    if (c <= (d / 2)) {
      cout << (d * d) << endl;
    } else {
      cout << (4 * c * c) << endl;
    }
  }
  return 0;
}
