#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    long long int a, b;
    cin >> a >> b;
    if (a == b) {
      cout << 4 * a * b << endl;
      continue;
    }
    if (2 * min(a, b) < max(a, b)) {
      cout << max(a, b) * max(a, b) << endl;
    } else {
      cout << 4 * min(a, b) * min(a, b) << endl;
    }
  }
}
