#include <bits/stdc++.h>
using namespace std;
void solve() {
  int a, b;
  cin >> a >> b;
  int MIN = min(a, b);
  int MAX = max(a, b);
  int x = max(2 * MIN, MAX);
  int y = MAX + MIN;
  cout << min(x, y) * min(x, y) << "\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int t;
  cin >> t;
  while (t--) solve();
  return 0;
}
