#include <bits/stdc++.h>
using namespace std;
const int N = 10001;
const int M = 100001;
const int HA = 998244353;
const int INF = 2147483647;
const long long INFL = 9223372036854775807;
int main() {
  int t;
  scanf("%d", &t);
  int a, b;
  while (t--) {
    scanf("%d%d", &a, &b);
    long long ans =
        min(max(a, 2 * b) * max(a, 2 * b), max(b, 2 * a) * max(b, 2 * a));
    printf("%d\n", ans);
  }
  return 0;
}
