#include <bits/stdc++.h>
using namespace std;
int maxn = 1000000000;
int main(int argc, char const *argv[]) {
  int t;
  cin >> t;
  while (t--) {
    int a, b;
    cin >> a >> b;
    if (a > b) a = a + b, b = a - b, a = a - b;
    int side = max(2 * a, b);
    cout << side * side << endl;
  }
}
