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