#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int a, b, t;
  cin >> t;
  while (t--) {
    cin >> a >> b;
    if (a >= b) {
      while (a < 2 * b) a++;
      cout << a * a << endl;
    } else {
      while (b < 2 * a) b++;
      cout << b * b << endl;
    }
  }
  return (0);
}
