#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int a, b;
    cin >> a >> b;
    int ans = INF;
    int l = max(a, 2 * b);
    ans = min(ans, l * l);
    l = max(2 * a, b);
    ans = min(ans, l * l);
    l = max(a + b, max(a, b));
    ans = min(ans, l * l);
    cout << ans << endl;
  }
  return 0;
}
