#include <bits/stdc++.h>
using namespace std;
int a, i = 0, last = 0, current = 0;
int main() {
  int x, y, z = 0, a = 0, c = 1;
  long long b;
  cin >> x;
  for (int i = 0; i < x; i++) {
    cin >> y >> z;
    a = z * 2;
    c = y * 2;
    if (a > c) {
      if (z > c)
        cout << z * z << endl;
      else
        cout << c * c << endl;
    } else {
      if (y > a)
        cout << y * y << endl;
      else
        cout << a * a << endl;
    }
  }
  return 0;
}
