#include <bits/stdc++.h>
int main() {
  int t, i, l, x, y, a, b;
  scanf("%d", &t);
  for (i = 1; i <= t; i++) {
    scanf("%d %d", &x, &y);
    if (x == y)
      l = x + x;
    else if (x != y) {
      a = (x > y ? x : y);
      b = (x < y ? x : y);
      if (b + b <= a)
        l = a;
      else if (b + b > a)
        l = b + b;
    }
    printf("%d\n", l * l);
  }
}
