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