#include <bits/stdc++.h>
using namespace std;
long long powe(long long a, long long b) {
  long long res = 1;
  while (b > 0) {
    if (b & 1) res = res * a;
    a = a * a;
    b >>= 1;
  }
  return res;
}
int main() {
  long long int t, a, b, area, ma, mb;
  cin >> t;
  while (t--) {
    cin >> a >> b;
    ma = max(a, b);
    mb = min(a, b);
    if ((mb * 2) > ma) {
      area = powe((mb * 2), 2);
    } else {
      area = powe(ma, 2);
    }
    cout << area << endl;
  }
}
