#include <bits/stdc++.h>
using namespace std;
int dx8[] = {0, 0, 1, 1, 1, -1, -1, -1};
int dy8[] = {1, -1, 1, -1, 0, 0, -1, 1};
int dx4[] = {0, 0, 1, -1};
int dy4[] = {1, -1, 0, 0};
const double pi = acos(-1.0);
const long long mod = 1000000007;
const long long manx = 1000000;
void solve() {
  long long n, a, b;
  cin >> n;
  while (n--) {
    cin >> a >> b;
    long long x = min(a, b);
    x *= 2;
    if (x < max(a, b))
      cout << max(a, b) * max(a, b) << endl;
    else
      cout << x * x << endl;
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  solve();
  return 0;
}
