#include <bits/stdc++.h>
using namespace std;
long long int gcd(long long int A, long long int B) {
  return (B == 0) ? A : gcd(B, A % B);
}
long long int lcm(long long int A, long long int B) {
  return A * B / gcd(A, B);
}
priority_queue<pair<long long int, long long int>,
               vector<pair<long long int, long long int>>,
               greater<pair<long long int, long long int>>>
    pq;
const long long int N = 1e6 + 11;
void solve() {
  long long int a, b;
  cin >> a >> b;
  long long int box1 = max(2 * min(a, b), max(a, b));
  long long int box2 = max(a + b, max(a, b));
  cout << min(box1, box2) * min(box1, box2);
  cout << "\n";
  ;
  return;
}
signed main() {
  ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  long long int t = 1;
  cin >> t;
  while (t--) {
    solve();
  }
}
