#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int a = 0;
    int b = 0;
    cin >> a >> b;
    int p = a + a;
    int q = b + b;
    if (a >= b && q >= a) {
      cout << q * q;
    } else if (a >= b && q <= a) {
      cout << a * a;
    } else if (b >= a && p <= b) {
      cout << b * b;
    } else {
      cout << p * p;
    }
    cout << "\n";
  }
  return 0;
}
