#include <bits/stdc++.h>
using namespace std;
void swap(long long *a, long long *b) {
  long long temp = *a;
  *a = *b;
  *b = temp;
}
string mi(string s, string t) {
  if (s.size() > t.size()) {
    return t;
  } else if (s.size() < t.size()) {
    return s;
  } else {
    if (s.compare(t) >= 0) {
      return t;
    } else
      return s;
  }
}
long long isprime(long long n) {
  if (n < 2) return 0;
  if (n < 4) return 1;
  if (n % 2 == 0 or n % 3 == 0) return 0;
  for (long long i = 5; i * i <= n; i += 6)
    if (n % i == 0 or n % (i + 2) == 0) return 0;
  return 1;
}
void pairsort(long long a[], long long b[], long long n) {
  pair<long long, long long> pairt[n];
  for (long long i = 0; i < n; i++) {
    pairt[i].first = a[i];
    pairt[i].second = b[i];
  }
  sort(pairt, pairt + n);
  for (long long i = 0; i < n; i++) {
    a[i] = pairt[i].first;
    b[i] = pairt[i].second;
  }
}
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long fact(long long a) {
  long long p = 1;
  for (long long i = 1; i <= a; i++) p *= i;
  return p;
}
long long bw(long long a, long long b, long long m) {
  a %= m;
  long long res = 1;
  while (b > 0) {
    if (b & 1) res = res * a % m;
    a = a * a % m;
    b >>= 1;
  }
  return res;
}
vector<long long> decToBinary(long long n) {
  vector<long long> v;
  for (long long i = 31; i >= 0; i--) {
    long long k = n >> i;
    if (k & 1) v.push_back((long long)pow(2, i));
  }
  return v;
}
long long bs(long long n, long long g, long long b) {
  long long l = 1;
  long long r = n;
  long long x = ceil(n / 2.0);
  long long mid = (l + r) / 2;
  while (l <= r) {
    mid = (l + r) / 2;
    long long d = ceil((mid / 2.0)) * g;
    if (d > x)
      r = mid - 1;
    else if (d < x) {
      l = mid + 1;
    } else
      return mid;
  }
  return mid;
}
long long power(long long x, long long y) {
  long long res = 1;
  while (y > 0) {
    if (y & 1) res = res * x;
    y = y >> 1;
    x = x * x;
  }
  return res;
}
vector<long long> factors(long long x) {
  vector<long long> result;
  long long i = 1;
  while (i * i <= x) {
    if (x % i == 0) {
      result.push_back(i);
      if (x / i != i) {
        result.push_back(x / i);
      }
    }
    i++;
  }
  return result;
}
bool ispalin(string s) {
  long long n = s.size();
  for (long long i = 0; i < n / 2; i++) {
    if (s[i] != s[n - i - 1]) return false;
  }
  return true;
}
void dfs(long long s, bool *visited, vector<vector<long long>> adj) {
  visited[s] = true;
  for (auto i = adj[s].begin(); i != adj[s].end(); i++) {
    if (visited[*i] == false) {
      dfs(*i, visited, adj);
    }
  }
}
void bfs(long long n, long long s, vector<vector<long long>> adj) {
  bool visited[n];
  long long level[n];
  level[0] = 0;
  for (long long i = 0; i < n; i++) visited[i] = false;
  list<long long> q;
  visited[s] = true;
  q.push_back(s);
  while (!q.empty()) {
    s = q.front();
    q.pop_front();
    for (auto i = adj[s].begin(); i != adj[s].end(); i++) {
      if (!visited[*i]) {
        visited[*i] = true;
        level[*i] = level[s] + 1;
        q.push_back(*i);
      }
    }
  }
}
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long q = 1;
  cin >> q;
  while (q--) {
    long long a, b;
    cin >> a >> b;
    if (a == b) {
      cout << (2 * a) * (2 * a) << "\n";
    } else {
      if (a > b) {
        swap(&a, &b);
      }
      if (2 * a < b) {
        cout << b * b;
      } else {
        cout << 2 * a * 2 * a;
      }
      cout << "\n";
    }
  }
  return 0;
}
