#include <bits/stdc++.h>
using namespace std;
vector<long long> vec;
map<string, long long> mps;
map<long long, string> mpss;
set<long long> s1;
set<string> s2;
set<long long>::iterator itr;
long long tra[100006], tra1[100006];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long t;
  cin >> t;
  while (t--) {
    map<long long, long long> mp;
    map<long long, long long>::iterator it;
    string s, s1;
    deque<long long> deq;
    long long lock = 0, sum = 0, co = 0, ans = 0, a = 0, b = 0;
    long long n, m, x, y;
    cin >> n >> m;
    co = min(n, m);
    ans = max(n, m);
    if (co * 2 >= ans)
      cout << ((co * 2) * (co * 2)) << endl;
    else
      cout << ans * ans << endl;
    s1.clear();
    vec.clear();
  }
}
