#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int a, b, x, y, ans, maxx;
    cin >> a >> b;
    x = min(a, b);
    maxx = max(a, b);
    y = 2 * x;
    while (y < maxx) {
      y++;
    }
    ans = y * y;
    cout << ans << endl;
  }
}
