#include <bits/stdc++.h>
using namespace std;
void area(int a, int b);
int main() {
  int t, i, a, b;
  cin >> t;
  for (i = 0; i < t; i++) {
    cin >> a >> b;
    area(a, b);
  }
}
void area(int a, int b) {
  int i, j, k;
  if (a == b) {
    j = a + b;
    k = j * j;
    cout << k << endl;
  } else if (a > b) {
    j = b * 2;
    if (j >= a) {
      k = j * j;
      cout << k << endl;
    } else {
      k = a * a;
      cout << k << endl;
    }
  } else {
    j = a * 2;
    if (j >= b) {
      k = j * j;
      cout << k << endl;
    } else {
      k = b * b;
      cout << k << endl;
    }
  }
}
