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