#include <bits/stdc++.h>
using namespace std;
void solve() {
  int64_t n, m, k, p, q, r, count = 0, sum = 0, ans = 0;
  std::cin >> m >> n;
  ans = max(max(n, m), 2 * min(m, n));
  std::cout << ans * ans << '\n';
}
int32_t main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(NULL);
  auto time_start = chrono::high_resolution_clock::now();
  int64_t testcases = 1;
  std::cin >> testcases;
  while (testcases--) {
    solve();
  }
  auto time_end = chrono::high_resolution_clock::now();
  double time_taken =
      chrono::duration_cast<chrono::nanoseconds>(time_end - time_start).count();
  time_taken *= 1e-9;
  cerr << setprecision(6) << time_taken << " ms" << '\n';
  return 0;
}
