#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n, p, lato;
    cin >> n >> p;
    lato = max(max(n, p), 2 * min(n, p));
    cout << lato * lato << "\n";
  }
  return 0;
}
