#include <bits/stdc++.h>
using namespace std;
const int maxn = 5 + 1e5;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t;
  cin >> t;
  while (t--) {
    int a, b;
    cin >> a >> b;
    if (a == b) {
      cout << (a + b) * (a + b) << "\n";
    } else {
      if (2 * b < 2 * a) {
        if ((2 * b) >= a)
          cout << 4 * (b * b) << "\n";
        else
          cout << a * a << "\n";
      } else {
        if ((2 * a) >= b)
          cout << 4 * (a * a) << "\n";
        else
          cout << b * b << "\n";
      }
    }
  }
  return 0;
}
