#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(NULL);
  cin.tie(NULL);
  int t;
  cin >> t;
  while (t--) {
    int a, b;
    cin >> a >> b;
    int c = min(a, b);
    if (2 * c >= max(a, b)) {
      cout << 4 * c * c << "\n";
    } else {
      cout << max(a, b) * max(a, b) << "\n";
    }
  }
  return 0;
}
