#include <bits/stdc++.h>
using namespace std;
bool isprime(long long n) {
  if (n == 2) return true;
  if (n == 1) return false;
  for (long long i = 2; i < n; ++i) {
    if (n % i == 0) return false;
  }
  return true;
}
void hehehaha() {
  long long a, b;
  cin >> a >> b;
  if (a < b) {
    int c = max(a * 2, b);
    cout << c * c << endl;
  } else {
    int c = max(a, b * 2);
    cout << c * c << endl;
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long t;
  t = 1;
  cin >> t;
  while (t--) {
    hehehaha();
  }
  return 0;
}
