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