#include <bits/stdc++.h>
using namespace std;
const int mx = 260011;
const long long mod = 1e9 + 7;
void solve() {
  int a, b;
  cin >> a >> b;
  if (min(a, b) * 2 >= max(a, b)) {
    cout << 4 * min(a, b) * min(a, b) << endl;
  } else {
    cout << max(a, b) * max(a, b) << endl;
  }
}
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int t;
  t = 1;
  cin >> t;
  while (t--) {
    solve();
  }
  return 0;
}
