#include <bits/stdc++.h>
using namespace std;
struct hash_pair {
  template <class T1, class T2>
  size_t operator()(const pair<T1, T2>& p) const {
    auto hash1 = hash<T1>{}(p.first);
    auto hash2 = hash<T2>{}(p.second);
    return hash1 ^ hash2;
  }
};
int64_t power(int64_t a, int64_t b) {
  int64_t ans = 1;
  int64_t k = a;
  while (b > 0) {
    if (b & 1) {
      ans *= k;
      ans %= 1000000007;
    }
    k = (k * k) % 1000000007;
    b = b >> 1;
  }
  return ans;
}
int64_t gcd(int64_t a, int64_t b) {
  if (a == 0) return b;
  if (b == 0) return a;
  return gcd(b, a % b);
}
int64_t add_mod(int64_t a, int64_t b, int64_t m) {
  return ((a % m) + (b % m)) % m;
}
int64_t sub_mod(int64_t a, int64_t b, int64_t m) {
  return ((a % m) - (b % m) + m) % m;
}
int64_t mul_mod(int64_t a, int64_t b, int64_t m) {
  return ((a % m) * (b % m)) % m;
}
void print(double val, int k) {
  cout << fixed << setprecision(k) << val << "\n";
}
int64_t toint(string s) {
  stringstream ss;
  ss << s;
  int64_t x;
  ss >> x;
  return x;
}
const int N = 1e5 + 5;
int64_t arr[N];
void solve() {
  int t;
  cin >> t;
  while (t--) {
    int a, b;
    cin >> a >> b;
    int q = 2 * min(a, b);
    if (2 * a == q) {
      if (b <= q)
        cout << q * q << "\n";
      else {
        cout << b * b << "\n";
      }
    } else if (2 * b == q) {
      if (a <= q)
        cout << q * q << "\n";
      else {
        cout << a * a << "\n";
      }
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  solve();
  return 0;
}
