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