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