Find the minimum area of a square land on which you can place two identical rectangular $a \times b$ houses. The sides of the houses should be parallel to the sides of the desired square land.

Formally,   You are given two identical rectangles with side lengths $a$ and $b$ ($1 \le a, b \le 100$) — positive integers (you are given just the sizes, but not their positions).  Find the square of the minimum area that contains both given rectangles. Rectangles can be rotated (both or just one), moved, but the sides of the rectangles should be parallel to the sides of the desired square. 

Two rectangles can touch each other (side or corner), but cannot intersect. Rectangles can also touch the sides of the square but must be completely inside it. You can rotate the rectangles. Take a look at the examples for a better understanding.

 [Image] The picture shows a square that contains red and green rectangles. 


-----Input-----

The first line contains an integer $t$ ($1 \le t \le 10\,000$) —the number of test cases in the input. Then $t$ test cases follow.

Each test case is a line containing two integers $a$, $b$ ($1 \le a, b \le 100$) — side lengths of the rectangles.


-----Output-----

Print $t$ answers to the test cases. Each answer must be a single integer — minimal area of square land, that contains two rectangles with dimensions $a \times b$.


-----Example-----
Input
8
3 2
4 2
1 1
3 1
4 7
1 3
7 4
100 100

Output
16
16
4
9
64
9
64
40000



-----Note-----

Below are the answers for the first two test cases:  [Image]   [Image]

Difficulty: EASY
Tags: Mathematics

Greedy algorithms
Skill types: Greedy algorithms

Starter code:

Solutions:
for i in range(int(input())):
	(a, b) = map(int, input().split())
	print(min(max(2 * b, a), max(2 * a, b)) ** 2)


for i in range(int(input())):
	(a, b) = map(int, input().split())
	mi = min(a, b)
	ma = max(a, b)
	print(max(ma * ma, 4 * mi * mi))


def main():
	import sys
	input = sys.stdin.buffer.readline

	def GCD(x, y):
		while y:
			(x, y) = (y, x % y)
		return x

	def lcm(a, b):
		return a * b // GCD(a, b)

	def merge(a, start, mid, end, d):
		p = start
		q = mid + 1
		arr = [0] * (end - start + 1)
		k = 0
		coun = 0
		for i in range(start, end + 1):
			if p > mid:
				arr[k] = a[q]
				q += 1
				k += 1
			elif q > end:
				arr[k] = a[p]
				d[a[p]] += coun
				k += 1
				p += 1
			elif a[p] < a[q]:
				arr[k] = a[p]
				d[a[p]] += coun
				k += 1
				p += 1
			else:
				arr[k] = a[q]
				k += 1
				q += 1
				coun += 1
		for i in range(k):
			a[start] = arr[i]
			start += 1

	def mergesort(a, start, end, d):
		if start < end:
			mid = (start + end) // 2
			mergesort(a, start, mid, d)
			mergesort(a, mid + 1, end, d)
			merge(a, start, mid, end, d)

	def inversion(l):
		d = {}
		for i in l:
			d[i] = 0
		mergesort(l, 0, len(l) - 1, d)
		return d

	def binary_search_lower(A, low, high, k):
		if high - low != 1:
			mid = (low + high) // 2
			x = A[mid]
			if x >= k:
				return binary_search_lower(A, low, mid, k)
			else:
				return binary_search_lower(A, mid, high, k)
		if A[low] >= k:
			return low
		else:
			return high

	def binary_expo(x, n):
		if n == 0:
			return 1
		elif n % 2 == 0:
			return binary_expo(x * x, n // 2)
		else:
			return x * binary_expo(x * x, (n - 1) // 2)

	def modu_expo(x, n, m):
		if n == 0:
			return 1
		elif n % 2 == 0:
			return modu_expo(x * x % m, n // 2, m)
		else:
			return x * modu_expo(x * x % m, (n - 1) // 2, m) % m

	def eEuclid(c, m):
		if m == 0:
			global d
			global x
			global y
			d = c
			x = 1
			y = 0
		else:
			eEuclid(m, c % m)
			temp = x
			x = y
			y = temp - c // m * y

	def mod_Inv(c, m):
		eEuclid(c, m)
		return (x % m + m) % m

	def ncr(n, r, p):
		num = den = 1
		for i in range(r):
			num = num * (n - i) % p
			den = den * (i + 1) % p
		return num * pow(den, p - 2, p) % p
	for _ in range(int(input())):
		(a, b) = map(int, input().split())
		x = max(a, b)
		y = min(a, b)
		print(max(x, y + y) ** 2)
main()


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	if a == b:
		print((a + b) ** 2)
	elif max(a, b) % min(a, b) == 0:
		print(max(a, b) ** 2)
	else:
		ans = max(max(a, b), 2 * min(a, b))
		print(ans ** 2)


def solve(a, b):
	result = float('inf')
	result = min(result, max(2 * a, b))
	result = min(result, max(2 * b, a))
	result = min(result, a + b)
	return pow(result, 2)
for i in range(int(input())):
	(a, b) = map(int, input().split())
	print(solve(a, b))


for sameer in [*open(0)][1:]:
	a = (*map(int, sameer.split()),)
	print(max(*a, 2 * min(a)) ** 2)


t = int(input())
while t > 0:
	t -= 1
	(l, b) = map(int, input().split())
	if l >= b:
		if l <= 2 * b:
			res = 4 * (b * b)
		else:
			res = l * l
	elif b <= 2 * l:
		res = 4 * (l * l)
	else:
		res = b * b
	print(res)


for _ in range(int(input())):
	(aa, b) = map(int, input().split())
	print(max(min(aa, b) * 2, aa, b) ** 2)


t = int(input())
for x in range(t):
	(a, b) = map(int, input().split())
	if a >= b:
		if 2 * b >= a:
			print((2 * b) ** 2)
		else:
			print(a ** 2)
	elif 2 * a >= b:
		print((2 * a) ** 2)
	else:
		print(b ** 2)


for _ in range(int(input())):
	(l, b) = map(int, input().split())
	s = max(2 * min(l, b), max(l, b))
	print(s * s)


T = int(input())
while T:
	(a, b) = map(int, input().split())
	if a <= b:
		k = 2 * a
		k1 = max(k, b)
		print(k1 * k1)
	else:
		k = 2 * b
		k1 = max(k, a)
		print(k1 * k1)
	T -= 1


testing_mode = True
import sys, traceback
test_data = ''
final_output = ''

def input(input_format=0, multi=0):
	if multi > 0:
		return [input(input_format) for x in range(multi)]
	else:
		next_line = next(test_data, None).strip() if test_data else sys.stdin.readline()
		if input_format == 0:
			formatted_input = [next_line]
		elif input_format == 1:
			formatted_input = list(map(int, next_line.split()))
		elif input_format == 2:
			formatted_input = list(map(float, next_line.split()))
		elif input_format == 3:
			formatted_input = next_line.split()
		elif input_format == 4:
			formatted_input = (lambda x: [x[0], list(map(int, x[1:]))])(next_line.split())
		elif input_format == 5:
			formatted_input = (lambda x: [x[0], list(map(float, x[1:]))])(next_line.split())
		else:
			formatted_input = [next_line]
		return formatted_input if len(formatted_input) > 1 else formatted_input[0]

def log(*args):
	if testing_mode:
		print(*args)

def out(output_line, output_format=0, newline=True):
	global final_output
	formatted_output = ''
	if output_format == 0:
		formatted_output = str(output_line)
	elif output_format == 1:
		formatted_output = ' '.join(map(str, output_line))
	elif output_format == 1:
		formatted_output = '\n'.join(map(str, output_line))
	if testing_mode:
		final_output += formatted_output + '\n' * newline
	else:
		print(formatted_output, end='\n' if newline else '')
test_inputs = ['\n8\n3 2\n4 2\n1 1\n3 1\n4 7\n1 3\n7 4\n100 100\n\n', '\n$$$\n', '\n$$$\n', '\n$$$\n']
test_outputs = ['\n16\n16\n4\n9\n64\n9\n64\n40000\n\n', '\n$$$\n', '\n$$$\n', '\n$$$\n']

def solve():
	k = input(1, input(1))
	for (a, b) in k:
		x = max(a, b)
		y = min(a, b) * 2
		out(max(x, y) ** 2)
	return

def run_all(overwrite_testing=False):
	global testing_mode, final_output, test_data
	testing_mode = overwrite_testing and testing_mode
	if testing_mode:
		tests_failed = 0
		for (test_number, (test_in, test_out)) in enumerate(zip(test_inputs, test_outputs)):
			final_output = ''
			if test_in.lstrip()[:3] == '$$$':
				continue
			test_data = iter([i for i in test_in.split('\n') if i])
			print(f'Test Case #{test_number + 1}:')
			print('<' * 20)
			fail = False
			verdict = '\x1b[92m\x1b[1mPASS\x1b[0m'
			try:
				solve()
				final = final_output.rstrip('\n')
				raw_out = iter(map(str, final.split('\n'))) if final else iter(())
			except Exception:
				raw_out = ''
				fail = True
				print('\x1b[95m')
				traceback.print_exc()
				print('\x1b[0m')
			if raw_out:
				if test_out.lstrip()[:3] == '$$$':
					verdict = '\x1b[94m\x1b[1mSKIP\x1b[0m'
					print('\x1b[94m' + '\n'.join(list(raw_out)) + '\x1b[0m')
				else:
					for line_out in [i for i in test_out.split('\n') if i]:
						line_raw = next(raw_out, '% None %')
						if line_raw == line_out.strip():
							print(f'\x1b[92m{line_raw}\x1b[0m')
						else:
							print(f'\x1b[91m{line_raw}\x1b[0m')
							fail = True
					line_raw = next(raw_out, None)
					while line_raw:
						print(f'\x1b[91m{line_raw}\x1b[0m')
						line_raw = next(raw_out, None)
						fail = True
			print('>' * 20)
			if fail:
				verdict = '\x1b[91m\x1b[1mFAIL\x1b[0m'
				tests_failed += 1
			print(verdict + '\n')
		if tests_failed:
			print(f"\x1b[91m\x1b[1m{tests_failed} TEST{('S' if tests_failed > 1 else '')} FAILED!\x1b[0m")
		else:
			print(f'\x1b[92m\x1b[1mALL TESTS PASSED!\x1b[0m')
	else:
		test_data = False
		solve()
run_all(False)


a = int(input())
for i in range(a):
	(n, k) = map(int, input().split())
	if min(n, k) * 2 > max(n, k):
		print((min(n, k) * 2) ** 2)
	else:
		print(max(n, k) ** 2)


t = int(input())
for _ in range(t):
	(a, b) = list(map(int, input().split()))
	print(min(max(a + a, b), max(b + b, a)) ** 2)


length = int(input())
for i in range(length):
	values = list(map(int, input().split(' ')))
	if values[0] < values[1]:
		(values[0], values[1]) = (values[1], values[0])
	n = max(values[0], values[1] * 2)
	print(n ** 2)


def main():
	(a, b) = map(int, input().split())
	if a < b:
		if 2 * a >= b:
			print(2 * a * a * 2)
		else:
			print(b ** 2)
	elif 2 * b >= a:
		print(2 * b * 2 * b)
	else:
		print(a ** 2)
for _ in range(int(input())):
	main()


t = int(input())
for i in range(t):
	a = list(map(int, input().split()))
	m = max(a)
	n = min(a)
	if m > 2 * n:
		print(m ** 2)
	else:
		print(4 * n ** 2)


casos = int(input())
for i in range(casos):
	casa = input().split()
	if int(casa[0]) > int(casa[1]):
		(casa[0], casa[1]) = (casa[1], casa[0])
	if int(casa[0]) * 2 > int(casa[1]):
		print(int(casa[0]) * int(casa[0]) * 4)
	else:
		print(int(casa[1]) * int(casa[1]))


r = int(input())
while r > 0:
	(a, b) = map(int, input().split())
	an = max(min(a, b) * 2, max(a, b))
	print(an ** 2)
	r -= 1


import sys
try:
	sys.stdin = open('Input.txt', 'r')
	sys.stdout = open('Output.txt', 'w')
except:
	pass
input = sys.stdin.readline
for testCases in range(int(input())):
	(a, b) = map(int, input().split())
	if a < b:
		if 2 * a > b:
			print((2 * a) ** 2)
		else:
			print(b ** 2)
	elif 2 * b > a:
		print((2 * b) ** 2)
	else:
		print(a ** 2)


for _ in range(int(input())):
	(a, b) = list(map(int, input().split()))
	if a == b:
		print(2 * a * (2 * a))
		continue
	if a < b:
		(a, b) = (b, a)
	b = 2 * b
	print(max(a * a, b * b))


for _ in range(int(input())):
	(a, b) = [int(x) for x in input().split()]
	print(min(max(2 * a, b) ** 2, max(a, 2 * b) ** 2))


for tc in range(int(input())):
	(a, b) = map(int, input().split())
	choices = [(a, b + b), (a + a, b), (a + b, b), (a, a + b)]
	answer = min(map(lambda x: max(x) ** 2, choices))
	print(answer)


for _ in range(int(input())):
	(a, b) = [int(x) for x in input().split()]
	if a <= b:
		a *= 2
	else:
		b *= 2
	print(max(a, b) ** 2)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	max_value = max(a, b)
	min_value = min(a, b)
	print(max(max_value, min_value * 2) ** 2)


N = int(input())
for _ in range(N):
	k = sorted(list(map(int, input().split())))
	if k[1] >= k[0] * 2:
		print(k[1] ** 2)
	else:
		print((k[0] * 2) ** 2)


import math

def minSquare(a, b):
	big = max(a, b)
	small = min(a, b)
	ans = max(small * 2, big)
	return ans ** 2
t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	print(minSquare(a, b))


t = int(input())
for _ in range(t):
	arr = [int(x) for x in input().split()]
	max_v = max(arr)
	min_v = min(arr)
	ans = max(min_v * 2, max_v)
	print(ans * ans)


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	area = 2 * a * b
	for j in range(10000):
		if j * j >= area and (a + a <= j and b <= j or (b + b <= j and a <= j)):
			print(j * j)
			break


numberofcases = int(input())
for _ in range(numberofcases):
	(x, y) = [int(t) for t in input().split()]
	(x, y) = (min(x, y), max(x, y))
	print(max(x + x, y) ** 2)


def f(x, y):
	if x == y:
		return 4 * x ** 2
	elif x > y:
		if 2 * y >= x:
			return 4 * y ** 2
		else:
			return x ** 2
	elif x < y:
		if 2 * x > y:
			return 4 * x ** 2
		else:
			return y ** 2
n = int(input())
for i in range(0, n):
	(x, y) = map(int, input().split())
	print(f(x, y))


t = int(input())
for i in range(t):
	(a, b) = list(map(int, input().split()))
	s = min(max(a * 2, b), max(a, b * 2))
	print(s * s)


n = int(input())
for _ in range(n):
	(a, b) = map(int, input().split())
	x = min(a, b)
	x = 2 * x
	if x < max(a, b):
		x = max(a, b)
		print(x * x)
	else:
		print(x * x)


t = int(input())
for i in range(t):
	(a, b) = [int(i) for i in input().split()]
	if a > b:
		if 2 * b > a:
			print(2 * b * 2 * b)
		else:
			print(a * a)
	elif 2 * a > b:
		print(2 * a * 2 * a)
	else:
		print(b * b)


N = int(input())
ans = []
for i in range(N):
	(a, b) = map(int, input().split())
	A = min(a, b) * 2
	B = max(a, b)
	ans.append(max(A, B) ** 2)
for i in range(N):
	print(ans[i])


n = int(input())
for i in range(n):
	(a, b) = map(int, input().split())
	if a < b:
		(a, b) = (b, a)
	if 2 * b <= a:
		ans = a ** 2
	else:
		ans = (2 * b) ** 2
	print(ans)


def test_case():
	(a, b) = map(int, input().split())
	if a < b:
		j = max(2 * a, b)
	else:
		j = max(2 * b, a)
	print(j * j)
t = int(input())
for i in range(t):
	test_case()


for ad in range(int(input())):
	(a, b) = list(map(int, input().split()))
	c = min(a, b)
	d = max(a, b)
	if 2 * c < d:
		print(d ** 2)
	else:
		print(4 * c * c)


def solve(a, b):
	size = max(a * 2, b)
	print(size * size)
	return
n = int(input())
for i in range(0, n):
	(a, b) = map(int, input().split())
	if b >= a:
		solve(a, b)
	else:
		solve(b, a)


for t in range(int(input())):
	(a, b) = map(int, input().split())
	h = max(a, b)
	l = min(a, b)
	if h == l:
		print((2 * h) ** 2)
	elif h % l == 0:
		print(h ** 2)
	else:
		print(max(h, 2 * l) ** 2)


for i in range(int(input())):
	(a, b) = [int(r) for r in input().split()]
	if a == b:
		print((a + a) ** 2)
		continue
	elif a < b:
		(a, b) = (b, a)
	s1 = b * 2
	if a < s1:
		print(s1 ** 2)
	else:
		print(a ** 2)


def res(a, b):
	return pow(min(max(2 * a, b), max(a, 2 * b)), 2)
t = int(input())
l = []
for _ in range(t):
	(a, b) = map(int, input().split())
	l.append(res(a, b))
for i in l:
	print(i)


def area(l):
	a = min(l)
	b = max(l)
	a1 = a * b
	ta = a1 * 2
	r1 = (a + a) ** 2
	r2 = b ** 2
	if ta <= r1:
		print(r1)
	elif ta > r1:
		print(r2)
for i in range(int(input())):
	l = list(map(int, input().split()))
	area(l)


from sys import stdin
input = stdin.readline
for Ti in range(int(input().strip())):
	(a, b) = [int(x) for x in input().strip().split()]
	print(max(min(a, b) * 2, max(a, b)) ** 2)


c = int(input())
for i in range(1, c + 1):
	g = input().split()
	g = [int(i) for i in g]
	a = g[0]
	b = g[1]
	print(min(max(a * 2, b), max(a, b * 2)) ** 2)


exec(int(input()) * 'x,y=map(int,input().split());print(max(max(x,y),2*min(x,y))**2);')


t = int(input())
for q in range(t):
	(a, b) = map(int, input().split())
	print(max((2 * min(a, b)) ** 2, max(a, b) ** 2))


import os
import sys
import io
import math
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
for t in range(int(input())):
	(a, b) = map(int, input().split())
	print(max(min(a, b) * 2, max(a, b)) ** 2)


t = int(input())
while t:
	(a, b) = map(int, input().split())
	res = min(max(a, 2 * b), max(2 * a, b))
	print(res * res)
	t -= 1


t = int(input())
l = []
for i in range(t):
	(a, b) = map(int, input().split())
	l.append(max(min(a, b) * 2, max(a, b)) ** 2)
for i in l:
	print(i)


for i in range(int(input())):
	(x, y) = [int(a) for a in input().split()]
	if x <= y:
		if 2 * x >= y:
			print((2 * x) ** 2)
		else:
			print(y ** 2)
	elif 2 * y >= x:
		print((2 * y) ** 2)
	else:
		print(x ** 2)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	temp1 = max(2 * a, b)
	temp2 = max(2 * b, a)
	print(min(temp1, temp2) ** 2)


for _ in range(int(input())):
	(a, b) = list(map(int, input().split()))
	side1 = 2 * min(a, b)
	side2 = max(a, b)
	if side1 > side2:
		print(side1 ** 2)
	else:
		print(side2 ** 2)


t = int(input())
for _ in range(t):
	l = list(map(int, input().strip().split()))
	a = l[0]
	b = l[1]
	c = max(a, b)
	d = min(a, b)
	d = 2 * d
	if d >= c:
		print(d ** 2)
	else:
		print(c ** 2)


import sys
input = lambda : sys.stdin.readline().rstrip()
inp = sys.stdin.buffer.readline

def I():
	return list(map(int, inp().split()))
for _ in range(I()[0]):
	(a, b) = I()
	if 2 * min(a, b) >= max(a, b):
		print((2 * min(a, b)) ** 2)
	else:
		print(max(a, b) ** 2)


import math, sys
input = sys.stdin.readline
for t in range(int(input())):
	(a, b) = map(int, input().split())
	m = min(a, b)
	M = max(a, b)
	if m * 2 >= M:
		print(pow(m * 2, 2))
	else:
		print(pow(M, 2))


t = int(input())
for i in range(t):
	w = input().split()
	(a, b) = (int(w[0]), int(w[1]))
	if max(a, b) < 2 * min(a, b):
		print(4 * min(a, b) ** 2)
	else:
		print(max(a, b) ** 2)


import sys
input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return s[:len(s) - 1]

def invr():
	return map(int, input().split())

def solve(t):
	(a, b) = t
	ans = 0
	if a == b:
		ans = 2 * a
	elif a > b:
		ans = max(2 * b, a)
	else:
		ans = max(b, 2 * a)
	print(ans ** 2)
T = inp()
tests = []
for _ in range(T):
	tests.append(inlt())
for t in tests:
	solve(t)


t = int(input())
for i in range(t):
	s = input().split()
	a = int(s[0])
	b = int(s[1])
	print(min(max(2 * a, b), max(2 * b, a)) ** 2)


a = int(input())
for i in range(a):
	l = list(map(int, input().split()))
	l.sort()
	(b, c) = (l[1], l[0])
	if 2 * c <= b:
		an = b ** 2
	else:
		an = (2 * c) ** 2
	print(an)


import sys
input = lambda : sys.stdin.readline().strip()
t = int(input())
while t:
	t -= 1
	(a, b) = map(int, input().split())
	vals = [max(2 * a, b), max(2 * b, a)]
	print(min(vals) ** 2)


for _ in range(int(input())):
	(a, b) = sorted(list(map(int, input().split())))
	if 2 * a >= b:
		print((a * 2) ** 2)
	else:
		print(b ** 2)


import math
t = int(input())
for tt in range(t):
	(a, b) = map(int, input().split())
	xx = 1
	mi = min(a, b)
	ma = max(a, b)
	while 1:
		if 2 * mi <= xx and xx >= ma and (xx >= mi):
			break
		xx += 1
	print(xx * xx)


for i in range(int(input())):
	(a, b) = map(int, input().split())
	p = min(a, b)
	q = max(a, b)
	c = max(2 * p, q)
	print(c ** 2)


import sys
input = sys.stdin.readline
ins = lambda : input().rstrip()
ini = lambda : int(input().rstrip())
inm = lambda : map(int, input().rstrip().split())
inl = lambda : list(map(int, input().split()))
out = lambda x, s='\n': print(s.join(map(str, x)))
t = ini()
for _ in range(t):
	(a, b) = inm()
	print(min(max(a, b + b) ** 2, max(a + a, b) ** 2))


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	if a == b:
		print(a * b * 4)
		continue
	if a > b:
		(a, b) = (b, a)
	if 4 * a * a >= 2 * a * b:
		print(4 * a * a)
	else:
		print(2 * a * b + b * (b - 2 * a))


t = int(input())
while t:
	(a1, b1) = map(int, input().split())
	a = min(a1, b1)
	b = max(a1, b1)
	x = max(2 * a, b)
	y = 2 * b
	z = a + b
	result = min(x, y, z)
	print(result ** 2)
	t -= 1


LIMIT = int(input())
for _ in range(LIMIT):
	(a, b) = map(int, input().split())
	if a < b:
		small = a
		large = b
	elif b < a:
		small = b
		large = a
	else:
		small = large = a
	double = 2 * small
	if double > large:
		print(double * double)
	else:
		print(large * large)


for _ in range(int(input())):
	(a, b) = [int(i) for i in input().split()]
	x = max(a, b)
	y = min(a, b)
	if y * 2 > x:
		area = (y * 2) ** 2
	else:
		area = x ** 2
	print(area)


from sys import stdin, stdout
import math, sys
from itertools import permutations, combinations
from collections import defaultdict, deque, OrderedDict
from os import path
import bisect as bi
import heapq

def yes():
	print('YES')

def no():
	print('NO')
if path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

	def I():
		return int(input())

	def In():
		return map(int, input().split())
else:

	def I():
		return int(stdin.readline())

	def In():
		return map(int, stdin.readline().split())

def main():
	try:
		l = list(In())
		l.sort()
		(a, b) = (l[0], l[1])
		if a * 2 >= b:
			print((a * 2) ** 2)
		elif a * 2 < b:
			print(b ** 2)
		else:
			print((2 * b) ** 2)
	except:
		pass
M = 998244353
P = 1000000007
for _ in range(I()):
	main()


for t in range(int(input())):
	(a, b) = map(int, input().split())
	if min(a, b) * 2 >= max(a, b):
		print((2 * min(a, b)) ** 2)
	else:
		print(max(a, b) ** 2)


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	M = max(a, b)
	m = min(a, b)
	print(max(m * 2, M) ** 2)


t = int(input())
while t:
	t -= 1
	(m, n) = map(int, input().split())
	a = min(m, n)
	c = max(m, n)
	b = max(2 * a, c)
	print(int(b * b))


T = int(input())
for t in range(1, T + 1):
	string = input().split()
	a = int(string[0])
	b = int(string[1])
	x = max(a, b)
	y = min(a, b)
	a = y
	b = x
	print(max(2 * a, b) ** 2)


for i in range(int(input())):
	m = list(map(int, input().split()))
	a = min(m) * 2
	b = max(m)
	if b <= a:
		print(a ** 2)
	else:
		print(b ** 2)


test = int(input())
for i in range(test):
	(x, y) = map(int, input().split())
	p = min(x, y)
	q = max(x, y)
	if 2 * p >= q:
		print(2 * 2 * p * p)
	else:
		print(q * q)


import sys
for i in range(int(sys.stdin.readline().strip())):
	(n, k) = map(int, input().split())
	a = min(n, k)
	if 2 * a >= max(n, k):
		print((2 * a) ** 2)
	else:
		print(max(n, k) ** 2)


t = int(input())
testResult = []
for i in range(t):
	(a, b) = map(int, input().split())
	testResult.append(pow(min(max(2 * a, b), max(a, 2 * b)), 2))
for i in testResult:
	print(i)


for i in range(int(input())):
	(a, b) = map(int, input().split())
	if a < b:
		tem = a
		a = b
		b = tem
	if 2 * b > a:
		print(2 * b * 2 * b)
	else:
		print(a * a)


cases = int(input())
for _ in range(cases):
	sides = list(map(int, input().split(' ')))
	print(max(max(sides), 2 * min(sides)) ** 2)


num = int(input(''))
i = 0
while i < num:
	(a, b) = input('').split()
	minimum = min(int(a), int(b))
	maximum = max(int(a), int(b))
	if minimum * 2 < maximum:
		print(maximum ** 2)
	else:
		print((minimum * 2) ** 2)
	i += 1


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	i = max(a, b)
	j = min(a, b)
	if i == j:
		print(4 * i ** 2)
	elif i // 2 >= j and j * 2 < i:
		print(i ** 2)
	else:
		print(4 * j ** 2)


for __ in range(int(input())):
	(a, b) = map(int, input().split())
	side = 2 * min(a, b)
	if side * side < 2 * a * b:
		print(max(a, b) * max(a, b))
	else:
		print(side * side)


for _ in range(int(input())):
	(a, b) = map(int, input().strip().split())
	l = max(a, b)
	m = min(a, b)
	if l >= 2 * m:
		print(l * l)
	else:
		print(4 * m * m)


t = int(input())
canh1 = []
canh2 = []
for i in range(0, t, 1):
	(a, b) = input().split(' ')
	a = int(a)
	b = int(b)
	canh1.append(a)
	canh2.append(b)
for i in range(0, t, 1):
	if 2 * canh1[i] >= canh2[i] and 2 * canh2[i] >= canh1[i]:
		print(min(canh1[i] ** 2 * 4, canh2[i] ** 2 * 4))
	elif 2 * canh1[i] <= canh2[i]:
		print(canh2[i] ** 2)
	elif 2 * canh2[i] <= canh1[i]:
		print(canh1[i] ** 2)


def findarea(max, min):
	l = min + min
	if l >= max:
		k = l ** 2
		print(k)
	elif l < max:
		k = max ** 2
		print(k)
t = int(input())
if t >= 1 and t <= 10000:
	for i in range(t):
		(a, b) = list(map(int, input().split(' ')))
		if 1 <= a <= 100 and 1 <= b <= 100:
			if a > b:
				min = b
				max = a
				findarea(max, min)
			elif a == b:
				l = a + a
				k = l ** 2
				print(k)
			else:
				min = a
				max = b
				findarea(max, min)


t = int(input())
for l in range(t):
	(a, b) = [int(x) for x in input().split()]
	x2 = min(a, b) * 2
	xm = max(a, b)
	diff = abs(xm - x2)
	print((min(x2, xm) + diff) ** 2)


for i in range(int(input())):
	a = list(map(int, input().strip().split()))[:2]
	if a[0] > a[1]:
		c = 2 * a[1]
		if c < a[0]:
			print(a[0] * a[0])
		else:
			print(c * c)
	else:
		c = 2 * a[0]
		if c < a[1]:
			print(a[1] * a[1])
		else:
			print(c * c)


def solve(A):
	(a, b) = (A[0], A[1])
	side = max(2 * min(a, b), max(a, b))
	return side ** 2
res = []
t = int(input())
while t:
	arr = input().split()
	A = [int(n) for n in arr]
	res.append(solve(A))
	t -= 1
for r in res:
	print(r)


cases = int(input())
for x in range(0, cases):
	(a, b) = [int(x) for x in input().split()]
	if a == b:
		print(2 * a * 2 * a)
		continue
	length = max(max(a, b), 2 * min(a, b))
	print(length * length)


import collections
from math import sqrt, ceil

def solve(w, h):
	ans1 = (w + w, h)
	ans2 = (h + h, w)
	ans3 = (w + h, w)
	ans4 = (w + h, h)
	minBox = min(ans1, ans2, ans3, ans4)
	dim = max(minBox[0], minBox[1])
	return dim * dim
t = int(input().strip())
for i in range(t):
	[w1, h1] = list(map(int, input().strip().split()))
	print(solve(w1, h1))


squares = [0] * 100
for i in range(100):
	squares[i] = (i + 1) ** 2
t = int(input())
for testIndex in range(t):
	(a, b) = map(int, input().split())
	print(min(max(a * 2, b), max(a, 2 * b)) ** 2)


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def fact(x):
	if x == 0:
		return 1
	else:
		return x * fact(x - 1)

def lower_bound(li, num):
	answer = -1
	start = 0
	end = len(li) - 1
	while start <= end:
		middle = (end + start) // 2
		if li[middle] >= num:
			answer = middle
			end = middle - 1
		else:
			start = middle + 1
	return answer

def upper_bound(li, num):
	answer = -1
	start = 0
	end = len(li) - 1
	while start <= end:
		middle = (end + start) // 2
		if li[middle] <= num:
			answer = middle
			start = middle + 1
		else:
			end = middle - 1
	return answer

def abs(x):
	return x if x >= 0 else -x

def binary_search(li, val, lb, ub):
	ans = 0
	while lb <= ub:
		mid = (lb + ub) // 2
		if li[mid] > val:
			ub = mid - 1
		elif val > li[mid]:
			lb = mid + 1
		else:
			ans = 1
			break
	return ans
from math import *
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	side = max(max(a, b), 2 * min(a, b))
	print(side ** 2)


import math as m
for i in range(int(input())):
	(a, b) = map(int, input().split())
	if a == 1 and b == 1:
		print(4)
	else:
		su = (2 * min(a, b)) ** 2
		if m.sqrt(su) < max(a, b):
			print(max(a, b) ** 2)
		else:
			print(su)


t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	if a < b:
		(a, b) = (b, a)
	ans = max(2 * b, a)
	print(ans ** 2)


import collections
import os
import sys
from io import BytesIO, IOBase
import math

def main():
	t = int(input())
	for _ in range(t):
		(a, b) = list(map(int, input().split()))
		p = max(max(a, b), 2 * min(a, b))
		print(p * p)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


for i in range(int(input())):
	(a, b) = map(int, input().split())
	c = 2 * a * b
	d = 2 * min(a, b)
	if d ** 2 >= c:
		print(d ** 2)
	else:
		print(max(a, b) ** 2)


import sys
import heapq

def main():
	t = int(input())
	for _ in range(t):
		(a, b) = map(int, sys.stdin.readline().split())
		if a > b:
			(a, b) = (b, a)
		if a * 2 < b:
			print(b * b)
		else:
			print((2 * a) ** 2)
	return
main()


for s in [*open(0)][1:]:
	(a, b) = sorted(map(int, s.split()))
	print((a + a) ** 2 if a + a >= b else b * b)


import sys
tests = int(sys.stdin.readline().split()[0])
for test in range(tests):
	numbers = [int(i) for i in sys.stdin.readline().split()]
	(a, b) = (numbers[0], numbers[1])
	min_side = min(a, b)
	max_side = max(a, b)
	if 2 * min_side <= max_side:
		print(max_side ** 2)
	else:
		print((2 * min_side) ** 2)


t = int(input())
while t != 0:
	(a, b) = map(int, input().split())
	mx = max(a, b)
	mn = min(a, b)
	if mn == mx or 2 * mn == mx or 2 * mn > mx:
		x = 2 * mn
		print(x ** 2)
	elif 2 * mn < mx:
		x = mx
		print(x ** 2)
	t = t - 1


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	y = min(a, b)
	ans = y * 2
	z = max(a, b)
	if z > ans:
		print(z * z)
	else:
		print(ans * ans)


for i in range(int(input())):
	(m, n) = map(int, input().split())
	if m == n:
		print(2 * m * 2 * m)
		continue
	if m <= n:
		if 2 * m < n:
			print(n * n)
		else:
			print(4 * m * m)
	elif 2 * n > m:
		print(2 * 2 * n * n)
	else:
		print(m * m)


t = int(input())
for a in range(t):
	(a, b) = map(int, input().split())
	x = max(4 * a ** 2, b ** 2)
	y = max(4 * b ** 2, a ** 2)
	z = min(x, y)
	print(z)


for t in range(int(input())):
	(x, y) = map(int, input().split())
	if max(x, y) >= 2 * min(x, y):
		print(max(x, y) * max(x, y))
	else:
		print(2 * min(x, y) * 2 * min(x, y))


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	mn = min(a, b)
	mx = max(a, b)
	if mn * 2 > mx:
		s = (mn * 2) ** 2
	else:
		s = mx ** 2
	print(s)


def solution():
	(a, b) = list(map(int, input().split()))
	minL = min(a, b)
	maxL = max(a, b)
	if 2 * minL < maxL:
		print(maxL * maxL)
	else:
		print(2 * minL * (2 * minL))
T = int(input())
while T:
	solution()
	T -= 1


t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	if a > b:
		(a, b) = (b, a)
	if a == b or b // a <= 1:
		print((a + a) * (a + a))
	else:
		print(b * b)


from sys import stdin, stdout
t = int(input())
for i in range(t):
	(a, b) = [int(x) for x in stdin.readline().rstrip().split()]
	smaller = min(a, b)
	bigger = max(a, b)
	if bigger > 2 * smaller:
		print(bigger * bigger)
	else:
		print(2 * smaller * (2 * smaller))


t = int(input())
while t > 0:
	[a, b] = [int(x) for x in input().split()]
	minimum = min(a, b)
	maximum = max(a, b)
	if 2 * minimum >= maximum:
		length = 2 * minimum
		breadth = maximum + (length - maximum)
		print(length * breadth)
	else:
		print(max(a, b) ** 2)
	t -= 1


t = int(input())
while t != 0:
	t -= 1
	(n, m) = map(int, input().split(' '))
	a = min(n, m)
	b = max(n, m)
	a = a * 2
	ans = max(a, b)
	print(ans * ans)


t = int(input())
for _ in range(t):
	(a, b) = list(map(int, input().split()))
	if a == b:
		print(4 * a * b)
	if a < b:
		if 2 * a > b:
			print(2 * a * (2 * a))
		else:
			print(b * b)
	elif b < a:
		if 2 * b > a:
			print(2 * b * (2 * b))
		else:
			print(a * a)


t = int(input())
while t > 0:
	t -= 1
	(a, b) = map(int, input().split())
	m = min(a, b)
	mx = max(a, b)
	m = m * 2
	mx = max(mx, m)
	print(mx * mx)


t = int(input())
for _ in range(0, t):
	(a, b) = map(int, input().split())
	big = max(a, b)
	small = min(a, b)
	if big == small:
		print((big * 2) ** 2)
	elif big < 2 * small:
		print((2 * small) ** 2)
	else:
		print(big * big)


def qa(a, b):
	if a * 2 >= b:
		return (a * 2) ** 2
	else:
		return b ** 2
	pass
m = int(input())
for i in range(m):
	(a, b) = list(map(int, input().split()))
	if a < b:
		print(qa(a, b))
	else:
		print(qa(b, a))


def count():
	(a, b) = sorted(list(map(int, input().split())))
	if b > 2 * a:
		return b ** 2
	else:
		return (2 * a) ** 2
for i in range(int(input())):
	print(count())


list1 = []
output = []
cases = int(input(''))
for c in range(cases):
	(x, y) = map(int, input().split())
	list1.append(x)
	list1.append(y)
	list1.sort()
	if list1[0] == list1[1]:
		output.append((x * 2) ** 2)
		list1 = []
		continue
	if list1[0] * 2 <= list1[1]:
		output.append(list1[1] ** 2)
		list1 = []
		continue
	if list1[0] * 2 > list1[1]:
		output.append((list1[0] * 2) ** 2)
		list1 = []
print(*output, sep='\n')


a = int(input())
for x in range(a):
	n = input()
	n = n.split()
	z = []
	for i in n:
		z.append(int(i))
	l = max(z)
	b = min(z)
	if l == b:
		print(4 * l ** 2)
	elif 2 * b > l:
		print(4 * b * b)
	elif 2 * b <= l:
		print(l * l)


t = int(input())
i = 1
while i <= t:
	(a, b) = map(int, input().split())
	if a > b:
		(a, b) = (b, a)
	a *= 2
	if a > b:
		print(a * a)
	else:
		print(b * b)
	i = i + 1


t = int(input())
ans = list()
i = 1
while i <= t:
	p = input()
	p = p.split()
	if int(p[0]) >= int(p[1]):
		a = int(p[0])
		b = int(p[1])
	else:
		a = int(p[1])
		b = int(p[0])
	if 2 * b >= a:
		ans.append((2 * b) ** 2)
	else:
		ans.append(a ** 2)
	i += 1
for a in ans:
	print(a)


def test():
	T = I()
	for _ in range(T):
		A = LI()
		A.sort()
		print(max(A[0] * 2, A[1]) ** 2)
	return

def examA():
	T = I()
	ans = []
	for _ in range(T):
		cur = 0
		ans.append(cur)
	for v in ans:
		print(v)
	return

def examB():
	T = I()
	ans = []
	for _ in range(T):
		cur = 0
		ans.append(cur)
	for v in ans:
		print(v)
	return

def examC():
	T = I()
	ans = []
	for _ in range(T):
		cur = 0
		ans.append(cur)
	for v in ans:
		print(v)
	return

def examD():
	ans = 0
	print(ans)
	return

def examE():
	ans = 0
	print(ans)
	return

def examF():
	ans = 0
	print(ans)
	return
from decimal import getcontext, Decimal as dec
import sys, bisect, heapq
from copy import deepcopy
from heapq import heappop, heappush, heapify
from collections import Counter, defaultdict, deque
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

def I():
	return int(input())

def LI():
	return list(map(int, sys.stdin.readline().split()))

def DI():
	return dec(input())

def LDI():
	return list(map(dec, sys.stdin.readline().split()))

def LSI():
	return list(map(str, sys.stdin.readline().split()))

def LS():
	return sys.stdin.readline().split()

def SI():
	return sys.stdin.readline().strip()
global mod, mod2, inf, alphabet, _ep
mod = 10 ** 9 + 7
mod2 = 998244353
inf = 10 ** 18
_ep = dec('0.000000000001')
alphabet = [chr(ord('a') + i) for i in range(26)]
alphabet_convert = {chr(ord('a') + i): i for i in range(26)}
getcontext().prec = 28
sys.setrecursionlimit(10 ** 5)
test()


t = int(input())
while t:
	inp = input().split()
	a = int(inp[0])
	b = int(inp[1])
	x = min(max(a + a, b), max(b + b, a), a + b)
	print(x * x)
	t = t - 1


T = int(input())
for _ in range(0, T):
	A = list(map(int, input().split()))
	A.sort()
	if 2 * A[0] > A[1]:
		print(2 * A[0] * A[0] * 2)
	else:
		print(A[1] * A[1])


def solve(a, b):
	min_size = min(a, b)
	max_size = max(a, b)
	if min_size * 2 <= max_size:
		return max_size * max_size
	else:
		return min_size * min_size * 4

def main():
	T = int(input())
	for _ in range(T):
		(a, b) = map(int, input().split())
		print(solve(a, b))
main()


import math
import sys
import re
n = int(input())
for x in range(n):
	(a, b) = map(int, input().rstrip().split())
	a1 = max(a, b)
	b1 = min(a, b)
	if a1 > 2 * b1:
		print(a1 * a1)
	else:
		print(4 * b1 * b1)


import sys, os.path
if os.path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
sys.setrecursionlimit(10 ** 5)

def II():
	return int(sys.stdin.readline())

def MI():
	return map(int, sys.stdin.readline().split())

def LI():
	return list(map(int, sys.stdin.readline().split()))

def solve():
	(a, b) = MI()
	if a == b:
		print((2 * a) ** 2)
	elif a > b and 2 * b >= a:
		print((2 * b) ** 2)
	elif a > b and 2 * b < a:
		print(a ** 2)
	elif b > a and 2 * a >= b:
		print((2 * a) ** 2)
	else:
		print(b ** 2)
for _ in range(II()):
	solve()


for _ in range(int(input())):
	(x, y) = map(int, input().split())
	m = min(x, y)
	a = 2 * m
	a = max(max(x, y), a)
	print(a * a)


t = int(input())
for _ in range(t):
	(a, b) = input().split()
	a = int(a)
	b = int(b)
	result = min(max(a, 2 * b), max(2 * a, b))
	print(result * result)


for i in range(int(input())):
	a = list(map(int, input().split()))
	a.sort()
	b = a[1] ** 2
	c = (2 * a[0]) ** 2
	print(max(b, c))


import math
ans = ''
for _ in range(int(input())):
	nk = list(map(int, input().split()))
	a = nk[0]
	b = nk[1]
	s = min(max(a * 2, b), max(a, b * 2))
	ans += str(s * s) + '\n'
print(ans)


t = int(input())
for i in range(t):
	(nB, D) = str(input()).split(' ')
	D = int(D)
	nB = int(nB)
	minside = min(D, nB)
	maxside = max(D, nB)
	if 2 * minside < maxside:
		print(maxside ** 2)
	else:
		print((2 * minside) ** 2)


t = int(input())
for i in range(t):
	l = [int(i) for i in input().split()]
	if l[0] <= l[1]:
		a = l[0]
		c = l[1]
	else:
		a = l[1]
		c = l[0]
	b = a + a
	if b >= c:
		print(b * b)
	else:
		print(c * c)


import math
import sys
t = int(input())
for i in range(t):
	(a, b) = list(map(int, input().split()))
	if a > b:
		(a, b) = (b, a)
	s = max(b, a * 2)
	print(s * s)


n = int(input())
for i in range(n):
	a = list(map(int, input().strip().split()))
	k = a[0]
	v = a[1]
	if k < v:
		if k * 2 < v:
			print(v * v)
		if k * 2 == v:
			print(v * v)
		if k * 2 > v:
			print(k * 2 * (k * 2))
	if k > v:
		if k < v * 2:
			print(v * 2 * (v * 2))
		if k == v * 2:
			print(k * k)
		if k > v * 2:
			print(k * k)
	if k == v:
		print(k * v * 4)


def sq(a, b):
	x = min(a, b)
	if 2 * x > max(a, b):
		res = (2 * x) ** 2
		return res
	else:
		x = max(a, b)
		return x ** 2
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	print(sq(a, b))


t = input()
for i in range(int(t)):
	(a, b) = map(int, input().split())
	d = min(a, b) * 2
	c = max(a, b)
	ans = max(d, c)
	print(ans ** 2)


import sys
import os
import heapq
try:
	path = './file/input.txt'
	if os.path.exists(path):
		sys.stdin = open(path, 'r')
except:
	pass
t = int(input())

def printd(value):
	pass
for _ in range(t):
	arr = list(map(int, input().split(' ')))
	(a, b) = (arr[0], arr[1])
	if a > b:
		b *= 2
	else:
		a *= 2
	if a > b:
		result = a * a
	else:
		result = b * b
	print(result)


import sys
t = int(sys.stdin.readline())
for _ in range(t):
	(a, b) = map(int, sys.stdin.readline().split())
	if a > b:
		s = max(a, 2 * b)
	else:
		s = max(b, 2 * a)
	print(s ** 2)


import sys, math, os
from io import BytesIO, IOBase
from collections import defaultdict as dd, deque, Counter

def data():
	return sys.stdin.readline().strip()

def mdata():
	return list(map(int, data().split()))

def outl(var):
	sys.stdout.write(' '.join(map(str, var)) + '\n')

def out(var):
	sys.stdout.write(str(var) + '\n')
sys.setrecursionlimit(100000)
INF = float('inf')
mod = int(1000000000.0) + 7

def main():
	for t in range(int(data())):
		(a, b) = mdata()
		print(max(a, b, 2 * min(a, b)) ** 2)

def __starting_point():
	main()
__starting_point()


def calc_area(li):
	b = min(li)
	if b * 2 >= max(li):
		return (b * 2) ** 2
	else:
		return max(li) ** 2
n = int(input())
for i1 in range(n):
	j1 = list(map(int, input().split(' ')))
	print(calc_area(j1))


t = int(input())

def fun(a, b):
	k1 = min(a, b)
	k2 = max(a, b)
	ans = max(2 * k1, k2)
	print(ans ** 2)
while t:
	t -= 1
	(a, b) = map(int, input().split())
	fun(a, b)


for i in range(int(input())):
	numbers = list(map(int, input().split()))
	numbers.sort()
	if numbers[1] > 2 * numbers[0]:
		print(numbers[1] * numbers[1])
	else:
		print(min([4 * numbers[0] ** 2]))


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	mn = min(a, b) * 2
	other = max(a, b)
	if other > mn:
		print(other ** 2)
	else:
		print(mn ** 2)


t = int(input())
for _ in range(t):
	(c1, c2) = map(int, input().split())
	a = min(c1, c2)
	b = max(c1, c2)
	if 2 * a >= b:
		print(pow(2 * a, 2))
	else:
		print(pow(b, 2))


import math
t = int(input())
while t > 0:
	(a, b) = [int(x) for x in input().split()]
	if a > b:
		(a, b) = (b, a)
	s = int(2 * a)
	if b <= s:
		area = pow(s, 2)
	else:
		area = pow(b, 2)
	print(area)
	t = t - 1


def answer():
	n = int(input())
	c_out = []
	while n:
		a = input().split()
		a = [int(x) for x in a]
		(l1, l2) = (min(a[0], a[1]), max(a[0], a[1]))
		length = max(2 * l1, l2)
		c_out.append(length ** 2)
		n -= 1
	for x in c_out:
		print(x)
answer()


for _ in range(int(input())):
	(n, m) = map(int, input().split())
	mini = min(n, m)
	maxi = max(n, m)
	temp = max(mini * 2, maxi)
	print(temp * temp)


import sys
t = int(input())
for i in range(0, t):
	(a, b) = map(int, input().split())
	d = min(a, b)
	c = max(b, a)
	if c >= 2 * d:
		print(c * c)
	else:
		print(4 * d * d)


testcases = int(input())
for testcase in range(testcases):
	newarr = input()
	newarr = newarr.split()
	leng = int(newarr[0])
	breath = int(newarr[1])
	getmin = min(leng, breath)
	side = getmin * 2
	side = max(side, breath, leng)
	ans = side * side
	print(ans)


n = int(input())
ans = []
for i in range(n):
	xy = input().split()
	x = int(xy[0])
	y = int(xy[1])
	m = min(x, y)
	m *= 2
	m = max(m, max(x, y))
	ans.append(m ** 2)
for j in ans:
	print(j)


from math import sqrt, ceil
t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	if a == b:
		print(4 * a * a)
	elif a > b:
		if b + b >= a:
			print((b + b) ** 2)
		else:
			print(a ** 2)
	elif a < b:
		if a + a >= b:
			print((a + a) ** 2)
		else:
			print(b ** 2)


from math import *
from copy import *
from heapq import *
from string import *
from random import *
from bisect import *
from sys import stdin
from sys import maxsize
from operator import *
from itertools import *
from collections import Counter
from collections import defaultdict

def solve(l):
	n = len(l)
T = int(input())
for _ in range(T):
	(a, b) = list(map(int, stdin.readline().rstrip().split()))
	diff = 2 * min(a, b) - max(a, b)
	if diff <= 0:
		print(max(a, b) ** 2)
	else:
		ans = (max(a, b) + diff) ** 2
		print(ans)


t = eval(input())
side = 0
final = []
for e in range(t):
	nums = input()
	nums = [int(i) for i in nums.split()]
	if nums[0] > nums[1]:
		side = nums[1]
		side = side * 2
		if side < nums[0]:
			side = nums[0]
	if nums[0] < nums[1]:
		side = nums[0]
		side = side * 2
		if side < nums[1]:
			side = nums[1]
	if nums[0] == nums[1]:
		side = nums[0]
		side = side * 2
	side = side ** 2
	final.append(side)
for o in range(len(final)):
	print(final[o])


def Func(a, b):
	x = min(max(a, 2 * b), max(2 * a, b))
	print(x ** 2)
n = int(input())
for i in range(n):
	s = input().split(' ')
	a = int(s[0])
	b = int(s[1])
	Func(a, b)


t = int(input())
while t:
	t -= 1
	(a, b) = [int(i) for i in input().split(' ')]
	if a > b:
		b = 2 * b
	else:
		a = 2 * a
	sqaure = a if a > b else b
	print(sqaure ** 2)


t = int(input())
while t > 0:
	(a, b) = [int(i) for i in input().split()]
	area = 0
	(c, d) = (min(a, b), max(a, b))
	k = 2 * c
	if d <= k:
		area = k ** 2
	else:
		area = d ** 2
	print(area)
	t -= 1


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	s = max(a, b)
	if s ** 2 >= 2 * (a * b):
		print(s ** 2)
	elif a == b:
		print((a + b) * (a + b))
	else:
		t = 2 * min(a, b)
		print(t ** 2)


testy = int(input())
results = []
import math
for i in range(testy):
	wejscie = list(map(int, input().split()))
	minimalne = max(2 * min(wejscie), max(wejscie))
	results.append(minimalne ** 2)
for result in results:
	print(result)


t = int(input())
for i in range(t):
	line = input().split()
	a = int(line[0])
	b = int(line[1])
	c = 2 * min(a, b)
	if c > max(a, b):
		print(c * c)
	else:
		print(max(a, b) * max(a, b))


from sys import stdin as lector
input = lector.readlines()
n = int(input[0])
for i in range(1, n + 1):
	bh = input[i].split(' ')
	if min(int(bh[0]), int(bh[1])) * 2 >= max(int(bh[0]), int(bh[1])):
		print((min(int(bh[0]), int(bh[1])) * 2) ** 2)
	else:
		print(max(int(bh[0]), int(bh[1])) ** 2)


n = int(input())
(a, b) = ([], [])
i = 0
while i < n:
	tmp = input().split(' ')
	a.append(int(tmp[0]))
	b.append(int(tmp[1]))
	i += 1
i = 0
while i < n:
	print(max(2 * min(a[i], b[i]), max(a[i], b[i])) ** 2)
	i += 1


t = int(input())
ans = []
for i in range(t):
	(a, b) = [int(i) for i in input().split()]
	s = min(max(2 * a, b), max(2 * b, a))
	m = s ** 2
	ans.append(m)
for i in ans:
	print(i)


import math
t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	print(min(max(2 * a, b), max(a, 2 * b)) ** 2)


t = int(input())
while t > 0:
	(a, b) = list(map(int, input().split()))
	min_area = 0
	if a == b:
		min_area = 4 * a ** 2
	elif a > b:
		if 2 * b >= a:
			min_area = (2 * b) ** 2
		else:
			min_area = a ** 2
	elif 2 * a >= b:
		min_area = (2 * a) ** 2
	else:
		min_area = b ** 2
	print(min_area)
	t -= 1


t = int(input())
for i in range(0, t):
	ab = input().split()
	ab[0] = int(ab[0])
	ab[1] = int(ab[1])
	length = max(ab) if max(ab) > min(ab) * 2 else min(ab) * 2
	print(length ** 2)


t = int(input())
mini = 0
maxi = 0
for i in range(t):
	(a, b) = tuple(map(int, input().split()))
	if a < b:
		mini = a
		maxi = b
	else:
		mini = b
		maxi = a
	if 2 * mini < maxi:
		print(maxi ** 2)
	elif mini == maxi:
		print((2 * mini) ** 2)
	else:
		print((2 * mini) ** 2)


def find(a, b):
	y = min(a, b)
	x = max(a, b)
	if 2 * y > x:
		print((2 * y) ** 2)
	else:
		print(x * x)
n = int(input())
for i in range(0, n):
	(a, b) = list(map(int, input().split()))
	find(a, b)


import math
for i in range(int(input())):
	(a, b) = map(int, input().split())
	if 2 * min(a, b) >= max(a, b):
		print((2 * min(a, b)) ** 2)
	else:
		print(max(a, b) ** 2)


n = int(input())
for i in range(n):
	line = input().split(' ')
	a = int(line[0])
	b = int(line[1])
	q1 = max(2 * a, b)
	q2 = max(a + b, max(a, b))
	q3 = max(2 * b, a)
	res = min(q1, q2, q3)
	print(res * res)


INT_MAX = 10 ** 30 + 7
MOD = 10 ** 12 + 7

def INPUT():
	return list((int(i) for i in input().split()))

def LIST_1D_ARRAY(n):
	return [0 for _ in range(n)]

def LIST_2D_ARRAY(m, n):
	return [[0 for _ in range(n)] for _ in range(m)]
for _ in range(int(input())):
	(a, b) = INPUT()
	if a > b:
		(a, b) = (b, a)
	print(max(2 * a, b) ** 2)


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	x = min(a, b)
	if 4 * x * x >= a * b * 2:
		print(4 * x * x)
		continue
	y = max(a, b)
	print(y * y)


t = int(input(''))
for i in range(0, t):
	x = input('').split()
	x = [int(j) for j in x]
	a = x[0]
	b = x[1]
	if a <= b:
		test = [2 * a, b]
	else:
		test = [2 * b, a]
	test.sort()
	print(test[1] ** 2)


ipnl = lambda n: [int(input()) for _ in range(n)]
inp = lambda : int(input())
ip = lambda : [int(w) for w in input().split()]
for _ in range(inp()):
	(a, b) = ip()
	t = max(max(a, b), 2 * min(a, b))
	print(t * t)


from sys import stdin, stdout
input = lambda : stdin.readline().strip()
fast_print = stdout.write
from math import sqrt, floor
T = int(input())
for _ in range(T):
	(a, b) = map(int, input().split())
	ans = min(max(a, b, a + b) ** 2, max(2 * a, b) ** 2, max(2 * b, a) ** 2)
	print(ans)


n = int(input())
for i in range(n):
	(a, b) = [int(i) for i in input().split()]
	Min = min(a, b)
	Max = max(a, b)
	print(max(2 * Min, Max) ** 2)


t = int(input())
for _ in range(t):
	[a, b] = [int(x) for x in input().split()]
	side = min(a, b)
	maxi = max(a, b)
	if maxi > 2 * side:
		print(maxi * maxi)
	else:
		while maxi > 2 * side:
			side += 1
		print((side * 2) ** 2)


for t in range(int(input())):
	sides = [int(x) for x in input().split()]
	print(max(2 * min(sides), max(sides)) ** 2)


a = int(input())
for _ in range(a):
	b = input().split()
	c = int(b[0])
	d = int(b[1])
	e = min(c, d) * 2
	print(max(e, max(c, d)) ** 2)


import sys, heapq
from collections import *
from functools import lru_cache
sys.setrecursionlimit(10 ** 6)

def main():
	t = int(input())
	for _ in range(t):
		(a, b) = map(int, input().split(' '))
		if a > b:
			(a, b) = (b, a)
		d = max(b, 2 * a)
		d *= d
		print(d)
main()


for i in range(int(input())):
	(a, b) = map(int, input().split())
	x = min(2 * a, a + b, 2 * b)
	if x > a and x > b:
		print(x ** 2)
	else:
		y = max(a, b)
		print(y ** 2)


t = int(input())

def kvadrat_yuzi(a, b):
	(a, b) = (min(a, b), max(a, b))
	if 2 * a >= b:
		return 4 * a * a
	else:
		return b * b
natija = []
for i in range(t):
	(a, b) = input().split(' ')
	(a, b) = (int(a), int(b))
	natija.append(kvadrat_yuzi(a, b))
for i in range(t):
	print(natija[i])


from math import *
from collections import *
from operator import itemgetter
import bisect
i = lambda : input()
ii = lambda : int(input())
iia = lambda : list(map(int, input().split()))
isa = lambda : list(input().split())
I = lambda : list(map(int, input().split()))
chrIdx = lambda x: ord(x) - 96
idxChr = lambda x: chr(96 + x)
t = ii()
for _ in range(t):
	(a, b) = iia()
	m = min(a, b)
	ans = 0
	if 2 * m >= max(a, b):
		ans = (2 * m) ** 2
	else:
		ans = max(a, b) ** 2
	print(ans)


q = int(input())
for i in range(q):
	(a, b) = map(int, input().split())
	if a > b:
		(a, b) = (b, a)
	if 2 * a <= b:
		bok = b
	else:
		bok = 2 * a
	print(bok ** 2)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	print(pow(min(max(2 * a, b), max(2 * b, a)), 2))


for t in range(int(input())):
	(a, b) = map(int, input().split())
	a1 = min(a, b)
	b1 = max(a, b)
	print(max(2 * a1, b1) ** 2)


num1 = int(input())
for i in range(num1):
	(num1, k) = map(int, input().split())
	bred = min(num1, k)
	req = max(bred * 2, max(num1, k))
	print(req ** 2)


t = int(input())
for i in range(0, t):
	(a, b) = [int(x) for x in input().split()]
	m = min(a, b)
	n = max(a, b)
	if n > 2 * m:
		print(n ** 2)
	else:
		print(4 * m * m)


T = int(input())
for t in range(T):
	(a, b) = map(int, input().split())
	s = 2 * min(a, b)
	s = max(s, max(a, b))
	print(s * s)


for _ in range(int(input())):
	area1 = 0
	area2 = 0
	v = []
	(a, b) = map(int, input().split())
	if a > 2 * b:
		area1 = a * a
		v.append(area1)
	else:
		v.append(4 * b * b)
	if b > 2 * a:
		area2 = b ** 2
		v.append(area2)
	else:
		v.append(4 * a * a)
	print(min(v))


from fractions import Fraction
import sys
import bisect
import heapq
from math import *
from collections import Counter as counter
from itertools import combinations as comb
from itertools import permutations as permutate
from bisect import bisect_left as bl
from bisect import bisect_right as br
from bisect import bisect
mod = pow(10, 9) + 7

def inp():
	return sys.stdin.readline().strip()

def out(var):
	sys.stdout.write(str(var))

def lis():
	return list(map(int, inp().split()))

def stringlis():
	return list(map(str, inp().split()))

def sep():
	return map(int, inp().split())

def strsep():
	return map(str, inp().split())

def graph(vertex):
	return [[] for i in range(0, vertex + 1)]

def zerolist(n):
	return [0] * n

def nextline():
	out('\n')

def testcase(t):
	for p in range(t):
		solve()

def printlist(a):
	for p in range(0, len(a)):
		out(str(a[p]) + ' ')

def lcm(a, b):
	return a * b // gcd(a, b)

def solve():
	(a, b) = sep()
	bada = max(a, b)
	chota = min(a, b)
	if 2 * chota <= bada:
		print(bada ** 2)
	else:
		print((2 * chota) ** 2)
testcase(int(inp()))


t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	i1 = max(a, 2 * b)
	i2 = max(2 * a, b)
	print(min(i1 ** 2, i2 ** 2))


t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	m = min(a, b)
	M = max(a, b)
	t = 2 * m
	if t >= M:
		print(4 * m * m)
	else:
		print(M * M)


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	if a > b:
		(a, b) = (b, a)
	print(max(a * 2, b) ** 2)


t = int(input())
while t > 0:
	t -= 1
	(a, b) = map(int, input().split())
	temp_a = min(max(2 * a, b), max(a, 2 * b)) ** 2
	temp_b = max(a + b, a, b) ** 2
	print(min(temp_a, temp_b))


t = int(input())
while t > 0:
	t -= 1
	(a, b) = map(int, input().split())
	x = max(2 * b, a)
	y = max(2 * a, b)
	z = max(a + b, max(a, b))
	print(min(x, y, z) ** 2)


t = int(input())
count = 0
while count < t:
	count += 1
	ints = list(map(int, input().split(' ')))
	a = ints[0]
	b = ints[1]
	m = min(a, b)
	n = max(a, b)
	if 2 * m >= n:
		print(4 * m * m)
	elif n >= 2 * m:
		print(n * n)
	else:
		print(4 * n * n)


import sys

def solve():
	return None

def main():
	q = []
	for line in sys.stdin.readlines():
		q.append(line)
	for i in range(len(q)):
		q[i] = q[i].rstrip().split(' ')
		q[i] = [int(x) for x in q[i]]
	for i in range(1, len(q)):
		l = max(q[i])
		w = min(q[i])
		test = max(w * 2, l)
		print(test ** 2)
main()


import math, itertools, fractions, heapq, collections, bisect, sys, queue, copy
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return [int(x) for x in sys.stdin.readline().split()]

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def LS():
	return sys.stdin.readline().split()

def S():
	return input()

def main():
	n = I()
	ans = []
	for _ in range(n):
		(a, b) = LI()
		x = min(a, b)
		y = 2 * x
		z = max(y, max(a, b))
		ans.append(z * z)
	for x in ans:
		print(x)
main()


def main():
	n_num = int(input())
	for k in range(n_num):
		(a, b) = list(map(int, input().split(' ')))
		print(max(min(a, b) * 2, max(a, b)) ** 2)
main()


import sys
import collections

def set_debug(debug_mode=False):
	if debug_mode:
		fin = open('input.txt', 'r')
		sys.stdin = fin
t = int(input())
for ti in range(1, t + 1):
	(a, b) = list(map(int, input().split()))
	(a, b) = (min(a, b), max(a, b))
	l = max(2 * a, b)
	print(l * l)


inpt = int(input())
for i in range(inpt):
	s = [int(x) for x in list(input().split())]
	mn = 2 * min(s)
	if mn >= max(s):
		print(mn ** 2)
	else:
		print(max(s) ** 2)


import sys
t = int(sys.stdin.readline().strip())
for _ in range(t):
	(a, b) = map(int, sys.stdin.readline().strip().split())
	s = min(max(a + a, b + b), max(2 * a, b), max(2 * b, a))
	print(s * s)


t = int(input())
res = []
for i in range(t):
	inp = input().split()
	a = int(inp[0])
	b = int(inp[1])
	if a < b:
		sq = max(b, a + a)
	else:
		sq = max(a, b + b)
	res.append(sq * sq)
for i in res:
	print(i)


def main():
	(a, b) = map(int, input().split())
	if a > b:
		out = max(2 * b, a)
	else:
		out = max(2 * a, b)
	print(out ** 2)
for _ in range(int(input())):
	main()


t = int(input())
while t != 0:
	(a, b) = map(int, input().strip().split())
	if a == b:
		print(int(4 * a * a))
	else:
		if a > b:
			small = b
			big = a
		else:
			small = a
			big = b
		if small * 2 >= big:
			side = small * 2
			print(int(side * side))
		else:
			side = big
			print(int(side * side))
	t -= 1


import sys
import math
import bisect
from sys import stdin, stdout
from math import gcd, floor, sqrt, log
from collections import defaultdict as dd
from bisect import bisect_left as bl, bisect_right as br
sys.setrecursionlimit(100000000)
ii = lambda : int(input())
si = lambda : input()
jn = lambda x, l: x.join(map(str, l))
sl = lambda : list(map(str, input().strip()))
mi = lambda : map(int, input().split())
mif = lambda : map(float, input().split())
lii = lambda : list(map(int, input().split()))
ceil = lambda x: int(x) if x == int(x) else int(x) + 1
ceildiv = lambda x, d: x // d if x % d == 0 else x // d + 1
flush = lambda : stdout.flush()
stdstr = lambda : stdin.readline()
stdint = lambda : int(stdin.readline())
stdpr = lambda x: stdout.write(str(x))
mod = 1000000007
for _ in range(ii()):
	(a, b) = mi()
	side = min(max(2 * a, b), max(a, 2 * b))
	print(pow(side, 2))


import sys
input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())
cases = inp()
while cases > 0:
	cases -= 1
	ip = inlt()
	w = ip[0]
	h = ip[1]
	ans = min(max(w + h, w), max(w + w, h), max(w, h + h))
	print(ans * ans)


t = int(input())
while t != 0:
	(a, b) = map(int, input().split())
	if a < b:
		temp = ((a * 2) ** 2) ** 0.5
		if temp > b:
			print((a * 2) ** 2)
		else:
			print(b ** 2)
	elif b < a:
		temp = ((b * 2) ** 2) ** 0.5
		if temp > a:
			print((b * 2) ** 2)
		else:
			print(a ** 2)
	else:
		print((a * 2) ** 2)
	t -= 1


import math
q = int(input())
while q:
	(a, b) = map(int, input().split())
	if b > a:
		(a, b) = (b, a)
	if a > 2 * b:
		side = a
	else:
		side = 2 * b
	print(side ** 2)
	q -= 1


T = int(input())
for t_itr in range(T):
	(A, B) = list(map(int, input().rstrip().split()))
	if A < B:
		(A, B) = (B, A)
	if 2 * B < A:
		r = A
	else:
		r = 2 * B
	print(r * r)


import math

def fun(a, b):
	c = 2 * b - a
	if c > 0:
		a = a + c
	return a * a
n = int(input())
for j in range(1, n + 1):
	(a, b) = map(int, input().split(' '))
	if a > b or a == b:
		print(fun(a, b))
	else:
		print(fun(b, a))


t = int(input())
while t:
	t -= 1
	(a, b) = map(int, input().split())
	req = min(a, b)
	req = req * 2
	if req < max(a, b):
		k = max(a, b)
		print(k ** 2)
	else:
		print(req * req)


for _ in range(int(input())):
	s = list(map(int, input().split()))
	a = min(s)
	b = max(s)
	pot = []
	x = max(2 * a, b)
	pot.append(x * x)
	pot.append((a + b) ** 2)
	print(min(pot))


n = int(input())
x = [list(map(int, input().split())) for _ in range(n)]
for ad in x:
	if min(ad) * 2 > max(ad):
		print((min(ad) * 2) ** 2)
	else:
		print(max(ad) ** 2)


t = int(input())
while t > 0:
	(a, b) = map(int, input().split())
	t1 = a * 2
	t2 = b * 2
	ans = min(max(a, t2), max(b, t1))
	print(ans * ans)
	t -= 1


t = int(input())
for test in range(t):
	a = input()
	a = a.strip()
	a = a.split(' ')
	a = list(map(int, a))
	x = min(a)
	y = max(a)
	l = x * 2
	if l >= y:
		print(l * l)
	if l < y:
		print(y * y)


t = int(input())
for i in range(1, t + 1):
	n = input()
	list = n.split()
	a = int(list[0])
	b = int(list[1])
	x = abs(a - b)
	y = max(a, b)
	z = min(a, b)
	if a == b:
		q = int(a + a)
		print(q * q)
		continue
	z = z * 2
	e = max(z, y)
	print(e * e)


num = int(input())
arr = []
for i in range(num):
	arr.append(input())
arr = [[int(i) for i in c.split(' ')] for c in arr]
for i in range(num):
	out = min(arr[i][0] * 2, arr[i][1] * 2) ** 2
	if arr[i][0] * 2 < arr[i][1] or arr[i][1] * 2 < arr[i][0]:
		out = max(arr[i][0], arr[i][1]) ** 2
	print(out)


import math
t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	s = a * b * 2
	if a == b:
		print(s * 2)
		continue
	ans = math.ceil(s ** 0.5) ** 2
	while ans ** 0.5 < max(a, b) or ans ** 0.5 < min(a, b) * 2:
		ans = (ans ** 0.5 + 1) ** 2
	print(int(ans))


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	if a == b:
		print((2 * a) ** 2)
	else:
		c = a - b
		if c > 0 and 2 * b >= a:
			print((2 * b) ** 2)
		elif c < 0 and 2 * a >= b:
			print((2 * a) ** 2)
		else:
			print(max(a, b) ** 2)


t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	if a >= b:
		x = 2 * b
		if x < a:
			x = a
	else:
		x = 2 * a
		if x < b:
			x = b
	P = x * x
	print(P)


t = int(input())
for i in range(t):
	(a, b) = list(map(int, input().split()))
	x = a + b
	area1 = x * x
	y = min(a, b)
	f = max(a, b)
	z = max(2 * y, f)
	area2 = z * z
	ans = min(area1, area2)
	print(ans)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	if a > b:
		ma = a
	else:
		ma = b
	k = min(a, b)
	if 2 * k < ma:
		print(ma ** 2)
	elif 2 * k >= ma:
		print((2 * k) ** 2)
	else:
		print((2 * ma) ** 2)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	if a == b:
		print(4 * a * a)
	else:
		k = min(a, b)
		if 2 * k == max(a, b):
			print(max(a, b) * max(a, b))
		elif 2 * k + 1 == max(a, b):
			k = 2 * k + 1
			print(k * k)
		elif 2 * k + 1 < max(a, b):
			print(max(a, b) * max(a, b))
		else:
			k = 2 * k
			print(k * k)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	if a >= b:
		b = 2 * b
		c = max(a, b)
		print(c * c)
	else:
		a = 2 * a
		c = max(a, b)
		print(c * c)


def solve(a, b):
	s = min(a, b)
	p = max(a, b)
	return max(2 * s, p) ** 2
t = int(input())
for i in range(t):
	(a, b) = tuple(map(int, input().split()))
	print(solve(a, b))


import sys
input = sys.stdin.readline
t = int(input())
for tests in range(t):
	(a, b) = map(int, input().split())
	MIN = min(a, b)
	MAX = max(a, b)
	print(max(MIN * 2, MAX) ** 2)


t = int(input())
import math

def nextPerfectSquare(N):
	nextN = math.floor(math.sqrt(N)) + 1
	return nextN * nextN
while t:
	(a, b) = map(int, input().split())
	prod = 2 * a * b
	print(max(2 * min(a, b), max(a, b)) ** 2)
	t -= 1


cases = int(input())
lista = []
for case in range(cases):
	(a, b) = map(int, input().split())
	lista.append((a, b))
for (a, b) in lista:
	if a >= b:
		if a >= 2 * b:
			print(a * a)
		else:
			print(4 * b * b)
	elif b >= 2 * a:
		print(b * b)
	else:
		print(4 * a * a)


t = int(input())
while t > 0:
	(a, b) = map(int, input().split())
	s = min(a, b)
	l = max(a, b)
	print(max(l, 2 * s) ** 2)
	t -= 1


t = int(input())
for _ in range(t):
	(a, b) = map(int, input().rstrip().split())
	x = max(a, b)
	n = min(a, b)
	if a == b:
		print(4 * a * a)
		continue
	if x <= 2 * n:
		print(4 * n * n)
	else:
		print(x * x)


num = int(input())
for _ in range(num):
	prob = input().split()
	prob = [int(x) for x in prob]
	prob.sort()
	if prob[1] > 2 * prob[0]:
		print(prob[1] ** 2)
	else:
		print((prob[0] * 2) ** 2)


n = int(input())
while n:
	case = input()
	(l, l2) = case.split(' ')
	l = int(l)
	l2 = int(l2)
	full_width = 0
	if l < l2:
		full_width = l * 2
		result = max(full_width, l2)
		result *= result
	else:
		full_width = l2 * 2
		result = max(full_width, l)
		result *= result
	print(result)
	n -= 1


st = int(input())
rez = []
for i in range(st):
	ainb = input()
	for i in range(len(ainb)):
		if ainb[i] == ' ':
			a = int(ainb[:i])
			b = int(ainb[i + 1:])
	if a == b:
		rez.append(4 * a * b)
	elif a < b:
		a *= 2
		if a < b:
			rez.append(b ** 2)
		else:
			rez.append(a ** 2)
	elif a > b:
		b *= 2
		if a < b:
			rez.append(b ** 2)
		else:
			rez.append(a ** 2)
for x in rez:
	print(x)


for i in range(int(input())):
	(a, b) = [int(i) for i in input().split()]
	c = min([a, b])
	if c == a:
		p = b
	else:
		p = a
	print(max([c * 2, p]) ** 2)


t = int(input())
while t != 0:
	(a, b) = map(int, input().split())
	min_side = min(a, b)
	max_side = max(a, b)
	ans = 0
	if 2 * min_side >= max_side:
		ans = (2 * min_side) ** 2
	else:
		ans = max_side ** 2
	print(ans)
	t -= 1


from collections import Counter, defaultdict, deque
from math import *
import sys
input = sys.stdin.readline

def solve():
	(a, b) = [int(x) for x in input().split()]
	m = 2 * min(a, b)
	m = max(m, a, b)
	print(m * m)
tt = int(input())
for test in range(tt):
	solve()


import sys
import math
read = sys.stdin.buffer.read
input = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
t = int(input())
for case in range(t):
	(a, b) = map(int, input().split())
	if max(a, b) >= 2 * min(a, b):
		print(max(a, b) ** 2)
	else:
		print(min(a, b) ** 2 * 4)


n = int(input())
for i in range(n):
	x = [int(y) for y in input().split()]
	print(max(max(x), 2 * min(x)) ** 2)


for _ in range(int(input())):
	s = input().split()
	(l, w) = (max(int(s[0]), int(s[1])), min(int(s[0]), int(s[1])))
	r = w * 2 if w * 2 > l else l
	print(r * r)


I = input
for _ in range(int(I())):
	(a, b) = map(int, I().split())
	ma = max(a, b)
	mi = min(a, b)
	if mi + mi >= ma:
		t1 = mi + mi
	else:
		t1 = ma
	print(t1 * t1)


class Minimal_square(object):

	def minimum(self):
		self.n = int(input())
		for i in range(self.n):
			(self.a, self.b) = map(int, input().split())
			self.side = min(max(self.a * 2, self.b), max(self.a, self.b * 2))
			print(self.side * self.side)
cc = Minimal_square()
cc.minimum()


import sys
I = sys.stdin.readline
ans = ''
for _ in range(int(I())):
	(a, b) = map(int, I().split())
	(a, b) = (max(a, b), min(a, b))
	if 2 * b >= a:
		ans += str((2 * b) ** 2) + '\n'
	else:
		ans += str(a ** 2) + '\n'
print(ans)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	if a >= b:
		(x, y) = (a, b)
	else:
		(x, y) = (b, a)
	if 2 * y > x:
		print(4 * y * y)
	else:
		print(x * x)


for _ in range(int(input())):
	(n, m) = map(int, input().split())
	if min(n, m) * 2 >= max(n, m):
		print((min(n, m) * 2) ** 2)
	else:
		print(max(n, m) ** 2)


t = int(input())
for i in range(t):
	(a, b) = input().split()
	a = int(a)
	b = int(b)
	mi = min(a, b)
	ma = max(a, b)
	if 2 * mi - ma >= 0:
		print((2 * mi) ** 2)
	else:
		print(ma ** 2)


t = int(input())
z = t
ans = list()
while z > 0:
	str1 = input()
	(n, m) = str1.split()
	n = int(n)
	m = int(m)
	if n > m:
		if 2 * m > n:
			ans.append(2 * m * 2 * m)
		else:
			ans.append(n * n)
	elif 2 * n > m:
		ans.append(2 * n * 2 * n)
	else:
		ans.append(m * m)
	z = z - 1
for q in ans:
	print(q)


import math

def main():
	for _ in range(int(input())):
		(a, b) = list(map(int, input().split()))
		(a, b) = (min(a, b), max(a, b))
		print((2 * a) ** 2 if a == b else (2 * a) ** 2 if 2 * a >= b else b ** 2)
main()


n = int(input())
for i in range(n):
	(l, b) = map(int, input().rstrip().split())
	x = min(l, b)
	y = max(2 * x, l + b - x)
	print(y ** 2)


def solve1():
	(a, b) = map(int, input().split())
	s = min(max(2 * a, b), max(2 * b, a))
	print(s ** 2)
for _ in range(int(input())):
	solve1()


import sys
input = sys.stdin.readline
from math import *

def swaparr(arr, a, b):
	temp = arr[a]
	arr[a] = arr[b]
	arr[b] = temp

def gcd(a, b):
	if a == 0:
		return b
	return gcd(b % a, a)

def nCr(n, k):
	if k > n - k:
		k = n - k
	res = 1
	for i in range(k):
		res = res * (n - i)
		res = res / (i + 1)
	return res

def upper_bound(a, x, lo=0):
	hi = len(a)
	while lo < hi:
		mid = (lo + hi) // 2
		if a[mid] < x:
			lo = mid + 1
		else:
			hi = mid
	return lo

def primefs(n):
	primes = {}
	while n % 2 == 0:
		primes[2] = primes.get(2, 0) + 1
		n = n // 2
	for i in range(3, int(n ** 0.5) + 2, 2):
		while n % i == 0:
			primes[i] = primes.get(i, 0) + 1
			n = n // i
	if n > 2:
		primes[n] = primes.get(n, 0) + 1
	return primes

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def swap(a, b):
	temp = a
	a = b
	b = temp
	return (a, b)

def find(x, link):
	p = x
	while p != link[p]:
		p = link[p]
	while x != p:
		nex = link[x]
		link[x] = p
		x = nex
	return p

def union(x, y, link, size):
	x = find(x, link)
	y = find(y, link)
	if size[x] < size[y]:
		(x, y) = swap(x, y)
	if x != y:
		size[x] += size[y]
		link[y] = x

def sieve(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime
MAXN = int(1000000.0 + 5)

def spf_sieve():
	spf[1] = 1
	for i in range(2, MAXN):
		spf[i] = i
	for i in range(4, MAXN, 2):
		spf[i] = 2
	for i in range(3, ceil(MAXN ** 0.5), 2):
		if spf[i] == i:
			for j in range(i * i, MAXN, i):
				if spf[j] == j:
					spf[j] = i

def factoriazation(x):
	ret = {}
	while x != 1:
		ret[spf[x]] = ret.get(spf[x], 0) + 1
		x = x // spf[x]
	return ret

def int_array():
	return list(map(int, input().strip().split()))

def str_array():
	return input().strip().split()
MOD = int(1000000000.0) + 7
CMOD = 998244353
INF = float('inf')
NINF = -float('inf')
for _ in range(int(input())):
	(a, b) = int_array()
	x = min(a, b)
	y = max(a, b)
	k = max(2 * x, y)
	ans = k ** 2
	print(ans)


t = int(input())
for i in range(t):
	(a, b) = [int(a) for a in input().split()]
	s = min(a, b)
	s = s * 2
	j = max(a, b)
	if s >= j:
		print(s * s)
	else:
		print(j * j)


import math
t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	if a <= b:
		a *= 2
		if a >= b:
			print(a * a)
		else:
			print(b * b)
	else:
		b *= 2
		if b >= a:
			print(b * b)
		else:
			print(a * a)


for _ in range(int(input())):
	(a, b) = sorted(map(int, input().split()))
	(sa, sb) = ((2 * a) ** 2, b ** 2)
	sa -= 2 * a * b
	sb -= 2 * a * b
	if 0 <= sa < sb or sb < 0:
		print((2 * a) ** 2)
	else:
		print(b ** 2)


def f(a, b):
	if a > b:
		(a, b) = (b, a)
	s = 2 * a
	if s < b:
		s = b
	return s * s
t = int(input())
for i in range(t):
	[a, b] = input().split(' ')
	print(f(int(a), int(b)))


for s in [*open(0)][1:]:
	(a, b) = map(int, s.split())
	print(max(max(a, b), 2 * min(a, b)) ** 2)


t = int(input())
for t in range(0, t):
	(a, b) = [int(x) for x in input().split()]
	if a > b:
		temp = a
		a = b
		b = temp
	if a * 2 > b:
		x = 2 * a
	else:
		x = b
	ar = x * x
	print(ar)


n = int(input())
for _ in range(n):
	(a, b) = map(int, input().split())
	if a != b:
		m = min(a, b)
		ma = max(a, b)
		s = m * 2 * (m * 2)
		p = ma * ma
		if s >= p:
			print(s)
		else:
			print(p)
	else:
		print(a * 2 * (a * 2))


def nod(a, b):
	while a != b:
		(a, b) = (max(a, b), min(a, b))
		if a % b == 0:
			a -= (a // b - 1) * b
		else:
			a -= a // b * b
	return a
for t in range(int(input())):
	(a, b) = sorted([int(x) for x in input().split()])
	print(max(b, 2 * a) ** 2)


import math, sys, bisect
from collections import defaultdict, Counter, deque

def input():
	return sys.stdin.readline().strip()
ilele = lambda : map(int, input().split())
alele = lambda : list(map(int, input().split()))

def Y(c):
	print(['NO', 'YES'][c])

def y(c):
	print(['no', 'yes'][c])
for _ in range(int(input())):
	(a, b) = ilele()
	c = max(2 * a, b)
	d = max(a, 2 * b)
	e = c ** 2
	f = d ** 2
	print(min(e, f))


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split(' '))
	(maxi, mini) = (max(a, b), min(a, b))
	if mini * 2 >= maxi:
		print((mini * 2) ** 2)
	else:
		print(maxi * maxi)


t = int(input())
for _ in range(t):
	(m, n) = map(int, input().split())
	x = min(m, n) * 2
	y = max(m, n)
	if x >= y:
		print(x * x)
	else:
		print(y * y)


def solve():
	(a, b) = map(int, input().split())
	if a >= b:
		(a, b) = (b, a)
	s = max(2 * a, b)
	print(s ** 2)
	return

def main():
	t = int(input())
	for i in range(t):
		solve()
	return
main()


test = int(input())
while test > 0:
	(l, b) = map(int, input().split(' '))
	area = l * b
	m = min(l, b)
	ma = max(l, b)
	if (2 * m) ** 2 >= 2 * area:
		print((2 * m) ** 2)
	else:
		print(ma ** 2)
	test -= 1


def main():
	t = int(input())
	for __ in range(t):
		(a, b) = map(int, input().split())
		print(min(max(2 * a, b), max(a, 2 * b)) ** 2)
main()


ans = []
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	(a, b) = (min(a, b), max(a, b))
	ans.append(min(a + b, max(b, a * 2)) ** 2)
print('\n'.join(map(str, ans)))


t = int(input())
for i in range(t):
	ab = list(map(int, input().split()))
	a = ab[0]
	b = ab[1]
	if abs(a - b) == b or abs(a - b) == a:
		min_area = 2 * a * b
	elif 2 * min(a, b) > max(a, b):
		min_area = 2 * min(a, b) * (2 * min(a, b))
	else:
		min_area = max(a, b) ** 2
	print(min_area)


t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	c = min(a, b)
	d = a if c == b else b
	cc = 1000
	if a * a >= a * b * 2:
		cc = a * a
	elif b * b >= a * b * 2:
		cc = b * b
	elif c + c >= d:
		cc = (c + c) * (c + c)
	else:
		cc = (d + d) * (d + d)
	print(cc)


from __future__ import division, print_function
import os, sys
import math
import collections
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip

def ii():
	return int(input())

def si():
	return input()

def mi():
	return map(int, input().strip().split(' '))

def msi():
	return map(str, input().strip().split(' '))

def li():
	return list(mi())

def dmain():
	sys.setrecursionlimit(100000000)
	threading.stack_size(40960000)
	thread = threading.Thread(target=main)
	thread.start()
abc = 'abcdefghijklmnopqrstuvwxyz'
abd = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}
mod = 1000000007
inf = float('inf')
vow = ['a', 'e', 'i', 'o', 'u']
(dx, dy) = ([-1, 1, 0, 0], [0, 0, 1, -1])

def getKey(item):
	return item[1]

def sort2(l):
	return sorted(l, key=getKey, reverse=True)

def d2(n, m, num):
	return [[num for x in range(m)] for y in range(n)]

def isPowerOfTwo(x):
	return x and (not x & x - 1)

def decimalToBinary(n):
	return bin(n).replace('0b', '')

def ntl(n):
	return [int(i) for i in str(n)]

def ncr(n, r):
	return factorial(n) // (factorial(r) * factorial(n - r))

def binary_search(arr, low, high, x):
	if high >= low:
		mid = (high + low) // 2
		if arr[mid] == x:
			return mid
		elif arr[mid] > x:
			return binary_search(arr, low, mid - 1, x)
		else:
			return binary_search(arr, mid + 1, high, x)
	else:
		return -1

def ceil(x, y):
	if x % y == 0:
		return x // y
	else:
		return x // y + 1

def powerMod(x, y, p):
	res = 1
	x %= p
	while y > 0:
		if y & 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def read():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

def padded_bin_with_complement(x):
	if x < 0:
		return bin(2 ** 16 - abs(x))[2:].zfill(16)
	else:
		return bin(x)[2:].zfill(16)

def binaryToDecimal(binary):
	binary1 = binary
	(decimal, i, n) = (0, 0, 0)
	while binary != 0:
		dec = binary % 10
		decimal = decimal + dec * pow(2, i)
		binary = binary // 10
		i += 1
	print(decimal)

def CountFrequency(arr):
	return collections.Counter(arr)

def pos(a):
	b = [0] * len(a)
	c = sorted(a)
	for i in range(len(a)):
		for j in range(len(a)):
			if c[j] == a[i]:
				b[i] = j
				break
	return b

def main():
	for _ in range(ii()):
		(n, k) = mi()
		j = 2 * min(n, k)
		if j > max(n, k):
			print(j ** 2)
		else:
			print(max(n, k) ** 2)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


t = int(input())
while t:
	t -= 1
	data = list(map(int, input().split()))
	_max = max(data)
	_min = min(data)
	if _max == _min or _min * 2 >= _max:
		print((2 * _min) ** 2)
	else:
		print(_max ** 2)


def f():
	(a, b) = map(int, input().split())
	print(max(2 * min(a, b), max(a, b)) ** 2)
t = input()
for i in range(int(t)):
	f()


n = int(input())
for i in range(n):
	line = input().split(' ')
	a = int(line[0])
	b = int(line[1])
	m = min(a, b)
	mx = max(a, b)
	if 2 * m > mx:
		print(4 * m * m)
	else:
		print(mx * mx)


t = int(input())
for i in range(t):
	arr = list(map(int, input().split()))
	a = arr[0]
	b = arr[1]
	if a > b and 2 * b >= a:
		print(4 * b * b)
	elif b > a and 2 * a >= b:
		print(4 * a * a)
	elif a > b:
		print(a * a)
	elif b > a:
		print(b * b)
	else:
		print(4 * a * a)


import math
t = int(input())
for i in range(t):
	(a, b) = list(map(int, input().split()))
	if a == b:
		print((a * 2) ** 2)
	elif a == 1 or b == 1:
		if a == 1:
			print(b ** 2)
		elif b == 1:
			print(a ** 2)
	else:
		m1 = min(a, b)
		m2 = max(a, b)
		if m1 * 2 >= m2:
			print((m1 * 2) ** 2)
		else:
			print(m2 * m2)


from math import ceil, sqrt
t = int(input())
for i in range(t):
	(a, b) = [int(x) for x in input().split()]
	print(min(max(2 * a, b), max(2 * b, a)) ** 2)


t = int(input())
res = []
for i in range(t):
	arr = [int(x) for x in input().split()]
	(a, b) = (arr[0], arr[1])
	(c, d) = (min(a, b), max(a, b))
	if c * 2 >= d:
		res.append(c * c * 4)
	elif c * 2 < d:
		res.append(d * d)
	else:
		res.append(c * c * 4)
for i in range(len(res)):
	print(res[i])


import math as mt
import sys, string
input = sys.stdin.readline
L = lambda : list(map(int, input().split()))
Ls = lambda : list(input().split())
M = lambda : map(int, input().split())
I = lambda : int(input())
n = I()
for _ in range(n):
	(a, b) = M()
	p = max(a, b)
	k = min(a, b)
	print(max(p, 2 * k) ** 2)


from sys import stdin
input = stdin.readline
t = int(input().strip())
for _ in range(t):
	(a, b) = list(map(int, input().split()))
	if b > a:
		(b, a) = (a, b)
	if 2 * b > a:
		print((2 * b) ** 2)
	else:
		print(a ** 2)


t = int(input())
for test in range(1, t + 1):
	(a1, b1) = map(int, input().rstrip().split())
	a = max(a1, b1)
	b = min(a1, b1)
	if 2 * b > a:
		print(2 * b * 2 * b)
	else:
		print(a * a)


t = int(input())
for _ in range(t):
	(a, b) = list(map(int, input().split()))
	if b <= a and 2 * b >= a:
		print(pow(2 * b, 2))
	elif a <= b and 2 * a >= b:
		print(pow(2 * a, 2))
	else:
		check = max([a, b])
		print(pow(check, 2))


N = int(input())
R = []
for I in range(N):
	s = input().split()
	s = list(map(int, s))
	A = (min(s) * 2) ** 2
	if s[1] * s[0] * 2 <= A:
		R.append(A)
	else:
		R.append(max(s) ** 2)
for j in R:
	print(j)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	k = min(a, b)
	j = max(a, b)
	if j > 2 * k:
		print(j ** 2)
	else:
		print((2 * k) ** 2)


import math
tc = int(input())
for _ in range(tc):
	(a, b) = arr = list(map(int, input().split()))
	min_ = min(a, b)
	max_ = max(a, b)
	if max_ > 2 * min_:
		print(int(max_ * max_))
	else:
		print(int(math.pow(min_ * 2, 2)))


def main():
	T = int(input())
	for i in range(1, T + 1):
		(a, b) = [int(_) for _ in input().split(' ')]
		n = min(a, b)
		m = max(a, b)
		if 2 * n < m:
			print(m ** 2)
		else:
			print(4 * n * n)
main()


from collections import defaultdict
from collections import OrderedDict
from collections import deque
import bisect
import math
import heapq
import sys
import io, os
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
for ii in range(int(input())):
	(a, b) = map(int, input().split())
	s = min(a, b) * 2
	n = max(s, max(a, b))
	print(n * n)


numofsq = int(input())
testcases = []
for i in range(0, numofsq):
	userinput = [int(x) for x in input().split()]
	testcases.append(userinput)
for i in range(0, numofsq):
	area = max([(min(testcases[i]) * 2) ** 2, max(testcases[i]) ** 2])
	print(area)


t = int(input())
while t > 0:
	t -= 1
	(ai, bi) = map(int, input().split())
	mnv = min(ai, bi)
	mxv = max(ai, bi)
	print(max(2 * mnv, mxv) ** 2)


from collections import defaultdict as dd
from collections import deque
import bisect
import heapq

def ri():
	return int(input())

def rl():
	return list(map(int, input().split()))

def solve():
	(a, b) = rl()
	ss = min(a, b) * 2
	l = max(a, b)
	print(max(ss, l) ** 2)
mode = 'T'
if mode == 'T':
	t = ri()
	for i in range(t):
		solve()
else:
	solve()


from collections import Counter
from collections import defaultdict
from collections import deque
import math
import heapq
import sys
input = sys.stdin.readline
import bisect
rs = lambda : input().strip()
ri = lambda : int(input())
rl = lambda : list(map(int, input().split()))
rls = lambda : list(map(str, input().split()))
t = int(input())
for _ in range(0, t):
	(a, b) = list(map(int, input().split()))
	mn = min(a, b)
	mx = max(a, b)
	s1 = (2 * mn) ** 2
	s2 = mx ** 2
	if s1 > s2:
		print(s1)
	else:
		print(s2)


t = int(input())
for test in range(t):
	(a, b) = [int(x) for x in input().split()]
	d = max(a, b)
	c = min(a, b)
	if c * 2 > d:
		print(c * 2 * (c * 2))
	else:
		print(d * d)


def driver():
	t = int(input())
	for i in range(t):
		solution()

def solution():
	(a, b) = [int(x) for x in input().split()]
	if a < b:
		(a, b) = (b, a)
	if b * 2 >= a:
		print((b * 2) ** 2)
	else:
		print(a ** 2)
driver()


t = int(input())
for _ in range(t):
	(a, b) = input().split(' ')
	sides = [int(a), int(b)]
	side = sides.pop(sides.index(min(sides))) * 2
	if side < sides[0]:
		print(sides[0] ** 2)
	else:
		print(side ** 2)


import sys
from math import sqrt, floor, factorial, gcd
from collections import deque, Counter, defaultdict
inp = sys.stdin.readline
read = lambda : list(map(int, inp().strip().split()))

def a():
	ans = ''
	for _ in range(int(inp())):
		(a, b) = read()
		i = 1
		while i < max(max(a, b), min(a, b) * 2) or i ** 2 < a * b * 2:
			i += 1
		ans += str(i ** 2) + '\n'
	print(ans)
a()


from sys import stdin, stdout, setrecursionlimit
from math import ceil
for _ in range(int(input())):
	(n, m) = map(int, input().split())
	print(max(min(n, m) * 2, max(n, m)) ** 2)


def find_area(x):
	(a, b) = x.split()
	(a, b) = (int(a), int(b))
	if a > b:
		min = b
		max = a
	else:
		min = a
		max = b
	min2 = min * 2
	if min2 > max:
		return min2 ** 2
	else:
		return max ** 2
inputList = []
outputList = []
n = int(input())
for i in range(n):
	inputList.append(input())
for x in inputList:
	outputList.append(find_area(x))
for x in outputList:
	print(str(x))


import sys
input = sys.stdin.readline

def solve(a, b):
	side = min(max(a, b * 2), max(a * 2, b))
	return side * side
T = int(input())
for i in range(T):
	(a, b) = map(int, input().split())
	print(solve(a, b))


t = int(input())
for _ in range(t):
	(a, b) = list(map(int, input().split()))
	x = min(a, b)
	y = max(a, b)
	if 2 * x >= y:
		print(4 * x * x)
	else:
		print(y * y)


t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	x = 2 * min(a, b)
	y = max(a, b)
	print(max(x ** 2, y ** 2))


for _ in range(int(input())):
	(a, b) = list(map(int, input().split()))
	num1 = max(2 * a, b) ** 2
	num2 = max(2 * b, a) ** 2
	print(min(num1, num2))


t = int(input())
while t > 0:
	(a, b) = map(int, input().split(' '))
	if min(a, b) * 2 >= max(a, b):
		print((min(a, b) * 2) ** 2)
	else:
		print(max(a, b) ** 2)
	t -= 1


n = int(input())
for i in range(n):
	(a, b) = map(int, input().split())
	k = max(a, b)
	r = min(a, b)
	k = max(2 * r, k)
	while k * k < 2 * a * b:
		k = k + 1
	print(k * k)


t = int(input())
for _ in range(t):
	(a, b) = list(map(int, input().split()))
	max_side = max(a, b)
	min_side = min(a, b)
	if 2 * min_side < max_side:
		print(max_side ** 2)
	else:
		print(4 * min_side ** 2)


def solve():
	arr = list(map(int, input().split()))
	a = arr[0]
	b = arr[1]
	if a == b or (a < b and 2 * a >= b):
		print((2 * a) ** 2)
	elif a < b and 2 * a < b:
		print(b ** 2)
	elif a > b and 2 * b >= a:
		print((2 * b) ** 2)
	elif a > b and 2 * b < a:
		print(a ** 2)
T = int(input())
while T:
	solve()
	T = T - 1


for _ in range(int(input())):
	(l, b) = map(int, input().strip().split())
	min_val = min(l, b)
	max_val = max(l, b)
	if l <= max_val // 2 or b <= max_val // 2:
		print(max_val ** 2)
	elif min_val * 2 > l or min_val > b:
		print((2 * min_val) ** 2)


a = int(input())
for i in range(a):
	(x, y) = (int(v) for v in input().split())
	z = max(2 * min(x, y), max(x, y))
	print(z ** 2)


n = int(input())
ans = 0
for _ in range(n):
	(a, b) = sorted(map(int, input().split()))
	if a == b:
		ans = (a * 2) ** 2
	elif a * 2 >= b:
		ans = (a * 2) ** 2
	elif a * 2 < b:
		ans = b ** 2
	print(ans)


def list_input():
	return list(map(int, input().split()))

def multiple_input():
	return map(int, input().split())
for _ in range(int(input())):
	(a, b) = multiple_input()
	(a, b) = (min(a, b), max(a, b))
	if a == b:
		ans = (2 * a) ** 2
	elif a <= b / 2:
		ans = b ** 2
	else:
		temp = 2 * a - b
		ans = (b + temp) ** 2
	print(ans)


t = int(input())
lst = []

def m(a, b):
	if b * 2 > a:
		f = (b * 2) ** 2
	else:
		f = a ** 2
	return f
for i in range(t):
	(xx, yy) = input().split()
	x = int(xx)
	y = int(yy)
	if x > y:
		k = m(x, y)
	else:
		k = m(y, x)
	lst.append(k)
for i in lst:
	print(int(i))


from sys import stdin

def r():
	return stdin.readline().strip()

def r_t(tp):
	return map(tp, r().strip().split())

def r_a(tp):
	return list(r_t(tp))

def main():
	cases = int(r())
	for case in range(cases):
		(a, b) = r_t(int)
		print(max(max(a, b), min(a, b) * 2) ** 2)
main()


for i in range(int(input())):
	(a, b) = [int(x) for x in input().split()]
	ans = min(max(a, 2 * b), max(2 * a, b))
	print(ans * ans)


t = int(input())
output = []
for _ in range(t):
	(a, b) = list(map(int, input().split(' ')))
	if min((a, b)) * 2 > max((a, b)):
		output.append((min((a, b)) * 2) ** 2)
	else:
		output.append(max((a, b)) ** 2)
for i in output:
	print(i)


N = int(input())

def ans(a, b):
	hako = max(a, 2 * b) ** 2
	hako = min(hako, max(b, a * 2) ** 2)
	return hako
kari = []
for i in range(N):
	(A, B) = map(int, input().split())
	kari.append(ans(A, B))
for i in range(len(kari)):
	print(kari[i])


t = int(input())

def func(a, b):
	s = min(max(2 * a, b), max(2 * b, a))
	return s * s

def main():
	for i in range(t):
		(x, y) = input().split()
		res = func(int(x), int(y))
		print(res)
main()


t = int(input())
while t > 0:
	t -= 1
	(a, b) = map(int, input().split())
	if a < b:
		temp = a
		a = b
		b = temp
	res = max(a ** 2, (b * 2) ** 2)
	print(res)


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
from math import gcd, ceil

def pre(s):
	n = len(s)
	pi = [0] * n
	for i in range(1, n):
		j = pi[i - 1]
		while j and s[i] != s[j]:
			j = pi[j - 1]
		if s[i] == s[j]:
			j += 1
		pi[i] = j
	return pi

def prod(a):
	ans = 1
	for each in a:
		ans = ans * each
	return ans

def lcm(a, b):
	return a * b // gcd(a, b)

def binary(x, length=16):
	y = bin(x)[2:]
	return y if len(y) >= length else '0' * (length - len(y)) + y
for _ in range(int(input()) if True else 1):
	(a, b) = map(int, input().split())
	x = min(a, b) * 2
	y = max(a, b)
	if x >= y:
		print(x ** 2)
	else:
		print(y ** 2)


n = int(input())
for _ in range(0, n):
	i1 = list(map(int, input().split()))
	a = min(i1)
	a = a * 2
	while a < i1[0] or a < i1[1]:
		a = a + 1
	print(a ** 2)


t = int(input())
for i in range(0, t):
	arr = input()
	arr = arr.split()
	a = int(arr[0])
	b = int(arr[1])
	ans = min(max(a * 2, b), max(a, b * 2)) ** 2
	print(ans)


try:
	for _ in range(int(input())):
		(a, b) = map(int, input().split())
		if a < b:
			print(max(2 * a, b) * max(2 * a, b))
		else:
			print(max(2 * b, a) * max(2 * b, a))
except:
	pass


def max_square(a, b):
	if a < b:
		a_1 = b
		b = a
		a = a_1
	if 2 * b > a:
		a = 2 * b
	return a ** 2
t = int(input())
for i in range(t):
	a = list(map(int, input().split()))
	print(max_square(a[0], a[1]))


t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	if a > b:
		(a, b) = (b, a)
	d = 2 * a
	if d >= b:
		print(d * d)
	else:
		print(b * b)


try:
	while True:
		t = int(input())
		for i in range(t):
			(a, b) = map(int, input().split())
			if a == b:
				print((a * 2) ** 2)
			elif a > b:
				if 2 * b >= a:
					print((b * 2) ** 2)
				else:
					print(a ** 2)
			elif 2 * a >= b:
				print((a * 2) ** 2)
			else:
				print(b ** 2)
except EOFError:
	pass


def solve():
	(a, b) = map(int, input().split())
	mx = max(a, b)
	mn = min(a, b)
	if mx // mn < 2:
		e = mn * 2
		print(e * e)
	else:
		print(mx * mx)

def main():
	t = int(input())
	for _ in range(t):
		solve()
main()


t = int(input())
for cnt in range(t):
	(a, b) = map(int, input().split())
	c = max(2 * min(a, b), max(a, b))
	print(c ** 2)


for i in range(int(input())):
	(a, b) = map(int, input().split(' '))
	if a >= b and a <= 2 * b:
		print(4 * b * b)
	elif a <= b and b >= 2 * a:
		print(b * b)
	elif b <= a and a >= 2 * b:
		print(a * a)
	else:
		print(4 * a * a)


t = int(input())
for tc in range(t):
	(a, b) = map(int, input().split())
	if a < b:
		sm = a
		bg = b
	else:
		sm = b
		bg = a
	ans = max([sm * 2, bg])
	print(ans * ans)


from collections import defaultdict
import sys, math
f = None
try:
	f = open('q1.input', 'r')
except IOError:
	f = sys.stdin
if 'xrange' in dir(__builtins__):
	range = xrange

def print_case_iterable(case_num, iterable):
	print('Case #{}: {}'.format(case_num, ' '.join(map(str, iterable))))

def print_case_number(case_num, iterable):
	print('Case #{}: {}'.format(case_num, iterable))

def print_iterable(A):
	print(' '.join(A))

def read_int():
	return int(f.readline().strip())

def read_int_array():
	return [int(x) for x in f.readline().strip().split(' ')]

def rns():
	a = [x for x in f.readline().split(' ')]
	return (int(a[0]), a[1].strip())

def read_string():
	return list(f.readline().strip())

def bi(x):
	return bin(x)[2:]
from copy import deepcopy

def solution(a, b):
	if a > b:
		if 2 * b >= a:
			return (2 * b) ** 2
		return a ** 2
	if 2 * a >= b:
		return (2 * a) ** 2
	return b ** 2

def main():
	T = read_int()
	for i in range(T):
		(a, b) = read_int_array()
		x = solution(a, b)
		if 'xrange' not in dir(__builtins__):
			print(x)
		else:
			(print >> output, str(x))
	if 'xrange' in dir(__builtins__):
		print(output.getvalue())
		output.close()
if 'xrange' in dir(__builtins__):
	import cStringIO
	output = cStringIO.StringIO()
main()


def main():
	for t in range(int(input())):
		(a, b) = map(int, input().split())
		x = 2 * a
		y = 2 * b
		ans = min(max(x, b), max(y, a))
		print(ans * ans)
main()


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	mx = max(a, b)
	mn = min(a, b)
	ans = max(mn * 2, mx)
	print(ans * ans)


n = int(input())
for _ in range(n):
	k = list(map(int, input().split()))
	ll = [2 * min(k), max(k)]
	print(max(ll) ** 2)


t = int(input())
for _ in range(t):
	(x, y) = map(int, input().split())
	c = min(x, y)
	c = c * 2
	res = max(c, max(x, y))
	print(res ** 2)


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	(l, b) = map(int, input().split())
	(mini, maxi) = (min(l, b), max(l, b))
	if mini * 2 > maxi:
		print((2 * mini) ** 2)
	else:
		print(maxi ** 2)


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	length = max(a, b)
	width = min(a, b)
	area = 0
	side = 2 * width
	if side > length:
		area = side ** 2
	else:
		area = length ** 2
	print(area)


for i in range(int(input())):
	(n, m) = map(int, input().split())
	if 2 * m == n:
		print(n * n)
	elif m == n:
		print((m + n) * (m + n))
	elif 2 * n > m and 2 * m > n or (2 * n > m and 2 * m > n):
		k = 2 * min(n, m)
		print(k * k)
	else:
		k = max(m, n)
		print(k * k)


def main():
	k = int(input())
	for i in range(k):
		(a, b) = map(int, input().split())
		if 2 * min(a, b) >= max(a, b):
			print((2 * min(a, b)) ** 2)
		else:
			print(max(a, b) ** 2)
main()


n = int(input())
for x in range(n):
	l1 = list(map(int, input().split()))
	l1.sort()
	a = list(map(lambda num: 4 * num ** 2, l1))
	b = list(map(lambda num: num ** 2, l1))
	print(max(a[0], b[1]))


n = int(input())
for _ in range(n):
	(a, b) = list(map(int, input().split()))
	l = min(a + b, max(2 * a, b), max(2 * b, a))
	print(l ** 2)


z = lambda : int(input())
z1 = lambda : input()
z2 = lambda : map(int, input().split())
for _ in ' ' * z():
	(a, b) = z2()
	if 2 * min(a, b) >= max(a, b):
		print((2 * min(a, b)) ** 2)
	else:
		print(max(a, b) ** 2)


import sys
import time
st = time.perf_counter()
n = int(input())
for _ in range(n):
	(a, b) = map(int, input().split())
	if a > b:
		(a, b) = (b, a)
	if 2 * a >= b:
		print((2 * a) ** 2)
	else:
		print(b ** 2)
ed = time.perf_counter()
print('time:', ed - st, file=sys.stderr)


import sys

def input():
	return sys.stdin.readline().strip()

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]

def list4d(a, b, c, d, e):
	return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]

def ceil(x, y=1):
	return int(-(-x // y))

def INT():
	return int(input())

def MAP():
	return map(int, input().split())

def LIST(N=None):
	return list(MAP()) if N is None else [INT() for i in range(N)]

def Yes():
	print('Yes')

def No():
	print('No')

def YES():
	print('YES')

def NO():
	print('NO')
INF = 10 ** 19
MOD = 10 ** 9 + 7
for _ in range(INT()):
	(a, b) = MAP()
	ans = max(min(a, b) * 2, max(a, b)) ** 2
	print(ans)


t = int(input())
for _ in range(t):
	n = list(map(int, input().split()))
	q = max(max(n), 2 * min(n))
	print(q * q)


n = int(input())
for i in range(n):
	(a, b) = map(int, input().split())
	if max(a, b) >= 2 * min(a, b):
		print(max(a, b) ** 2)
	elif a == b:
		print((a + b) ** 2)
	else:
		print((2 * min(a, b)) ** 2)


area = []
for i in range(int(input())):
	(a, b) = map(int, input().split())
	c = min(a, b) * 2
	side_of_square = max(c, a, b)
	area.append(side_of_square ** 2)
print(*area, sep='\n')


tc = int(input())
for _ in range(tc):
	(a, b) = list(map(int, input().split(' ')))
	mini = min(a, b) * 2
	maxi = max(a, b)
	print(max(mini ** 2, maxi ** 2))


t = int(input())
for i in range(t):
	(x, y) = map(int, input().split())
	g = min(x, y)
	a = max(x, y)
	if g * 2 >= a:
		print((g * 2) ** 2)
	else:
		print(a * a)


for _ in range(int(input())):
	(A, B) = map(int, input().split())
	if A > B:
		(A, B) = (B, A)
	if 2 * A >= B:
		print(2 * A * 2 * A)
	else:
		print(B * B)


def main():
	(a, b) = map(int, input().split())
	c = max(a, b)
	d = min(a, b)
	e = max(d * 2, c)
	print(e * e)
for t in range(int(input())):
	main()


t = int(input())
for i in range(t):
	(a, b) = list(map(int, input().split()))
	x = min(a, b)
	y = max(a, b)
	print(max(2 * x, y) ** 2)


test = int(input())
while test != 0:
	(a, b) = [int(x) for x in input().split()]
	if a > b:
		if a >= 2 * b:
			print(a * a)
		else:
			s = b + b
			if a <= s:
				print(s * s)
			else:
				s = a + a
				print(s * s)
	elif b >= 2 * a:
		print(b * b)
	else:
		s = a + a
		if b <= s:
			print(s * s)
		else:
			s = b + b
			print(s * s)
	test -= 1


def find_sq(arr):
	l = arr[0]
	b = arr[1]
	if l > b:
		if 2 * b >= l:
			side_length = 2 * b
		else:
			side_length = l
	elif b > l:
		if 2 * l >= b:
			side_length = 2 * l
		else:
			side_length = b
	else:
		side_length = 2 * l
	return side_length ** 2
t = int(input())
for i in range(t):
	a = list(map(int, input().strip().split()))[:2]
	sq_area = find_sq(a)
	print(sq_area)


def Minimal_sq(a):
	maxi = max(a[0], a[1])
	mini = min(a[0], a[1])
	if maxi > mini * 2:
		return maxi ** 2
	else:
		return (mini * 2) ** 2
n = int(input())
for i in range(n):
	arr = list(map(int, input().rstrip().split()))
	print(Minimal_sq(arr))


def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())
entries = inp()
for i in range(entries):
	l = inlt()
	b = min(l)
	sq = b * 2
	res = max(sq, max(l))
	res = res ** 2
	print(res)


t = int(input())
for tt in range(t):
	(a, b) = map(int, input().split())
	x = min(a, b)
	xpx = x + x
	y = max(a, b)
	if xpx >= y:
		print(xpx * xpx)
	else:
		print(y * y)


for _ in range(int(input())):
	(b, a) = list(map(int, input().split()))
	if b > a:
		if b / a > 2:
			print(str(b * b))
		else:
			print(str(a * 2 * (a * 2)))
	elif a / b > 2:
		print(str(a * a))
	else:
		print(str(b * 2 * (b * 2)))


def read_ints():
	return [int(i) for i in input().strip().split()]
t = int(input())
for i in range(t):
	(a, b) = read_ints()
	side = max(min(a, b) * 2, max(a, b))
	print(side * side)


T = int(input())
for _ in range(T):
	(a, b) = map(int, input().split())
	min_side = min(a, b)
	if min_side * 2 < max(a, b):
		min_side = max(a, b)
	elif min_side * 2 > max(a, b):
		min_side = min_side * 2
	else:
		min_side = max(a, b)
	print(min_side * min_side)


import math
t = int(input())
for i in range(t):
	(a, b) = [int(i) for i in input().split()]
	m1 = max(a * 2, b)
	m2 = max(b * 2, a)
	m3 = a + b
	m = min(m1, m2, m3)
	print(m ** 2)


test_cases = int(input())

def area(side):
	return side * side
for i in range(test_cases):
	(length, breadth) = map(int, input().split(' '))
	extended_part = min(length, breadth)
	non_extended_part = max(length, breadth)
	if 2 * extended_part > non_extended_part:
		print(area(2 * extended_part))
	else:
		print(area(non_extended_part))


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	small = min(a, b)
	big = max(a, b)
	if small * 2 >= big:
		print((2 * small) ** 2)
	else:
		print(big ** 2)


n = int(input())
for i in range(n):
	lst = list(map(int, input().split()))
	lst = sorted(lst)
	if lst[0] * 2 >= lst[1]:
		print((lst[0] * 2) ** 2)
	else:
		print(lst[1] ** 2)


import math

def inp():
	return int(input())

def inlist():
	return list(map(int, input().split()))

def instr():
	s = input()
	return list(s[:len(s)])

def invr():
	return map(int, input().split())
t = inp()
while t:
	(a, b) = invr()
	mn = min(a, b)
	mx = max(a, b)
	ans = (mn * 2) ** 2
	if mn * 2 < mx:
		ans = mx ** 2
	print(ans)
	t -= 1


from sys import *
t = int(stdin.readline())
while t > 0:
	(a, b) = map(int, stdin.readline().split())
	ans = max(max(a, b), 2 * min(a, b))
	print(ans * ans)
	t -= 1


import math
from collections import *
inf = float('inf')

def si():
	return input()

def ii():
	return int(input())

def mii():
	return map(int, input().split())

def lii():
	return list(map(int, input().split()))

def matr(n):
	return [list(mii()) for _ in range(n)]
for _ in range(ii()):
	(a, b) = mii()
	mn = min(a, b)
	mx = max(a, b)
	if mn * 2 >= mx:
		print((mn * 2) ** 2)
	else:
		print(mx ** 2)


for _ in range(int(input())):
	(a, b) = [int(i) for i in input().split()]
	k = min(a, b) * 2
	if k >= max(a, b):
		print(pow(k, 2))
	else:
		k = max(a, b)
		print(pow(k, 2))


for i in range(int(input())):
	s = input().split()
	s1 = int(s[0])
	s2 = int(s[1])
	t1 = max(2 * s1, s2)
	t2 = max(2 * s2, s1)
	if t1 < t2:
		print(t1 ** 2)
	else:
		print(t2 ** 2)


import math
n = int(input())
for i in range(n):
	(a, b) = list(map(int, input().split()))
	(a, b) = sorted([a, b])
	if a == b:
		print((a * 2) ** 2)
	elif 2 * a < b:
		print(b ** 2)
	elif a == 1:
		print(4)
	else:
		print((math.ceil(b / a) * a) ** 2)


def solve():
	(a, b) = [int(x) for x in input().split()]
	side = 0
	if a > b:
		side = max(a, 2 * b)
	else:
		side = max(b, 2 * a)
	return side * side
T = int(input())
for case in range(T):
	print(solve())


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	p = min(a, b)
	if 2 * p >= max(a, b):
		print((2 * p) ** 2)
	else:
		print(max(a, b) ** 2)


n = int(input())
for i in range(n):
	ab = input().split()
	a = int(ab[0])
	b = int(ab[1])
	m = min(a, b)
	mx = max(a, b)
	m = m * 2
	if m >= mx:
		ans = m * m
	else:
		ans = mx * mx
	print(ans)


count = int(input())
for i in range(count):
	dim = [int(x) for x in input().split()]
	a = min(dim)
	b = max(dim)
	if 2 * a < b:
		print(b ** 2)
	else:
		print((2 * a) ** 2)


from sys import stdin, stdout

def input():
	return stdin.readline()
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	if min(a, b) * 2 >= max(a, b):
		print((2 * min(a, b)) ** 2)
	else:
		print(max(a, b) ** 2)


def solve():
	(a, b) = map(int, input().split())
	if b > a:
		(a, b) = (b, a)
	side = max(a, 2 * b)
	print(side ** 2)
for t in range(int(input())):
	solve()


for i in range(int(input())):
	(l, b) = list(map(int, input().split()))
	a = min(l + l, b + b)
	b = max(l, b)
	r = max(a, b)
	print(r ** 2)


t = int(input())
m = []
for i in range(0, t):
	(a, b) = input().split()
	a = int(a)
	b = int(b)
	if a > b:
		if a > 2 * b:
			m.insert(i, a * a)
		else:
			m.insert(i, b * b * 4)
	elif b > a:
		if b > 2 * a:
			m.insert(i, b * b)
		else:
			m.insert(i, a * a * 4)
	elif a == b:
		m.insert(i, a * a * 4)
for i in range(0, t):
	print(m[i])


t = int(input())
ans = []
for _ in range(t):
	(a, b) = list(map(int, input().split()))
	s = min(a, b)
	sl = max(a, b)
	if 2 * s > sl:
		ans.append(4 * s * s)
	else:
		ans.append(sl * sl)
ans = list(map(str, ans))
print('\n'.join(ans))


for i in range(int(input())):
	(l, b) = map(int, input().split())
	A = max(2 * min(l, b), max(l, b))
	print(A ** 2)


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
from math import factorial
from collections import Counter, defaultdict, deque
from heapq import heapify, heappop, heappush

def RL():
	return map(int, sys.stdin.readline().rstrip().split())

def RLL():
	return list(map(int, sys.stdin.readline().rstrip().split()))

def N():
	return int(input())

def comb(n, m):
	return factorial(n) / (factorial(m) * factorial(n - m)) if n >= m else 0

def perm(n, m):
	return factorial(n) // factorial(n - m) if n >= m else 0

def mdis(x1, y1, x2, y2):
	return abs(x1 - x2) + abs(y1 - y2)
mod = 998244353
INF = float('inf')

def main():
	for _ in range(N()):
		(a, b) = RL()
		print(min(max(a + a, b), max(b + b, a)) ** 2)
main()


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	c = min(a, b)
	d = max(a, b)
	c = c + c
	if c >= d:
		print(c * c)
	else:
		print(d * d)


t = int(input())
while t:
	(a, b) = map(int, input().split())
	n = min(a, b)
	m = max(a, b)
	if 4 * (n * n) > m * m:
		print(4 * (n * n))
	else:
		print(m * m)
	t -= 1


from sys import stdin
input = stdin.readline
for _ in range(int(input())):
	a = [int(x) for x in input().split()]
	a.sort()
	print(max(2 * a[0], a[1]) ** 2)


import sys
q = int(input())
for i in range(q):
	(a, b) = [int(i) for i in sys.stdin.readline().split()]
	min1 = min(a, b)
	max1 = max(a, b)
	if min1 * 2 > max1:
		print((min1 * 2) ** 2)
	else:
		print(max1 ** 2)


from math import *
sInt = lambda : int(input())
mInt = lambda : map(int, input().split())
lInt = lambda : list(map(int, input().split()))
t = sInt()
for _ in range(t):
	(a, b) = mInt()
	m = min(a, b)
	ans = max(2 * m, max(a, b))
	print(ans ** 2)


import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	(a, b) = tuple([int(i) for i in input().split()])
	if min(a, b) * 2 >= max(a, b):
		print(min(a, b) ** 2 * 4)
		continue
	else:
		print(max(a, b) ** 2)
		continue


a = int(input())
for fewfweefw in range(a):
	lst = input().split()
	lst = [int(p) for p in lst]
	lst = sorted(lst)[::-1]
	a = lst[0]
	b = lst[1]
	if a > 2 * b:
		print(a ** 2)
	else:
		print((2 * b) ** 2)


def squareArea(a, b):
	if a == b:
		return a * 2 * (a * 2)
	x = min(a, b) * 2
	y = max(a, b)
	if x > y:
		return x * x
	else:
		return y * y
t = int(input())
for i in range(0, t):
	(a, b) = map(int, input().split())
	print(squareArea(a, b))


for i in range(int(input())):
	(a, b) = map(int, input().split())
	if a > b:
		b = b * 2
	else:
		a = a * 2
	res = max(b, a) ** 2
	print(res)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	c = min(a, b)
	a = max(a, b)
	c = 2 * c
	m = max(a, c)
	print(m * m)


t = int(input())
for i in range(0, t, 1):
	(a, b) = map(int, input().split())
	m1 = max(2 * a, b)
	m2 = max(2 * b, a)
	num = min(m1, m2) ** 2
	print(num)


t = int(input())
for i in range(t):
	(a, b) = [int(x) for x in input().split()]
	c = max(min(a, b) * 2, max(a, b))
	print(c * c)


t = int(input())
for i in range(t):
	(l, b) = map(int, input().split())
	s = min(l, b)
	g = max(l, b)
	s = s * 2
	if s < g:
		print(g * g)
	else:
		print(s * s)


def main():
	t = int(input())
	ans = []
	for i in range(t):
		(a, b) = map(int, input().split())
		(a, b) = (min(a, b), max(a, b))
		if 2 * a >= b:
			ans.append(pow(2 * a, 2))
		else:
			ans.append(pow(b, 2))
	for i in ans:
		print(i)
main()


t = int(input())
for _ in range(t):
	arr = [int(i) for i in input().split()]
	arr = sorted(arr)
	print(max(2 * arr[0], arr[1]) ** 2)


import sys
input = sys.stdin.readline
from collections import *
t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	(a, b) = (min(a, b), max(a, b))
	if 2 * a < b:
		print(b * b)
	else:
		print(4 * a * a)


t = int(input())
l = []
for i in range(t):
	(a, b) = [int(a) for a in input().split()]
	if a <= b and a >= b / 2:
		l.append(4 * a * a)
	elif a >= b and b >= a / 2:
		l.append(4 * b * b)
	elif a < b and a < b / 2:
		l.append(b * b)
	elif b < a and b < a / 2:
		l.append(a * a)
for _ in range(t):
	print(l[_])


testCases = int(input())
for _ in range(testCases):
	(a, b) = map(int, input().split())
	small = min(a, b)
	big = max(a, b)
	print(max(4 * small ** 2, big ** 2))


t = int(input())
for i in range(t):
	(a, b) = input().split(' ')
	a = int(a)
	b = int(b)
	if a > b:
		small = b
		big = a
	else:
		small = a
		big = b
	if small * 2 >= big:
		print((2 * small) ** 2)
	else:
		print(big ** 2)


from collections import defaultdict

def func(a, b):
	if a > b:
		temp = max(2 * b, a)
		return temp * temp
	else:
		temp = max(2 * a, b)
		return temp * temp
t = int(input())
for i in range(t):
	(a, b) = list(map(int, input().split()))
	print(func(a, b))


i = int(input())
for _ in range(i):
	(k, l) = map(int, input().split())
	if k > l:
		if l * 2 > k:
			print(l * l * 4)
		else:
			print(k * k)
	elif k * 2 > l:
		print(k * k * 4)
	else:
		print(l * l)


n = int(input())
for x in range(n):
	(a, b) = [int(y) for y in input().split(' ')]
	print(min(max(2 * a, b), max(a, 2 * b)) ** 2)


n = int(input())

def solve():
	(a, b) = map(int, input().split())
	side1 = max(2 * a, b)
	side2 = max(2 * b, a)
	print(min(side1, side2) ** 2)
for i in range(n):
	solve()


def rs():
	return input().strip()

def ri():
	return int(input())

def ria():
	return list(map(int, input().split()))

def ia_to_s(a):
	return ' '.join([str(s) for s in a])

def solve(a, b):
	mi = min(a, b)
	ma = max(a, b)
	s = max(2 * mi, ma)
	return s * s

def main():
	for _ in range(ri()):
		(a, b) = ria()
		print(solve(a, b))

def __starting_point():
	main()
__starting_point()


t = int(input())
for r in range(t):
	(a, b) = map(int, input().split())
	if b > a:
		(a, b) = (b, a)
	n = max(2 * b, a)
	print(n ** 2)


import sys
input = sys.stdin.readline

def main():
	for _ in range(int(input())):
		(a, b) = map(int, input().split())
		(a, b) = (max(a, b), min(a, b))
		if b * 2 >= a:
			print((b * 2) ** 2)
		else:
			print(a ** 2)
main()


t = int(input())
for i in range(t):
	(a, b) = input().split()
	a = int(a)
	b = int(b)
	a1 = max(a, b)
	a2 = min(a, b)
	ans1 = max(2 * a1, a2)
	ans2 = max(a1, 2 * a2)
	ans3 = a1 + a2
	ans4 = max(a1, a1 + a2)
	ans = min(ans1, ans2, ans3, ans4)
	print(ans * ans)


n = int(input())
for i in range(n):
	val = input()
	lst = list(map(int, val.split()))
	l = lst[0]
	b = lst[1]
	v = l
	length = l
	if l > b:
		v = b
		length = l
	elif l < b:
		v = l
		length = b
	wid = 2 * v
	if wid >= length:
		area = wid ** 2
		print(area)
	else:
		area = length ** 2
		print(area)


n = int(input())
while n:
	(a, b) = input().split(' ')
	(a, b) = (int(a), int(b))
	if a < b:
		a = 2 * a
		res = max(a, b)
		print(res * res)
	elif a > b:
		b = 2 * b
		res = max(a, b)
		print(res * res)
	else:
		print(4 * a * a)
	n = n - 1


import sys
input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())
for _ in range(inp()):
	list_ = inlt()
	if 2 * min(list_) >= max(list_):
		print((2 * min(list_)) ** 2)
	else:
		print(max(list_) ** 2)


t = int(input())
import math
i = 0
while i < t:
	i += 1
	(a, b) = map(int, input().split())
	if a > 2 * b:
		print(a * a)
	if b > 2 * a:
		print(b * b)
	if 2 * a > b and a < b:
		print(4 * a * a)
	if 2 * b > a and a > b:
		print(4 * b * b)
	if a == b:
		print(4 * a * a)
	if a == 2 * b:
		print(a * a)
	if b == 2 * a:
		print(b * b)


t = int(input())
ans = []
for i in range(t):
	arr = [int(x) for x in input().split(' ')]
	arr.sort(reverse=True)
	l = arr[0]
	b = arr[1]
	if l >= 2 * b:
		ans.append(l ** 2)
	elif l < 2 * b:
		ans.append((2 * b) ** 2)
for i in ans:
	print(i)


t = int(input())
for g in range(t):
	(a, b) = map(int, input().split())
	d = min(a, b)
	if 2 * d <= max(a, b):
		print(max(a, b) * max(a, b))
	else:
		c = max(a, b) + 1
		ans = max(c, 2 * d)
		print(ans * ans)


n = int(input())
for i in range(0, n):
	(a, b) = map(int, input().split())
	x = min(a, b)
	y = max(a, b)
	x = x * 2
	sq = max(x, y)
	print(sq ** 2)


for _ in range(int(input())):
	(w, l) = [int(t) for t in input().split()]
	m = max(min(w, l) * 2, max(w, l))
	print(m ** 2)


n = int(input())
for i in range(n):
	(a, b) = input().split()
	(a, b) = (int(a), int(b))
	if a > b and a >= 2 * b:
		print(a * a)
	elif a == b:
		c = a + b
		print(c * c)
	elif a > b:
		c = 2 * b
		print(c * c)
	elif b >= 2 * a:
		print(b * b)
	else:
		c = 2 * a
		print(c * c)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	i = max(a, b)
	while 1:
		if i * i >= 2 * a * b and i >= 2 * min(a, b):
			print(i * i)
			break
		else:
			i += 1


n = int(input())
i = 0
while i < n:
	(a, b) = [int(i) for i in input().split()]
	(a, b) = (min(a, b), max(a, b))
	r = b
	if 2 * a >= b:
		r = 2 * a
	print(r ** 2)
	i += 1


t = int(input())
for i in range(t):
	(n, m) = map(int, input().split())
	x = min(n, m) * 2
	y = max(n, m)
	z = max(x, y)
	print(z * z)


import sys
for i in range(int(sys.stdin.readline())):
	(a, b) = map(int, sys.stdin.readline().split())
	print(max(min(a, b) * 2, a, b) ** 2)


import logging

def solve(a, b):
	maxi = max(a, b)
	mini = min(a, b)
	if 2 * mini >= maxi:
		print((2 * mini) ** 2)
	else:
		print(maxi ** 2)
	return
t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	solve(a, b)


t = int(input())
ans = []
for i in range(t):
	A = list(map(int, input().split()))
	(a, b) = A
	if a == b:
		ans.append((a * 2) ** 2)
	elif a == 1 or b == 1:
		ans.append((a * b) ** 2)
	elif max(A) // min(A) == 0:
		ans.append(max(A) ** 2)
	elif min(A) * 2 > max(A):
		ans.append((min(A) * 2) ** 2)
	else:
		ans.append(max(A) ** 2)
for i in ans:
	print(i)


t = int(input())
for _ in range(t):
	A = list(map(int, input().split()))
	n = max(A)
	m = min(A)
	if 2 * m >= n:
		print((2 * m) ** 2)
	else:
		print(n ** 2)


t = int(input())
for i in range(0, t):
	ab = input().split()
	if int(ab[0]) > int(ab[1]):
		ab_max = int(ab[0])
		ab_min = int(ab[1])
	else:
		ab_max = int(ab[1])
		ab_min = int(ab[0])
	if ab_min * 2 > ab_max:
		print(ab_min * ab_min * 4)
	else:
		print(ab_max * ab_max)


t = int(input(''))
for i in range(t):
	s = input('')
	L = s.split(' ')
	(a, b) = (int(L[0]), int(L[1]))
	if a == b:
		print((a * 2) ** 2)
	else:
		c = max(a, b)
		d = min(a, b)
		if d * 2 > c:
			print((d * 2) ** 2)
		else:
			print(c ** 2)


n = int(input())
for i in range(n):
	(a, b) = map(int, input().split())
	s = a * b * 2
	h = max(a, b)
	k = min(a, b)
	if 2 * k > h:
		print(4 * k * k)
	else:
		print(h * h)


t = int(input())
for i in range(t):
	nk = tuple(map(int, input().split()))
	print(max(max(nk), min(nk) * 2) ** 2)


import math

def BuubleSort(a, b):
	side = min(max(2 * a, b), max(2 * b, a))
	return side ** 2

def main():
	n = int(input())
	for _ in range(n):
		(a, b) = map(int, input().split())
		ans = BuubleSort(a, b)
		print(ans)
main()


def main():
	for i in range(int(input())):
		(a, b) = input().split()
		(a, b) = (int(a), int(b))
		if a < b:
			(a, b) = (b, a)
		n = max(a, 2 * b)
		print(n * n)
main()


def f(a, b):
	if a <= b:
		if b > 2 * a:
			return b ** 2
		else:
			return (2 * a) ** 2
	elif a > 2 * b:
		return a ** 2
	else:
		return (2 * b) ** 2
for tc in range(int(input())):
	al = list(map(int, input().split()))
	print(f(al[0], al[1]))


t = int(input())
for x in range(t):
	thing = list(map(int, input().split()))
	thing.sort()
	if thing[1] / 2 >= thing[0]:
		print(thing[1] ** 2)
	else:
		print((2 * thing[0]) ** 2)


def main():
	t = int(input())
	for i in range(t):
		solve()

def solve():
	(x, y) = list(map(int, input().split(' ')))
	if x >= 2 * y:
		print(x * x)
	elif 2 * x <= y:
		print(y * y)
	elif x >= y:
		print((2 * y) ** 2)
	else:
		print((2 * x) ** 2)
main()


t = int(input())
for i in range(t):
	(a, b) = sorted([int(i) for i in input().split()])
	side = min(max(a * 2, b), max(a, b * 2))
	print(side * side)


t = int(input())
input1 = []
for i in range(t):
	input1.append([int(x) for x in input().split()])
output = []
for pair in input1:
	a = pair[0]
	b = pair[1]
	if a == b:
		output.append(4 * a * a)
	elif a > b:
		if a // b >= 2:
			output.append(a * a)
		else:
			output.append(4 * b * b)
	elif a < b:
		if b // a >= 2:
			output.append(b * b)
		else:
			output.append(4 * a * a)
for int1 in output:
	print(int1)


test = int(input())
for t in range(test):
	(a, b) = map(int, input().split())
	maxim = max(a, b)
	minim = min(a, b)
	result = max(maxim, minim * 2)
	result2 = result * result
	print(result2)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	f = min(a, b) * 2
	g = max(a, b)
	h = max(g, f)
	print(h * h)


from sys import stdin

def getl():
	return stdin.readline().strip()

def geta():
	return getl().split()

def geti():
	return [int(x) for x in geta()]
(t,) = geti()
for _ in range(t):
	(a, b) = geti()
	if b < a:
		tmp = a
		a = b
		b = tmp
	if 2 * a <= b:
		print(b * b)
	else:
		print(4 * a * a)


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	c = 0
	if a >= b:
		c = a
		a = b
		b = c
	if b <= 2 * a:
		print(4 * a * a)
	else:
		print(b * b)


import math
testcases = int(input())
for i in range(testcases):
	(a, b) = list(map(int, input().split()))
	while True:
		if max(a, b) ** 2 < a * b + a * b:
			if a > b:
				a += 1
			else:
				b += 1
		else:
			print(max(a, b) ** 2)
			break


T_ON = 1
DEBUG_ON = 0
MOD = 998244353

def solve():
	(a, b) = read_ints()
	if a > b:
		(a, b) = (b, a)
	c = max(2 * a, b)
	print(c ** 2)

def main():
	T = read_int() if T_ON else 1
	for i in range(T):
		solve()

def dbg(*xargs):
	if DEBUG_ON:
		print(*xargs)
from collections import *
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def read_int():
	return int(input())

def read_ints():
	return list(map(int, input().split()))

def print_nums(nums):
	print(' '.join(map(str, nums)))

def YES():
	print('YES')

def Yes():
	print('Yes')

def NO():
	print('NO')

def No():
	print('No')

def fib(n):
	(a, b) = (0, 1)
	for _ in range(n):
		(a, b) = (b, a + b)
	return a

def fib_ns(n):
	assert n >= 1
	f = [0 for _ in range(n + 1)]
	f[0] = 0
	f[1] = 1
	for i in range(2, n + 1):
		f[i] = f[i - 1] + f[i - 2]
	return f

def gcd(a, b):
	if a == 0:
		return b
	return gcd(b, a % b)

def xgcd(a, b):
	(x0, x1, y0, y1) = (0, 1, 1, 0)
	while a != 0:
		((q, a), b) = (divmod(b, a), a)
		(y0, y1) = (y1, y0 - q * y1)
		(x0, x1) = (x1, x0 - q * x1)
	return (b, x0, y0)

def modinv(a, m):
	(g, x, _) = xgcd(a, m)
	if g != 1:
		raise Exception('gcd(a, m) != 1')
	return x % m

def mod_add(x, y):
	x += y
	while x >= MOD:
		x -= MOD
	while x < 0:
		x += MOD
	return x

def mod_mul(x, y):
	return x * y % MOD

def mod_pow(x, y):
	if y == 0:
		return 1
	if y % 2:
		return mod_mul(x, mod_pow(x, y - 1))
	p = mod_pow(x, y // 2)
	return mod_mul(p, p)

def mod_inv(y):
	return mod_pow(y, MOD - 2)

def mod_div(x, y):
	return mod_mul(x, mod_inv(y))

def is_prime(n):
	if n == 1:
		return False
	for i in range(2, int(n ** 0.5) + 1):
		if n % i:
			return False
	return True

def primes(n):
	P = [True for _ in range(n + 1)]
	P[0] = P[1] = False
	for i in range(int(n ** 0.5) + 1):
		if P[i]:
			for j in range(2 * i, n + 1, i):
				P[j] = False
	return P
main()


test = int(input())
respostas = []
for x in range(test):
	(a, b) = map(int, input().split())
	menor = min(a, b)
	menor = menor * 2
	maior = max(a, b)
	respostas.append(max(maior, menor) ** 2)
for x in respostas:
	print(x)


t = int(input())
for _ in range(t):
	(a, b) = sorted(map(int, input().split()))
	a *= 2
	print(max(a, b) ** 2)


n = int(input())
i = 0
while i < n:
	(x, y) = map(int, input().split())
	ans = max(2 * min(x, y), max(x, y))
	print(pow(ans, 2))
	i = i + 1


for _ in range(int(input())):
	ab = input().split()
	a = int(ab[0])
	b = int(ab[1])
	if a >= b:
		min = b
		max = a
	else:
		min = a
		max = b
	if 2 * min >= max:
		print((2 * min) ** 2)
	else:
		print(max ** 2)


t = int(input())
for h in range(t):
	(a, b) = map(int, input().split())
	if a < b:
		(a, b) = (b, a)
	ans = a ** 2
	if a < b + b:
		ans = (b + b) ** 2
	print(ans)


T = int(input())
for _ in range(T):
	(a, b) = list(map(int, input().split()))
	mi = min(a, b)
	ma = max(a, b)
	if ma <= 2 * mi:
		print(4 * mi ** 2)
	else:
		print(ma ** 2)


from sys import stdin, stdout
import collections
import heapq
import itertools
import functools
import math
import operator

def read_line():
	return stdin.readline().strip()

def read_int():
	return int(read_line())

def read_arr():
	return read_line().split(' ')

def read_int_arr():
	return [int(x) for x in read_arr()]

def query_interactive(s):
	print(s)
	stdout.flush()

def main():
	T = 1
	T = read_int()
	for _ in range(T):
		(a, b) = read_int_arr()
		c = min(a, b) * 2
		space = max(max(a, b), c)
		print(space ** 2)
main()


T = int(input())
for i in range(0, T):
	(a, b) = list(map(int, input().split()))
	if a > b:
		if 2 * b < a:
			print(a * a)
		else:
			print(4 * b * b)
	elif 2 * a < b:
		print(b * b)
	else:
		print(4 * a * a)


from sys import stdin, stdout
tests = int(stdin.readline())
for j in range(tests):
	(x, y) = [int(x) for x in stdin.readline().split()]
	dim = min(2 * x, 2 * y)
	dim = max(dim, max(x, y))
	stdout.write(str(dim ** 2) + '\n')


t = int(input())
while t > 0:
	(a, b) = list(map(int, input().split()))
	if a > b:
		(a, b) = (b, a)
	side = max(2 * a, b)
	print(side * side)
	t = t - 1


for _ in range(int(input())):
	(a, b) = list(map(int, input().strip().split()))
	if a != b:
		mx = max(a, b)
		mn = min(a, b)
		z = max(mx, 2 * mn)
		y = min(z, max(a, b) ** 2)
		print(y ** 2)
	else:
		print((2 * a) ** 2)


def noOfSquares(a, b):
	if 2 * a < b:
		return b * b
	else:
		return 4 * a * a
for t in range(int(input())):
	(a, b) = map(int, input().split())
	if a < b:
		print(noOfSquares(a, b))
	else:
		print(noOfSquares(b, a))


t = int(input())
for _ in range(t):
	(a, b) = sorted(map(int, input().split()))
	if b >= a * 2:
		print(b ** 2)
	else:
		print(4 * a ** 2)


t = int(input())
for i in range(t):
	(a, b) = [int(a) for a in input().split()]
	n = min(max(2 * a, b), max(a, 2 * b))
	print(n * n)


def solve(a, b):
	side_a = min(a, b) * 2
	side_b = max(a, b)
	return max(side_a, side_b) ** 2
t = int(input())
for i in range(t):
	(a, b) = list(map(int, input().split()))
	print(solve(a, b))


import sys
import math
infile = sys.stdin
next(infile)
for line in infile:
	l = list(map(int, line.split()))
	a = l[0]
	b = l[1]
	area = 2 * a * b
	if math.sqrt(area) - int(math.sqrt(area)) == 0:
		anslen = int(math.sqrt(area))
	else:
		anslen = int(math.sqrt(area)) + 1
	k = 2
	while k != 0:
		if anslen >= 2 * min(a, b) and anslen >= max(a, b):
			k = 0
		else:
			anslen += 1
	print(anslen * anslen)


def solve(f):
	a = f[0]
	b = f[1]
	print(min(max(a, 2 * b), max(2 * a, b)) ** 2)

def main():
	for i in range(int(input())):
		solve([int(x) for x in input().split()])
main()


import math
test = input()
for i in range(int(test)):
	(l, b) = map(int, input().split())
	m = max(l, b)
	mi = min(l, b)
	if 2 * mi >= m:
		side = 2 * mi
	else:
		side = m
	print(side ** 2)


def whoislarger(a, b):
	if a >= b:
		return a
	else:
		return b

def whoissmaller(a, b):
	if a < b:
		return a
	else:
		return b
size = int(input())
for x in range(size):
	nums = input().split()
	a = int(nums[0])
	b = int(nums[1])
	large = whoislarger(a, b)
	small = whoissmaller(a, b)
	if small * 2 >= large:
		out = (small * 2) ** 2
	else:
		out = large ** 2
	print(out)
	out = ''


import math
from collections import defaultdict, Counter, deque

def primeFactor(n):
	if n % 2 == 0:
		return 2
	i = 3
	while i ** 2 <= n:
		if n % i == 0:
			return i
		i += 1
	return n

def main():
	(l, b) = map(int, input().split())
	sq_l = max(max(l, b), 2 * min(l, b))
	print(sq_l ** 2)
t = int(input())
for _ in range(t):
	main()


import sys
buff_readline = sys.stdin.readline
readline = sys.stdin.readline
INF = 2 ** 62 - 1

def read_int():
	return int(buff_readline())

def read_int_n():
	return list(map(int, buff_readline().split()))

def slv(A, B):
	if A > B:
		(A, B) = (B, A)
	return max(2 * A, B) ** 2

def main():
	T = read_int()
	for _ in range(T):
		(A, B) = read_int_n()
		print(slv(A, B))
main()


T = int(input())
for i in range(T):
	(a, b) = list(map(int, input().split()))
	c1 = max(2 * a, b) * max(2 * a, b)
	c2 = max(a, 2 * b) * max(a, 2 * b)
	print(min(c1, c2))


t = int(input())
for i in range(t):
	(x, y) = sorted(map(int, input().split()))
	n = 2 * x
	res = max(n, y) ** 2
	print(res)


for i1 in range(int(input())):
	(a, b) = map(int, input().split())
	l1 = max(a, b)
	l2 = 2 * min(a, b)
	ans = max(l1, l2)
	print(ans * ans)


for _ in range(int(input())):
	x = tuple(map(int, input().split()))
	print(max(2 * min(x), max(x)) ** 2)


from collections import defaultdict, Counter
from functools import lru_cache
from heapq import heappush, heappop
from math import gcd, floor, ceil
from sys import stdin, stdout

def ilist():
	return [int(x) for x in stdin.readline().strip().split(' ')]

def iint():
	return int(stdin.readline().strip())

def istr():
	return stdin.readline().strip()

def solve(a, b):
	x = max(2 * a, b)
	y = max(a, 2 * b)
	return min(x, y) ** 2
t = iint()
for _ in range(t):
	(a, b) = ilist()
	print(solve(a, b))


cases = int(input())
for t in range(cases):
	(a, b) = list(map(int, input().split()))
	v = min(a, b)
	m = max(a, b)
	if m >= 2 * v:
		print(m ** 2)
	else:
		v *= 2
		print(v ** 2)


a = int(input())
s = []
for i in range(a):
	b = input().split(' ')
	b[0] = int(b[0])
	b[1] = int(b[1])
	c = 2 * min(b)
	if c >= max(b):
		s.append(c ** 2)
	else:
		s.append(max(b) ** 2)
for j in range(a):
	print(s[j])


t = int(input())
while t > 0:
	(a, b) = input().split()
	a = int(a)
	b = int(b)
	s = 0
	if a == b:
		print(4 * a * b)
	elif a == 1 or b == 1:
		print(a * a * b * b)
	elif a / b == 2:
		print(a * a)
	elif b / a == 2:
		print(b * b)
	else:
		if a < b:
			(a, b) = (b, a)
		if a > 2 * b:
			print(a * a)
		else:
			print(4 * b * b)
	t -= 1


t = int(input())

def swap(a, b):
	return (b, a)
while t:
	inp = input().split()
	a = int(inp[0])
	b = int(inp[1])
	t = t - 1
	if a >= b:
		if a >= b * 2:
			print(a * a)
		else:
			print(b * b * 4)
	else:
		(a, b) = swap(a, b)
		if a >= b * 2:
			print(a * a)
		else:
			print(b * b * 4)


q = int(input())
while q:
	q -= 1
	(a, b) = input().split(' ')
	(a, b) = (int(a), int(b))
	(a, b) = (max(a, b), min(a, b))
	print(max(4 * b * b, a * a))


from sys import stdin, stdout
t = int(input())
for i in range(t):
	(a, b) = list(map(int, input().split()))
	side = min(max(2 * a, b), max(2 * b, a))
	print(side ** 2)


import math

def doit(a, b):
	c = b
	c = 2 * c
	small = -1
	large = -1
	if c < a:
		small = c
		large = a
	else:
		small = a
		large = c
	small = small + large - small
	area1 = small * large
	c = a
	c = 2 * c
	small = -1
	large = -1
	if c < b:
		small = c
		large = b
	else:
		small = b
		large = c
	small = small + large - small
	area2 = small * large
	area = min(area1, area2)
	i = int(math.sqrt(area))
	while True:
		if i * i >= area:
			return i * i
		else:
			i += 1
t = int(input())
for i in range(t):
	a = [int(x) for x in input().split()]
	print(int(doit(a[0], a[1])))


pa = input()
p = int(pa)
while p > 0:
	p = p - 1
	lst = list()
	n = input()
	lst = n.split()
	a = int(lst[0])
	b = int(lst[1])
	print(min(max(2 * b, a), max(2 * a, b)) ** 2)


t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	minn = min(a, b)
	maxx = max(a, b)
	if 2 * minn >= maxx:
		print(4 * minn * minn)
	else:
		print(maxx * maxx)


cases = int(input())
for i in range(cases):
	line1 = input().split(' ')
	l = int(line1[0])
	w = int(line1[1])
	mi = min(l, w)
	ma = max(l, w)
	if 2 * mi < ma:
		print(ma ** 2)
	elif 2 * mi > ma:
		print((2 * mi) ** 2)
	elif 2 * mi == ma:
		print(ma ** 2)


for _ in range(int(input())):
	(n, m) = map(int, input().split())
	(n, m) = (max(n, m), min(n, m))
	l = n
	b = 2 * m
	print(max(l, b) * max(l, b))


for i in range(int(input())):
	inp = input().split()
	(a, b) = (int(inp[0]), int(inp[1]))
	for i in range(2):
		if a >= b:
			if 2 * b > a:
				print((2 * b) ** 2)
			else:
				print(a ** 2)
			break
		else:
			(a, b) = (b, a)


import sys
q = int(sys.stdin.readline())
for _ in range(q):
	(a, b) = map(int, sys.stdin.readline().split())
	if a + a >= b:
		square1 = (a + a) * (a + a)
	else:
		square1 = b * b
	if b + b >= a:
		square2 = (b + b) * (b + b)
	else:
		square2 = a * a
	if a + b >= max(a, b):
		square3 = (a + b) * (a + b)
	else:
		square3 = max(a, b) * max(a, b)
	print(min(square1, square2, square3))


from sys import stdin, stdout
T = int(stdin.readline())
for i in range(T):
	(a, b) = map(int, stdin.readline().split())
	stdout.write(str(max(2 * min(a, b), max(a, b)) ** 2) + '\n')


cases = int(input())
for case in range(cases):
	data = input()
	data = data.split()
	a = int(data[0])
	b = int(data[1])
	if a > b:
		dif = b * 2 - a
		if dif == 0:
			print(pow(a, 2))
		elif dif > 0:
			print(pow(a + dif, 2))
		else:
			print(pow(b * 2 + abs(dif), 2))
	else:
		dif = a * 2 - b
		if dif == 0:
			print(pow(b, 2))
		elif dif > 0:
			print(pow(b + dif, 2))
		else:
			print(pow(a * 2 + abs(dif), 2))


def solve():
	(m, n) = map(int, input().split())
	a = min(n, m)
	b = max(n, m)
	x = 2 * a - b
	if x >= 0:
		print((b + x) * (b + x))
	else:
		print(b * b)
for t in range(int(input())):
	solve()


from __future__ import division, print_function
import os
import sys
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip

def solve(t):
	(a, b) = map(int, input().strip().split())
	(aa, bb) = (min(a, b), max(a, b))
	if 2 * aa >= bb:
		return (2 * aa) ** 2
	else:
		return bb ** 2

def main():
	tc = int(input().strip())
	for t in range(1, tc + 1):
		print(solve(t))
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


import math
for z in range(int(input())):
	(a, b) = map(int, input().split())
	ans = 0
	if a > b:
		if a > 2 * b:
			ans = a * a
		else:
			ans = (2 * b) ** 2
	elif b > 2 * a:
		ans = b * b
	else:
		ans = (2 * a) ** 2
	print(ans)


import math
t = int(input())
for _ in range(t):
	s = input().split()
	a = int(s[0])
	b = int(s[1])
	aa = min(a, b)
	bb = max(a, b)
	aa = aa * 2
	print(max(bb, aa) * max(bb, aa))


t = int(input())
for w in range(t):
	ab = list(map(int, input().strip().split()))
	a = max(ab)
	b = min(ab)
	c = max(a, 2 * b)
	print(c * c)


z = int(input())
for i in range(0, z):
	(x, y) = input().split()
	x = int(x)
	y = int(y)
	a = x * y
	ta = 2 * a
	if x == y:
		print((x * 2) ** 2)
	elif x >= y:
		if (2 * y) ** 2 >= ta:
			print((2 * y) ** 2)
		else:
			print(x ** 2)
	elif (2 * x) ** 2 >= ta:
		print((2 * x) ** 2)
	else:
		print(y ** 2)


r = int(input())
for i in range(r):
	(a, b) = map(lambda x: int(x), input().split())
	l = max(a, b)
	w = min(a, b)
	if l > w * 2:
		print(l ** 2)
	else:
		print(4 * w ** 2)


answer = []
for i in range(int(input())):
	(a, b) = list(map(int, input().split()))
	c = max(a, b)
	d = min(a, b)
	s1 = 2 * d
	if c <= s1:
		area = s1 ** 2
	else:
		area = c ** 2
	answer.append(area)
for i in range(len(answer)):
	print(answer[i])


T = int(input())
for z in range(T):
	(a, b) = map(int, input().split())
	req = min(a, b) * 2
	if req < max(a, b):
		req += max(a, b) - req
	print(req * req)


t = int(input())
for i in range(t):
	(l, b) = map(int, input().split())
	(l, b) = [l, b] if l > b else [b, l]
	if b >= (l + 1) // 2:
		print((2 * b) ** 2)
	else:
		print(l ** 2)


def g():
	t = int(input())
	for i in range(t):
		s = input().split()
		o = int(s[0])
		t = int(s[1])
		if o == t:
			a = (o + t) ** 2
		elif min(o, t) * 2 >= max(o, t):
			a = (min(o, t) * 2) ** 2
		elif min(o, t) * 2 < max(o, t):
			a = max(o, t) ** 2
		print(a)
g()


def sqr(x, y):
	if 2 * x >= y:
		print(2 * x * (2 * x))
	else:
		print(y * y)
z = int(input())
for i in range(z):
	(x, y) = map(int, input().split())
	if x == y:
		print(2 * x * (2 * x))
	elif x < y:
		sqr(x, y)
	else:
		sqr(y, x)


t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	if a > b:
		b = 2 * b
		if b >= a:
			print(b * b)
			continue
		else:
			print(a * a)
			continue
	elif b > a:
		a = 2 * a
		if b >= a:
			print(b * b)
			continue
		else:
			print(a * a)
			continue
	elif b == a:
		print(b * 2 * (b * 2))
		continue


for _ in range(int(input())):
	(x, y) = map(int, input().split())
	if min(x, y) * 2 > max(x, y):
		print(4 * min(x, y) * min(x, y))
	else:
		print(max(x, y) * max(x, y))


import math
import collections
from sys import stdin, stdout, setrecursionlimit
from bisect import bisect_left as bsl
from bisect import bisect_right as bsr
import heapq as hq
setrecursionlimit(2 ** 20)
t = int(stdin.readline())
for _ in range(t):
	(a, b) = list(map(int, stdin.readline().rstrip().split()))
	print(min(max(2 * a, b), max(2 * b, a), a + b) ** 2)


for _ in range(int(input())):
	(x, y) = map(int, input().split())
	a = min(x, y)
	b = max(x, y)
	c = a + a
	if c ** 2 > b ** 2:
		print(c ** 2)
	elif a == b:
		print((a + b) ** 2)
	else:
		print(b ** 2)


for i in range(int(input())):
	(a, b) = sorted(map(int, input().split()))
	if 2 * a < b:
		print(b * b)
	else:
		print(4 * a * a)


tests = int(input())
for t in range(tests):
	(a, b) = map(int, input().split())
	mi = min(a, b)
	ma = max(a, b)
	c = max(2 * mi, ma)
	print(c * c)


for _ in range(int(input())):
	(A, B) = map(int, input().split())
	if A < B:
		(A, B) = (B, A)
	if A > 1 and B == 1:
		print(A ** 2)
	else:
		x1 = 2 * A
		x2 = 2 * B
		if x2 > A:
			print(x2 ** 2)
		else:
			print(A ** 2)


t = int(input())
for ti in range(t):
	l = input().split()
	(a, b) = (l[0], l[1])
	print(max(min(int(a), int(b)) * 2, max(int(a), int(b))) ** 2)


for i in range(0, int(input())):
	(a, b) = list(map(int, input().split()))
	if a >= b:
		if a <= b + b:
			print((b + b) ** 2)
	if a >= b:
		if a > b + b:
			print(a * a)
	if b > a:
		if a + a >= b:
			print((a + a) ** 2)
		else:
			print(b * b)


def min_square(a, b):
	if a > b:
		(a, b) = (b, a)
	return max(2 * a, b) ** 2
N = int(input())
for i in range(N):
	(a, b) = (int(i) for i in input().split())
	print(min_square(a, b))


n = int(input())
dims = [input().split(' ') for i in range(n)]
dims2 = []
for x in dims:
	dims2.append([int(x[0]), int(x[1])])
for dim in dims2:
	if 2 * min(dim) > max(dim):
		print(4 * min(dim) * min(dim))
	else:
		print(max(dim) ** 2)


import math
t = int(input())
while t > 0:
	(a, b) = map(int, input().split())
	print(int(math.pow(max(a, b, min(a, b) * 2), 2)))
	t -= 1


def minsq(a, b):
	if a == b:
		return 4 * a * b
	res = max(2 * min(a, b), max(a, b))
	return res * res
t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	print(minsq(a, b))


def helper(a, b):
	if a == b:
		print(4 * a * b)
		return
	big = max(a, b)
	small = min(a, b)
	if small * 2 < big:
		print(big * big)
	else:
		print(small * small * 4)
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	helper(a, b)


n = int(input())
for i in range(n):
	(x, y) = map(int, input().split())
	q = min(x, y)
	w = max(y, x)
	if q == w:
		a = 2 * q
	elif 2 * q >= w:
		a = 2 * q
	else:
		a = w
	print(a * a)


t = int(input())
c = []
for i in range(t):
	(a, b) = input().split()
	k = [int(a), int(b)]
	c.append(k)

def max(a, b):
	if a > b:
		return a
	else:
		return b

def min(a, b):
	if a < b:
		return a
	else:
		return b
for i in range(t):
	k = max(c[i][0], c[i][1])
	l = max(k, 2 * min(c[i][0], c[i][1]))
	print(l ** 2)


for t_ in range(int(input())):
	(a, b) = map(int, input().split())
	if a == b:
		print((2 * a) ** 2)
	elif a < b:
		a = 2 * a
		if a < b:
			print(b ** 2)
		else:
			print(a ** 2)
	else:
		(a, b) = (b, a)
		a = 2 * a
		if a < b:
			print(b ** 2)
		else:
			print(a ** 2)


for i in range(int(input())):
	(a, b) = (int(x) for x in input().split())
	l = min(2 * a, 2 * b)
	for i in range(201):
		if i >= l and i >= max(a, b):
			print(i * i)
			break


import sys
t = int(sys.stdin.readline().strip())
for i in range(t):
	(a, b) = list(map(int, sys.stdin.readline().strip().split(' ')))
	if 2 * a < 2 * b:
		c = 2 * a
		l = max(c, b)
		print(l * l)
	else:
		c = 2 * b
		l = max(c, a)
		print(l * l)


import sys
input = sys.stdin.readline
a = int(input())
for _ in range(a):
	(l, w) = map(int, input().split())
	side = max(2 * min(l, w), max(l, w))
	print(side * side)


t = int(input())
for _ in range(t):
	(a, b) = list(map(int, input().split()))
	if a < b:
		(a, b) = (b, a)
	print(max(a, b << 1) ** 2)


t = int(input())
for i in range(0, t):
	s = input().split()
	x = int(s[0])
	y = int(s[1])
	a = max(x, y)
	b = min(x, y)
	if b * 2 < a:
		print(a * a)
	else:
		print(2 * b * (2 * b))


import sys
input = sys.stdin.readline
import heapq
import copy
import math
import decimal
from decimal import *

class Node:

	def _init_(self, val):
		self.data = val
		self.left = None
		self.right = None

class fen_tree:

	def __init__(self, list):
		self.array = [0] + list
		for idx in range(1, len(self.array)):
			idx2 = idx + (idx & -idx)
			if idx2 < len(self.array):
				self.array[idx2] += self.array[idx]

	def prefix_query(self, idx):
		result = 0
		while idx:
			result += self.array[idx]
			idx -= idx & -idx
		return result

	def prints(self):
		print(self.array)
		return

	def range_query(self, from_idx, to_idx):
		return self.prefix_query(to_idx) - self.prefix_query(from_idx - 1)

	def update(self, idx, add):
		while idx < len(self.array):
			self.array[idx] += add
			idx += idx & -idx

def pre_sum(arr):
	p = [0]
	for i in arr:
		p.append(p[-1] + i)
	p.pop(0)
	return p

def pre_back(arr):
	p = [0]
	for i in arr:
		p.append(p[-1] + i)
	p.pop(0)
	return p

def bin_search(arr, l, r, val):
	if arr[r] <= val:
		return r + 1
	if r - l < 2:
		if arr[l] > val:
			return l
		else:
			return r
	mid = int((l + r) / 2)
	if arr[mid] <= val:
		return bin_search(arr, mid, r, val)
	else:
		return bin_search(arr, l, mid, val)

def search_leftmost(arr, val):

	def helper(arr, l, r, val):
		print(l, r)
		if arr[l] == val:
			return l
		if r - l <= 1:
			if arr[r] == val:
				return r
			else:
				print('not found')
				return
		mid = int((r + l) / 2)
		if arr[mid] >= val:
			return helper(arr, l, mid, val)
		else:
			return helper(arr, mid, r, val)
	return helper(arr, 0, len(arr) - 1, val)

def search_rightmost(arr, val):

	def helper(arr, l, r, val):
		print(l, r)
		if arr[r] == val:
			return r
		if r - l <= 1:
			if arr[l] == val:
				return r
			else:
				print('not found')
				return
		mid = int((r + l) / 2)
		if arr[mid] > val:
			return helper(arr, l, mid, val)
		else:
			return helper(arr, mid, r, val)
	return helper(arr, 0, len(arr) - 1, val)

def preorder_postorder(root, paths, parent, left, level):
	l = 0
	queue = [root]
	while queue != []:
		node = queue[-1]
		flag = 0
		for i in paths[node]:
			if i != parent[node] and level[i] == sys.maxsize:
				parent[i] = node
				level[i] = level[node] + 1
				flag = 1
				queue.append(i)
		if flag == 0:
			left[parent[node]] += 1 + left[node]
			queue.pop()
	return [parent, left, level]

def nCr(n, r, p):
	if r == 0:
		return 1
	num = den = 1
	for i in range(r):
		num = num * (n - i) % p
		den = den * (i + 1) % p
	return num * pow(den, p - 2, p) % p

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())

def pr_list(a):
	print(*a, sep=' ')

def main():
	tests = inp()
	mod = 998244353
	limit = 10 ** 18
	for test in range(tests):
		[a, b] = inlt()
		side = min(max(2 * a, b), max(a, 2 * b), a + b)
		print(side * side)
main()


from math import *
n = int(input())
for i in range(n):
	(a, b) = map(int, input().split())
	if a <= 2 * b and a >= b:
		print((2 * b) ** 2)
	elif a * 2 >= b and a <= b:
		print((2 * a) ** 2)
	else:
		print(max(a, b) ** 2)


def minsquare(a, b):
	m = max(min(a, b) * 2, max(a, b))
	return m ** 2
n = int(input())
for n_itr in range(n):
	ab = input().split()
	a = int(ab[0])
	b = int(ab[1])
	res = minsquare(a, b)
	print(res)


for i in range(int(input())):
	(a, b) = map(int, input().split())
	if a < b:
		a = 2 * a
	elif b < a:
		b = 2 * b
	else:
		a = 2 * a
	if a > b:
		print(pow(a, 2))
	else:
		print(pow(b, 2))


import sys
strInp = lambda : input().strip().split()
intInp = lambda : list(map(int, strInp()))
for t in range(int(input())):
	(a, b) = intInp()
	ans = min(a, b) * 2
	if ans >= max(a, b):
		print(ans * ans)
	else:
		print(max(a, b) * max(a, b))


for i in range(int(input())):
	(a, b) = map(int, input().split())
	p = min(a, b)
	q = max(a, b)
	if 2 * p < q:
		print(q ** 2)
	else:
		print((2 * p) ** 2)


n = int(input())
while n > 0:
	(a, b) = map(int, input().split())
	if a > b:
		if 2 * b < a:
			s = pow(a, 2)
		else:
			s = pow(2 * b, 2)
		print(s)
	else:
		if 2 * a < b:
			s = pow(b, 2)
		else:
			s = pow(2 * a, 2)
		print(s)
	n = n - 1


n = int(input(''))
matrix = []
for i in range(n):
	matrix.append(list(map(int, input().split())))
for i in range(n):
	k = matrix[i]
	minn = min(k[0], k[1])
	maxx = max(k[0], k[1])
	if minn == maxx:
		print(4 * minn * maxx)
	elif 2 * minn > maxx:
		print(4 * minn * minn)
	else:
		print(maxx * maxx)


for T in range(int(input())):
	(a, b) = list(map(int, input().split()))
	mn = min(a, b)
	mx = max(a, b)
	if 2 * mn >= mx:
		print((2 * mn) ** 2)
	else:
		print(mx ** 2)


cases = int(input())
for case in range(cases):
	(a, b) = map(int, input().split())
	lado = max(max(a, b), 2 * min(a, b))
	print(lado * lado)


INF = 1 << 60
t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	ans = min(max(2 * b, a), max(2 * a, b)) ** 2
	print(ans)


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	minn = min(a, b)
	maxx = max(a, b)
	x = minn * 2
	while x < maxx:
		x = x + 1
	print(x ** 2)


test = int(input())
for i in range(test):
	l = list(map(int, input().rstrip().split()))
	l.sort(reverse=True)
	if l[0] > l[1] + l[1]:
		print(l[0] ** 2)
	else:
		print((l[1] * 2) ** 2)


testCases = int(input())
for _ in range(testCases):
	(a, b) = map(int, input().split())
	double = 0
	if a <= b:
		double = 2 * a
		if double < b:
			double = b
	else:
		double = 2 * b
		if double < a:
			double = a
	print(double * double)


t = int(input())
while t != 0:
	t -= 1
	(a, b) = [int(x) for x in input().split()]
	print(max(min(a, b) * 2, max(a, b)) ** 2)


q = int(input())
for w in range(q):
	(a, b) = map(int, input().split())
	if a > b:
		(a, b) = (b, a)
	s = min(max(a + b, b), max(2 * a, b))
	print(s * s)


import math
T = int(input())
list2 = []
for _ in range(T):
	(a, b) = map(int, input().split())
	if a < b:
		if 2 * a < b:
			list2.append(b * b)
		elif 2 * a == b:
			list2.append(b * b)
		else:
			list2.append(4 * (a * a))
	elif a == b:
		list2.append(4 * (a * b))
	elif 2 * b < a:
		list2.append(a * a)
	elif 2 * b == a:
		list2.append(a * a)
	else:
		list2.append(4 * (b * b))
print(*list2, sep='\n')


import atexit
import io
import sys
_INPUT_LINES = sys.stdin.read().splitlines()
input = iter(_INPUT_LINES).__next__
_OUTPUT_BUFFER = io.StringIO()
sys.stdout = _OUTPUT_BUFFER

@atexit.register
def write():
	sys.__stdout__.write(_OUTPUT_BUFFER.getvalue())

def min_square(a, b):
	square_side = min([a + a, a + b, b + b])
	square_side = max([square_side, a, b])
	return square_side ** 2
iters = int(input())
for i in range(iters):
	(a, b) = map(int, input().split())
	print(min_square(a, b))


for _ in range(int(input())):
	ab = list(map(int, input().rstrip().split()))[:2]
	ab.sort()
	(a, b) = (ab[1], ab[0])
	x = max(a, b * 2)
	ans = x * x
	print(ans)


from sys import stdin, stdout
input = stdin.readline

def print(x):
	stdout.write(str(x) + '\n')
mod = 10 ** 9 + 7

def solve():
	(a, b) = map(int, input().split())
	(a, b) = (max(a, b), min(a, b))
	minn = 10 ** 9
	if 2 * b < a:
		print(a * a)
	else:
		print(2 * b * 2 * b)
t = 1
t = int(input())
for _ in range(t):
	solve()


def fun(a, b):
	if a < b:
		height = a
	else:
		height = b
	if 2 * height >= max(a, b):
		ans = 4 * height * height
	else:
		ans = max(a, b) * max(a, b)
	return ans
for i in range(int(input())):
	(a, b) = map(int, input().split())
	ans = fun(a, b)
	print(ans)


t = int(input())
for _ in range(t):
	(l, b) = map(int, input().split())
	mi = min(l, b)
	ma = max(l, b)
	mi = mi * 2
	ans = max(mi, ma)
	print(ans * ans)


import sys

def process():
	(a, b) = [int(s) for s in sys.stdin.readline().split()]
	s = max(min(a, b) * 2, max(a, b))
	print(s * s)
T = int(sys.stdin.readline())
for x in range(T):
	process()


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	if a == b:
		a = a + a
		ans = a * a
	elif a > b:
		if 2 * b >= a:
			b = b + b
			ans = b * b
		else:
			ans = a * a
	elif a < b:
		if 2 * a >= b:
			a = a + a
			ans = a * a
		else:
			ans = b * b
	print(ans)


from sys import stdin, stdout, setrecursionlimit
from collections import defaultdict as dt, deque
from bisect import bisect_left as bl, bisect as br
setrecursionlimit(10 ** 6 + 99)

def ii():
	return int(stdin.readline())

def si():
	return stdin.readline().rstrip()

def msi():
	return list(map(str, si().split()))

def mii():
	return list(map(int, si().split()))
for t in range(ii()):
	(a, b) = mii()
	mini = min(a, b)
	maxi = max(a, b)
	if 2 * mini > maxi:
		print((2 * mini) ** 2)
	else:
		print(maxi ** 2)


t = int(input())
list_new = []
for i in range(0, t):
	list1 = [int(i) for i in input().split()]
	a = max(list1)
	b = min(list1)
	if a == b:
		list_new.append((a * 2) ** 2)
	elif a < 2 * b:
		list_new.append((2 * b) ** 2)
	elif a >= 2 * b:
		list_new.append(a ** 2)
for i in list_new:
	print(i)


testcase = int(input())
for i in range(testcase):
	(a, b) = map(int, input().split())
	aa = min(a, b)
	bb = max(a, b)
	if 2 * aa > bb:
		print((2 * aa) ** 2)
	else:
		print(bb ** 2)


def process(a, b):
	(biggest, lowest) = (max(a, b), min(a, b))
	if biggest < lowest * 2:
		biggest += lowest * 2 - biggest
	return biggest ** 2
for _ in range(int(input())):
	print(process(*map(int, input().split())))


n = int(input())
for x in range(n):
	(a, b) = input().split(' ')
	a = int(a)
	b = int(b)
	new_side_val = min(a, b)
	side_one = new_side_val * 2
	side_two = int(max(side_one, max(a, b)))
	min_area = side_two * side_two
	print(min_area)


output_list = []
cases = int(input())
for i in range(cases):
	this_case = [int(x) for x in input().split(' ')]
	square_apatoto_size = min(this_case) * 2
	square_apatoto_size_er_index = this_case.index(min(this_case))
	if square_apatoto_size_er_index == 1:
		posaindex = 0
	else:
		posaindex = 1
	if square_apatoto_size >= this_case[posaindex]:
		output_list.append(square_apatoto_size * square_apatoto_size)
	else:
		output_list.append(this_case[posaindex] * this_case[posaindex])
print('\n'.join((str(x) for x in output_list)))


testCases = int(input())
res = []
while testCases:
	(l, w) = map(int, input().strip().split())
	if l < w and 2 * l > w:
		res.append((2 * l) ** 2)
	elif l < w and 2 * l <= w:
		res.append(w ** 2)
	elif l > w and 2 * w > l:
		res.append((2 * w) ** 2)
	elif l > w and 2 * w <= l:
		res.append(l ** 2)
	else:
		res.append((2 * l) ** 2)
	testCases -= 1
for i in res:
	print(i)


def solve():
	(a, b) = map(int, input().split())
	if a == b:
		print(4 * a ** 2)
	else:
		if a > b:
			(a, b) = (b, a)
		print(max(2 * a, b) ** 2)
t = int(input())
for _ in range(t):
	solve()


import math
test = input()
for i in range(int(test)):
	inp = input().split()
	l = int(inp[0])
	b = int(inp[1])
	m = max(l, b)
	mi = min(l, b)
	inp = [mi + mi, mi + m, m + m]
	for i in inp:
		if i >= m:
			side = i
			break
		elif m >= i:
			side = m
			break
	print(side ** 2)


t = int(input())
for i in range(t):
	(a, b) = [int(y) for y in input().split(' ')]
	ans = int()
	if a < b:
		ans = pow(max(2 * a, b), 2)
	else:
		ans = pow(max(a, 2 * b), 2)
	print(ans)


from __future__ import division, print_function
mod = int(1000000000.0 + 7)
from sys import stdin, stdout
import bisect
from bisect import bisect_left as bl
from bisect import bisect_right as br
import itertools
from collections import Counter
import collections
import math
import heapq
import re

def modinv(n, p):
	return pow(n, p - 2, p)

def cin():
	return map(int, sin().split())

def ain():
	return list(map(int, sin().split()))

def sin():
	return input()

def inin():
	return int(input())

def Divisors(n):
	l = []
	for i in range(1, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n // i == i:
				l.append(i)
			else:
				l.append(i)
				l.append(n // i)
	return l

def most_frequent(list):
	return max(set(list), key=list.count)

def GCD(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def ncr(n, r, p):
	t = fact[n] * (ifact[r] * ifact[n - r] % p) % p
	return t

def Convert(string):
	li = list(string.split(''))
	return li

def SieveOfEratosthenes(n):
	global prime
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	f = []
	for p in range(2, n):
		if prime[p]:
			f.append(p)
	return f
prime = []
q = []

def dfs(n, d, v, c):
	global q
	v[n] = 1
	x = d[n]
	q.append(n)
	j = c
	for i in x:
		if i not in v:
			f = dfs(i, d, v, c + 1)
			j = max(j, f)
	return j

def nextPerfectSquare(N):
	nextN = math.floor(math.sqrt(N)) + 1
	return nextN * nextN

def main():
	for _ in range(inin()):
		a = ain()
		print(pow(max(2 * min(a), sum(a) - min(a)), 2))
py2 = round(0.5)
if py2:
	from future_builtins import ascii, filter, hex, map, oct, zip
	range = xrange
import os, sys
from io import IOBase, BytesIO
BUFSIZE = 8192

class FastIO(BytesIO):
	newlines = 0

	def __init__(self, file):
		self._file = file
		self._fd = file.fileno()
		self.writable = 'x' in file.mode or 'w' in file.mode
		self.write = super(FastIO, self).write if self.writable else None

	def _fill(self):
		s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
		self.seek((self.tell(), self.seek(0, 2), super(FastIO, self).write(s))[0])
		return s

	def read(self):
		while self._fill():
			pass
		return super(FastIO, self).read()

	def readline(self):
		while self.newlines == 0:
			s = self._fill()
			self.newlines = s.count(b'\n') + (not s)
		self.newlines -= 1
		return super(FastIO, self).readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.getvalue())
			(self.truncate(0), self.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		if py2:
			self.write = self.buffer.write
			self.read = self.buffer.read
			self.readline = self.buffer.readline
		else:
			self.write = lambda s: self.buffer.write(s.encode('ascii'))
			self.read = lambda : self.buffer.read().decode('ascii')
			self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


from math import sqrt, ceil
import sys
input = sys.stdin.readline
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	test1 = float('inf')
	if 2 * a >= b:
		test1 = 4 * a ** 2
	else:
		test1 = b ** 2
	test2 = float('inf')
	if 2 * b >= a:
		test2 = 4 * b ** 2
	else:
		test2 = a ** 2
	print(min(test1, test2, (a + b) ** 2))


def area(a, b):
	area = min(max(a * 2, b), max(a, b * 2)) ** 2
	return area
t = int(input())
for i in range(t):
	(a, b) = input().split()
	(a, b) = (int(a), int(b))
	print(area(a, b))


lst = []
for i in range(int(input())):
	(a, b) = map(int, input().split())
	x = 2 * min(a, b)
	y = max(a, b)
	z = max(x, y)
	lst.append(z * z)
for i in lst:
	print(i)


for _ in range(int(input())):
	(m, n) = list(map(int, input().split()))
	if m <= n:
		a = m
		b = n
	else:
		a = n
		b = m
	s = a * 2
	if s >= b:
		print(s ** 2)
	else:
		print(b ** 2)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	aa = max(a, b)
	bb = min(a, b)
	xx = max(aa, 2 * bb)
	print(xx ** 2)


from bisect import bisect_left as bl
from bisect import bisect_right as br
from heapq import heappush, heappop
import math
from collections import *
from functools import reduce, cmp_to_key
import sys
input = sys.stdin.readline
M = mod = 998244353

def factors(n):
	return sorted(set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0))))

def inv_mod(n):
	return pow(n, mod - 2, mod)

def li():
	return [int(i) for i in input().rstrip('\n').split()]

def st():
	return input().rstrip('\n')

def val():
	return int(input().rstrip('\n'))

def li2():
	return [i for i in input().rstrip('\n')]

def li3():
	return [int(i) for i in input().rstrip('\n')]
for _ in range(val()):
	(a, b) = li()
	(a, b) = (min(a, b), max(a, b))
	a1 = max(2 * a, b)
	a2 = a + b
	print(min(a1, a2) ** 2)


t = int(input())
while t != 0:
	(a, b) = map(int, input().split())
	y1 = 4 * a ** 2
	y2 = (a + b) ** 2
	y3 = 4 * b ** 2
	x = 2 * (a * b)
	if 2 * a < b or 2 * b < a:
		l = max(a, b)
		print(l ** 2)
	else:
		A = []
		if y1 >= x:
			A.append(y1)
		if y3 >= x:
			A.append(y3)
		if y2 >= x:
			A.append(y2)
		print(min(A))
	t -= 1


t = int(input())
ans = []
for kek in range(t):
	(a, b) = map(int, input().split())
	x1 = max(2 * a, b)
	x2 = max(2 * b, a)
	ans.append(min(x1, x2) ** 2)
print(*ans, sep='\n')


t = int(input())
for te in range(t):
	l = list(map(int, input().split(' ')))
	x = max(l)
	y = min(l)
	if x >= 2 * y:
		d = x - 2 * y
		print(x * (2 * y + d))
	else:
		print((2 * y) ** 2)


import math
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	z = 0
	if 2 * min(a, b) >= max(a, b):
		z = 2 * min(a, b)
	else:
		z = max(a, b)
	print(z * z)


def square(a, b):
	if a == b:
		return 4 * a ** 2
	return max(min(a, b) * 2, max(a, b)) ** 2
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	print(square(a, b))


from sys import stdin
_input = stdin.readline
(_int, _range, _max, _min) = (int, range, max, min)

def solution():
	for _ in _range(_int(_input())):
		a = [_int(i) for i in _input().split()]
		(l, r) = (_min(a), _max(a))
		if l * 2 > r:
			print(l * 2 * l * 2)
		else:
			print(r * r)
solution()


import sys

def minimal(a, b):
	i = min(a, b)
	side = i * 2
	if side >= max(a, b):
		t = side * side
	elif side < max(a, b):
		side = max(a, b)
		t = side * side
	print(t)
steps = int(input())
msg = sys.stdin.readlines()
for item in msg:
	a = item.split()[0]
	b = item.split()[1]
	a = int(a)
	b = int(b)
	minimal(a, b)


def question_A(a, b):
	(a, b) = sorted([a, b])
	return max(2 * a, b) ** 2
n = int(input())
for i in range(n):
	(a, b) = input().split()
	print(question_A(int(a), int(b)))


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	if a == b:
		length = a * 2
		print(length ** 2)
	elif a < b:
		length = a * 2
		breadth = b
		side = max(length, breadth)
		print(side ** 2)
	else:
		length = b * 2
		breadth = a
		side = max(length, breadth)
		print(side ** 2)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	sides = [2 * a, 2 * b, a + b, a + b]
	sides1 = [b, a, a, b]
	ans = float('inf')
	for i in range(len(sides)):
		j = max(sides[i], sides1[i])
		if ans > j * j:
			ans = j ** 2
	print(ans)


from sys import stdin
for _ in range(int(input())):
	(a, b) = sorted(map(int, stdin.readline().split()))
	print(max(2 * a, b) ** 2)


I = lambda : map(int, input().split())
for i in [0] * int(input()):
	(a, b) = sorted(I())
	s = max(b, a * 2)
	print(s ** 2)


def square(a, b):
	v1 = max(2 * a, b)
	v2 = max(a, 2 * b)
	s = min(v1, v2)
	return s * s
t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	print(square(a, b))


t = int(input())
ans = []
while t:
	(a, b) = map(int, input().split())
	ans.append(min(max(2 * b, a), max(2 * a, b)) ** 2)
	t -= 1
for i in range(len(ans)):
	print(ans[i])


def main():
	(a, b) = list(map(int, input().split()))
	print(max(max(a, b), 2 * min(a, b)) ** 2)
a = int(input())
for i in range(a):
	main()


for _ in range(int(input())):
	(x, y) = map(int, input().split())
	if x == y:
		ans = 2 * x
		fin_ans = ans ** 2
		print(fin_ans)
	elif 2 * x > y and 2 * y <= x:
		ans = x ** 2
		print(ans)
	elif 2 * y > x and 2 * x <= y:
		ans = y ** 2
		print(ans)
	elif 2 * x > y and 2 * y > x:
		p = min(x, y)
		ans = 2 * p
		fin2 = ans ** 2
		print(fin2)


t = int(input())
for i in range(t):
	l = input().split()
	[a, b] = [int(x) for x in l]
	max1 = max(a, b)
	min1 = min(a, b)
	if min1 * 2 >= max1 + 1:
		print((min1 * 2) ** 2)
	else:
		print(max1 ** 2)


for tc in range(int(input())):
	(a, b) = map(int, input().split())
	temp = 2 * min(a, b)
	if temp < max(a, b):
		print(max(a, b) ** 2)
	else:
		print((2 * min(a, b)) ** 2)


t = int(input())
while t:
	t -= 1
	(x, y) = map(int, input().split())
	mn = min(x, y)
	res = mn * 2
	if res >= max(x, y):
		print(res * res)
	else:
		print(max(x, y) * max(x, y))


test_cases = int(input())
for e in range(test_cases):
	(a, b) = map(int, input().split())
	widht = max(2 * a, b)
	height = max(2 * b, a)
	ans = min(widht, height) ** 2
	print(ans)


import sys
from collections import defaultdict
input = sys.stdin.readline

def print_result(l):
	return print(' '.join(map(str, l)))

def timer(function):
	import time

	def wrapper(*args, **kwargs):
		t1 = time.time()
		val = function()
		t2 = time.time()
		print('Executed \\{}\\ in {:.2f} seconds.'.format(function.__name__, t2 - t1))
		return val
	return wrapper

def solve():
	(a, b) = map(int, input().split(' '))
	res = float('inf')
	res = min(res, max(2 * a, b))
	res = min(res, max(2 * b, a))
	print(res ** 2)
t = int(input())
for _ in range(t):
	solve()


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	a1 = min(a, b)
	b1 = max(a, b)
	y = a1 * 2
	if y < b1:
		print(b1 * b1)
	else:
		print(y * y)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	if a > b:
		l = a
		br = b
	else:
		l = b
		br = a
	sbr = br + br
	if sbr > l:
		print(sbr * sbr)
	else:
		print(l * l)


def Min_Area(a, b):
	if a == b:
		print(a * b * 4)
	elif 2 * a <= b or 2 * b <= a:
		print(max(a, b) ** 2)
	else:
		print(4 * min(a, b) ** 2)
t = int(input())
ma = Min_Area
for i in range(t):
	j = 0
	(l, b) = [int(j) for j in input().split(' ')]
	ma(l, b)


t = int(input())
while t > 0:
	(a1, b1) = input().split()
	a = int(a1)
	b = int(b1)
	side = min(max(a * 2, b), max(a, b * 2))
	print(side * side)
	t -= 1


def main():
	n = int(input())
	arrays = []
	for _ in range(n):
		(a, b) = [int(x) for x in input().split()]
		arrays.append((a, b))
	for array in arrays:
		(a, b) = array
		if a == b:
			a = 2 * a
			b = 2 * b
			area = a * b
			print(area)
		elif a > b:
			b = 2 * b
			if b > a:
				diff = b - a
				a += diff
				area = a * b
				print(area)
			elif b < a:
				diff = a - b
				b += diff
				area = a * b
				print(area)
			else:
				area = a * b
				print(area)
		elif a < b:
			a = 2 * a
			if a > b:
				diff = a - b
				b += diff
				area = a * b
				print(area)
			elif a < b:
				diff = b - a
				a += diff
				area = a * b
				print(area)
			else:
				area = a * b
				print(area)
		else:
			pass
main()


for _ in range(int(input())):
	a = list(map(int, input().split()))
	maxim = max(max(a), min(a) * 2)
	print(maxim ** 2)


import sys, math, cmath, time
start_time = time.time()
global tt

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	return input().strip()

def invr():
	return map(int, input().split())

def solve():
	(a, b) = invr()
	print(max(max(a, b), 2 * min(a, b)) ** 2)

def main():
	global tt
	if not ONLINE_JUDGE:
		sys.stdin = open('input.txt', 'r')
		sys.stdout = open('output.txt', 'w')
	t = 1
	t = inp()
	for tt in range(t):
		solve()
	if not ONLINE_JUDGE:
		print('Time Elapsed :', time.time() - start_time, 'seconds')
	sys.stdout.close()

def counter(a):
	q = [0] * max(a)
	for i in range(len(a)):
		q[a[i] - 1] = q[a[i] - 1] + 1
	return q

def string_counter(a):
	q = [0] * 26
	for i in range(len(a)):
		q[ord(a[i]) - 97] = q[ord(a[i]) - 97] + 1
	return q
ONLINE_JUDGE = __debug__
if ONLINE_JUDGE:
	input = sys.stdin.readline
main()


def main():
	for tc in range(int(input())):
		(a, b) = map(int, input().split())
		x = min(max(2 * a, b), max(a, 2 * b))
		print(x * x)
main()


import sys
sys.setrecursionlimit(10 ** 5)
II = lambda : int(sys.stdin.readline())
MI = lambda : map(int, sys.stdin.readline().split())
LI = lambda : list(map(int, sys.stdin.readline().split()))
LLI = lambda rows: [LI() for _ in range(rows)]
for _ in range(II()):
	sides = sorted(MI())
	print(max(sides[0] * 2, sides[1]) ** 2)


T = int(input())
for test in range(T):
	(a, b) = map(int, input().split())
	if max(a, b) / min(a, b) <= 2:
		print((min(a, b) * 2) ** 2)
	else:
		print(max(a, b) ** 2)


import math
for w in range(int(input())):
	a = list(map(int, input().split()))
	if a[0] * 2 + a[1] <= a[1] * 2 + a[1]:
		a[0] = a[0] * 2
		print(a[0] ** 2 if a[0] > a[1] else a[1] ** 2)
	else:
		a[1] = a[1] * 2
		print(a[1] ** 2 if a[1] > a[0] else a[0] ** 2)


T = int(input())
while T != 0:
	(a, b) = map(int, input().split())
	if a > b:
		if b + b >= a:
			ans = (b + b) ** 2
		else:
			ans = a ** 2
	elif b > a:
		if a + a >= b:
			ans = (a + a) ** 2
		else:
			ans = b ** 2
	else:
		ans = (a + b) ** 2
	print(ans)
	T -= 1


t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	l = max(a, 2 * b)
	r = max(2 * a, b)
	print(min(l, r) ** 2)


import sys
from math import sqrt, ceil
input = sys.stdin.buffer.readline

def I():
	return list(map(int, input().split()))

def sieve(n):
	a = [1] * n
	for i in range(2, n):
		if a[i]:
			for j in range(i * i, n, i):
				a[j] = 0
	return a
for __ in range(int(input())):
	(a, b) = I()
	(b, a) = (max(a, b), min(a, b))
	print(max(b, 2 * a) ** 2)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	c = max(2 * a, b)
	d = max(2 * b, a)
	e = min(c, d)
	print(e * e)


a = int(input())
for i in range(a):
	(x, y) = map(int, input().split())
	(x, y) = (min(x, y), max(x, y))
	print(pow(max(2 * x, y), 2))


t = int(input())
for i in range(t):
	lst = list(map(int, input().split()))
	a = lst[0]
	b = lst[1]
	ans = min(max(a + a, b), max(b + b, a))
	print(ans * ans)


import sys
import math
from sys import stdin, stdout

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def get_list():
	return list(map(int, sys.stdin.readline().strip().split()))

def get_string():
	return sys.stdin.readline().strip()

def main():
	for t in range(int(input())):
		(a, b) = get_ints()
		c = 1
		while 1:
			if c * c >= 2 * a * b and c >= 2 * min(a, b) and (c >= max(a, b)):
				break
			c += 1
		print(c * c)
py2 = round(0.5)
if py2:
	from future_builtins import ascii, filter, hex, map, oct, zip
	range = xrange
import os, sys
from io import IOBase, BytesIO
BUFSIZE = 8192

class FastIO(BytesIO):
	newlines = 0

	def __init__(self, file):
		self._file = file
		self._fd = file.fileno()
		self.writable = 'x' in file.mode or 'w' in file.mode
		self.write = super(FastIO, self).write if self.writable else None

	def _fill(self):
		s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
		self.seek((self.tell(), self.seek(0, 2), super(FastIO, self).write(s))[0])
		return s

	def read(self):
		while self._fill():
			pass
		return super(FastIO, self).read()

	def readline(self):
		while self.newlines == 0:
			s = self._fill()
			self.newlines = s.count(b'\n') + (not s)
		self.newlines -= 1
		return super(FastIO, self).readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.getvalue())
			(self.truncate(0), self.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		if py2:
			self.write = self.buffer.write
			self.read = self.buffer.read
			self.readline = self.buffer.readline
		else:
			self.write = lambda s: self.buffer.write(s.encode('ascii'))
			self.read = lambda : self.buffer.read().decode('ascii')
			self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	b1 = min(a, b) * 2
	b2 = max(b1, max(a, b))
	print(b2 * b2)


import sys
try:
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
except:
	pass
input = sys.stdin.readline
for tt in range(int(input())):
	(a, b) = map(int, input().split())
	x = min(a, b)
	y = max(a, b)
	if y <= 2 * x <= 2 * y:
		print((2 * x) ** 2)
	else:
		print(y ** 2)


from sys import stdin, exit
input = stdin.readline

def i():
	return input()

def ii():
	return int(input())

def iis():
	return map(int, input().split())

def liis():
	return list(map(int, input().split()))

def print_array(a):
	print(' '.join(map(str, a)))
t = ii()
for _ in range(t):
	(a, b) = iis()
	(a, b) = (min(a, b), max(a, b))
	ans = max(a * 2, b)
	print(ans ** 2)


t = int(input())
while t:
	sides = list(map(int, input().split()))
	sides.sort()
	if sides[1] > 2 * sides[0]:
		print(sides[1] ** 2)
	else:
		print((2 * sides[0]) ** 2)
	t -= 1


T = int(input())
for t in range(T):
	(A, B) = [int(_) for _ in input().split()]
	(A, B) = (min(A, B), max(A, B))
	s = max(2 * A, B)
	print(s * s)


n = int(input())
for i in range(n):
	(a, b) = map(int, input().split())
	if b > a:
		(a, b) = (b, a)
	z = max(2 * b, a)
	print(z ** 2)


cases = int(input())
for i in range(cases):
	dimensions = [int(x) for x in input().split()]
	dimensions = sorted(dimensions)
	if 2 * dimensions[0] > dimensions[1]:
		print((2 * dimensions[0]) ** 2)
	else:
		print(dimensions[1] ** 2)


from collections import defaultdict as dd
import math
import sys
input = sys.stdin.readline

def nn():
	return int(input())

def li():
	return list(input())

def mi():
	return map(int, input().split())

def lm():
	return list(map(int, input().split()))
q = nn()
for _ in range(q):
	lens = lm()
	lens.sort()
	print(max((2 * lens[0]) ** 2, lens[1] ** 2))


def solve():
	(a, b) = map(int, input().split())
	(m, n) = (min(a, b), max(a, b))
	if m * 2 >= n:
		return (m * 2) ** 2
	else:
		return n ** 2
for _ in range(int(input())):
	print(solve())


def solve(x, y):
	maxs = max(x, y)
	mins = min(x, y)
	if maxs >= 2 * mins:
		return maxs * maxs
	else:
		return 2 * mins * (2 * mins)
for t in range(int(input())):
	(x, y) = map(int, input().split())
	print(solve(x, y))


import sys
inp = [int(x) for x in sys.stdin.read().split()]
ii = 0
ttt = inp[ii]
ii += 1
res = []
for _ in range(ttt):
	(a, b) = inp[ii:ii + 2]
	ii += 2
	res.append(max(2 * min(a, b), max(a, b)) ** 2)
print('\n'.join((str(x) for x in res)))


def solve(a, b):
	return pow(min(max(2 * a, b), max(a, 2 * b)), 2)
t = int(input())
results = list()
for _ in range(0, t):
	(a, b) = map(int, input().split(' '))
	results.append(solve(a, b))
for result in results:
	print(result)


from sys import stdin
import math
a = int(stdin.readline())
for k in range(0, a):
	Q = stdin.readline().split()
	A = int(Q[0])
	B = int(Q[1])
	if A >= B:
		MAX = A
		MIN = B
	else:
		MAX = B
		MIN = A
	MAXXX = max(MAX, 2 * MIN)
	print(MAXXX ** 2)


try:
	import math
	t = int(input())
	while t:
		(a, b) = map(int, input().split())
		c = min(a, b)
		if c + c >= max(a, b):
			print((2 * c) ** 2)
		else:
			print(max(a, b) ** 2)
		t = t - 1
except:
	pass


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	w = max(a, b)
	t = min(a, b)
	side = min(max(w, 2 * t), max(w + t, w), max(2 * w, t), max(t, t + w))
	print(side * side)


from collections import deque
from sys import stdin, stdout
input = stdin.readline
for _ in range(int(input())):
	(b, a) = list(map(int, input().split()))
	print(min(max(a, b * 2), max(a * 2, b)) ** 2)


n = int(input())
for x in range(n):
	A = list(map(int, input().split()))
	s = max(min(A) * 2, max(A))
	print(s ** 2)


q = int(input())
for i in range(q):
	arr = sorted(list(map(int, input().split())))
	mn = min(arr) * 2
	if mn > max(arr):
		print(mn * mn)
	else:
		print(max(arr) ** 2)


def cal_sq(a, b):
	sq = 0
	if a == b:
		sq = 2 * a * (2 * a)
	elif a > b:
		if b <= a // 2:
			sq = a * a
		else:
			sq = 2 * b * (2 * b)
	elif a < b:
		if a <= b // 2:
			sq = b * b
		else:
			sq = 2 * a * (2 * a)
	return sq
T = int(input())
for t in range(T):
	numbers = list(map(int, input().split()))
	(a, b) = (numbers[0], numbers[1])
	ans = cal_sq(a, b)
	print(ans)


n = int(input())
for i in range(n):
	l = list(map(int, input().split()))
	l.sort()
	if l[0] * 2 >= l[1]:
		print((l[0] * 2) ** 2)
	else:
		print(l[1] ** 2)


t = int(input())
for _ in range(t):
	(a, b) = list((int(x) for x in input().split()))
	if a < b:
		(a, b) = (b, a)
	n = max(a, 2 * b)
	print(n * n)


t = int(input())
while t:
	t -= 1
	(a, b) = map(int, input().split())
	first = min(a, b)
	second = max(a, b)
	ans = max(first * 2, second)
	print(ans ** 2)


t = int(input())
while t > 0:
	(a, b) = map(int, input().split())
	if a == b:
		print(4 * a * b)
	elif a > b:
		if 2 * b <= a:
			print(a * a)
		else:
			l = 2 * min(a, b)
			print(l * l)
	elif 2 * a <= b:
		print(b * b)
	else:
		l = 2 * min(a, b)
		print(l * l)
	t = t - 1


def solve():
	(a, b) = map(int, input().split())
	r1 = max(a + b, a, b)
	r2 = max(a + a, b)
	r3 = max(b + b, a)
	print(min(r1, r2, r3) ** 2)
for _ in range(int(input())):
	solve()


for i in range(int(input())):
	(l, b) = map(int, input().split())
	a = l * b * 2
	a1 = (min(l, b) * 2) ** 2
	if a1 < a:
		print(max(l, b) ** 2)
	else:
		print(a1)


for _ in range(int(input())):
	(a, b) = list(map(int, input().split()))
	(x, y, z) = (a + b, max(2 * a, b), max(2 * b, a))
	r = min(x, y, z)
	print(r * r)


import math
t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	l = []
	l.append(2 * a * (2 * a))
	l.append(2 * b * (2 * b))
	l.append(b + a)
	l.append(b * b)
	l.append(a * a)
	l.append(a)
	l.sort()
	if a == b:
		print(l[len(l) - 1])
	else:
		print(l[len(l) - 2])


t = int(input())
for g in range(0, t):
	ab = list(map(int, input().split()))
	a = ab[0]
	b = ab[1]
	if max(a, b) > 2 * min(a, b):
		print(max(a, b) * max(a, b))
	else:
		print(4 * min(a, b) * min(a, b))


import sys

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def get_array():
	return list(map(int, sys.stdin.readline().strip().split()))

def input():
	return sys.stdin.readline().strip()
mod = 10 ** 9 + 7
for _ in range(int(input())):
	(a, b) = get_ints()
	if a < b:
		(a, b) = (b, a)
	mx = max(a, 2 * b)
	print(mx * mx)


t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	small = min(a, b)
	large = max(a, b)
	if large >= 2 * small:
		print(large ** 2)
	else:
		print((small * 2) ** 2)


from math import *
t = int(input())
m = []
n = []
for i in range(t):
	x = list(map(int, input().split()))
	x.sort()
	m.append(x)
for i in range(t):
	k = max(2 * m[i][0], m[i][1])
	print(k ** 2)


a1 = int(input())
for x in range(a1):
	(a, b) = map(int, input().split())
	if a > b:
		maxi = a
		mini = b
	else:
		maxi = b
		mini = a
	if maxi <= mini * 2:
		print((mini * 2) ** 2)
	else:
		print(maxi ** 2)


def rec(a, b) -> int:
	temp_a = min(max(2 * a, b), max(a, 2 * b)) ** 2
	temp_b = max(a + b, a, b) ** 2
	return min(temp_a, temp_b)
t = int(input())
while t > 0:
	t -= 1
	(a, b) = map(int, input().split())
	print(rec(a, b))


t = int(input())
for each_t in range(t):
	(a, b) = input().split()
	(a, b) = (int(a), int(b))
	(a, b) = (max(a, b), min(a, b))
	min_height = b * 2
	if min_height < a:
		print(a * a)
	else:
		print(min_height * min_height)


t = int(input())
(a, b) = ([], [])
for i in range(t):
	(ai, bi) = input().split()
	(ai, bi) = (int(ai), int(bi))
	a.append(ai)
	b.append(bi)
for i in range(t):
	area = 0
	if a[i] > b[i] and a[i] < 2 * b[i]:
		area = (b[i] + b[i]) * (b[i] + b[i])
	elif a[i] > b[i] and a[i] >= 2 * b[i]:
		area = a[i] * a[i]
	elif a[i] < b[i] and b[i] < 2 * a[i]:
		area = (a[i] + a[i]) * (a[i] + a[i])
	elif a[i] < b[i] and b[i] >= 2 * a[i]:
		area = b[i] * b[i]
	else:
		area = (a[i] + b[i]) * (a[i] + b[i])
	print(area)


for t in range(int(input())):
	(l, b) = map(int, input().split())
	m = min(l, b)
	side = max(m + m, max(l, b))
	print(side * side)


import sys

def get_array():
	return list(map(int, sys.stdin.readline().strip().split()))

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def input():
	return sys.stdin.readline().strip()
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	ans = max(max(a, b), 2 * min(a, b))
	print(ans ** 2)


for _ in [*open(0)][1:]:
	(a, b) = map(int, _.split())
	print(max(max(a, b) ** 2, min(a, b) ** 2 * 4))


import sys
import math

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def get_array():
	return list(map(int, sys.stdin.readline().strip().split()))

def printspx(*args):
	return print(*args, end='')

def printsp(*args):
	return print(*args, end=' ')

def printchk(*args):
	return print(*args, end=' \\ ')
MODPRIME = int(1000000000.0 + 7)
BABYMOD = 998244353
for _testcases_ in range(int(input())):
	(a, b) = get_ints()
	ans = max(2 * min(a, b), max(a, b))
	print(ans * ans)


t = int(input())
for T in range(t):
	(a, b) = [int(x) for x in input().split()]
	side = min(max(a + a, b), max(a, b + b))
	print(pow(side, 2))


t = int(input())
p = 0
z = []
for q in range(0, t):
	[a, b] = input().split()
	a = int(a)
	b = int(b)
	z.append([a, b])
for (a, b) in z:
	if a > b:
		s = b * 2
		if s > a:
			p = s ** 2
		elif s < a:
			p = a ** 2
		elif s == a:
			p = a ** 2
	if a < b:
		s = a * 2
		if s > b:
			p = s ** 2
		elif s < b:
			p = b ** 2
		elif s == b:
			p = b ** 2
	if a == b:
		c = a * 2
		p = c ** 2
	print(p)


for lo in range(int(input())):
	(a, b) = map(int, input().split())
	x = max(2 * a, b)
	y = max(2 * b, a)
	mn = min(x, y)
	mn = min(mn, a + b)
	print(mn * mn)


import math
t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	bb = max(a, b)
	aa = min(a, b)
	if 2 * aa >= bb:
		print(4 * aa * aa)
	else:
		print(bb * bb)


t = int(input())
while t != 0:
	(x, y) = map(int, input().split())
	if x < y:
		if 2 * x >= y:
			print((2 * x) ** 2)
		else:
			print(y ** 2)
	elif 2 * y >= x:
		print((2 * y) ** 2)
	else:
		print(x ** 2)
	t = t - 1


t = int(input())
for i in range(t):
	x = list(map(int, input().split()))
	if x[0] > x[1]:
		l = x[0]
		s = x[1]
	else:
		l = x[1]
		s = x[0]
	if 2 * s >= l:
		print((2 * s) ** 2)
	else:
		print(l ** 2)


a = input()
n_inputs = int(a)
entries = []
for i in range(n_inputs):
	d = input()
	(a, b) = d.split()
	entries.append([int(a), int(b)])

def min_square(d):
	return max(max(d[0], d[1]), 2 * min(d[0], d[1])) ** 2
for e in entries:
	print(min_square(e))


from sys import stdin, exit, setrecursionlimit
from collections import deque
setrecursionlimit(10000000)
input = stdin.readline
lmi = lambda : list(map(int, input().split()))
mi = lambda : map(int, input().split())
si = lambda : input().strip('\n')
ssi = lambda : input().strip('\n').split()
for _ in range(int(input())):
	(a, b) = mi()
	x = min(a, b) * 2
	y = max(a, b)
	for i in range(1, 500):
		if i >= x and i >= y:
			print(i * i)
			break


import sys
from collections import deque, defaultdict as dd
from bisect import bisect, bisect_left, bisect_right, insort, insort_left, insort_right
from itertools import permutations
from datetime import datetime
from math import ceil, sqrt, log, gcd

def ii():
	return int(input())

def si():
	return input()

def mi():
	return map(int, input().split())

def li():
	return list(mi())
abc = 'abcdefghijklmnopqrstuvwxyz'
abd = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}
mod = 1000000007
inf = float('inf')
vow = ['a', 'e', 'i', 'o', 'u']
(dx, dy) = ([-1, 1, 0, 0], [0, 0, 1, -1])

def read():
	tc = 0
	if tc:
		input = sys.stdin.readline
	else:
		sys.stdin = open('input1.txt', 'r')
		sys.stdout = open('output1.txt', 'w')

def solve():
	for _ in range(ii()):
		(a, b) = mi()
		x = min(a, b) * 2
		y = max(x, max(a, b))
		print(y * y)
solve()


kl = int(input())
for l in range(kl):
	(a, b) = map(int, input().split())
	t = max(max(a, b), 2 * min(a, b))
	print(t * t)


import sys
f_in = sys.stdin
f_out = sys.stdout
n = int(f_in.readline())
for i in range(n):
	rectangle = f_in.readline().split(' ')
	a = int(rectangle[0])
	b = int(rectangle[1])
	if b > a:
		t = a
		a = b
		b = t
	if a > 2 * b:
		answer = a * a
	else:
		answer = 4 * b * b
	f_out.write(str(answer) + '\n')


n = int(input())
for i in range(0, n):
	(a, b) = map(int, input().split())
	c = min(a, b)
	d = max(a, b)
	c = c * 2
	print(max(c, d) ** 2)


for _ in range(int(input())):
	(a, b) = input().split()
	a = int(a)
	b = int(b)
	if a == b:
		print(4 * a ** 2)
	elif a < b:
		if 2 * a >= b:
			print(4 * a ** 2)
		else:
			print(b ** 2)
	elif b * 2 >= a:
		print(4 * b ** 2)
	else:
		print(a ** 2)


t = int(input())
for qwe in range(t):
	(a, b) = map(int, input().split())
	temp = min(a * 2, b * 2)
	if temp ** 2 < a * b * 2:
		temp = max(a, b)
	print(temp ** 2)


T = int(input())
for _ in range(T):
	(a, b) = map(int, input().split())
	if a > b:
		(a, b) = (b, a)
	side = max(b, 2 * a)
	print(side * side)


for _ in range(int(input())):
	(a, b) = [int(i) for i in input().split()]
	min1 = min([a, b])
	max1 = max([a, b])
	if 2 * min1 >= max1:
		print(2 * min1 * (2 * min1))
	else:
		print(max1 * max1)


n = int(input())
for _ in range(n):
	(x, y) = map(int, input().split())
	if x < y:
		t = y
		y = x
		x = t
	if 2 * y > x:
		print(4 * y * y)
	else:
		print(x * x)


MOD = 1000000007
ii = lambda : int(input())
si = lambda : input()
dgl = lambda : list(map(int, input()))
f = lambda : map(int, input().split())
il = lambda : list(map(int, input().split()))
ls = lambda : list(input())
from collections import *
for _ in range(ii()):
	(a, b) = f()
	if 2 * min(a, b) >= max(a, b):
		print(4 * min(a, b) * min(a, b))
	else:
		print(max(a, b) * max(a, b))


import math
t = int(input())
while t > 0:
	(a, b) = map(int, input().split())
	if a == b:
		z = 2 * a
		print(z ** 2)
	else:
		x = min(a, b)
		y = max(a, b)
		if x * 2 >= y:
			z = 2 * x
			print(z ** 2)
		else:
			print(y ** 2)
	t = t - 1


t = int(input())
res = []
for i in range(t):
	(a, b) = map(int, input().split())
	res.append(min(max(2 * a, b), max(2 * b, a)) ** 2)
for el in res:
	print(el)


t = int(input())
for tc in range(t):
	s = input().split()
	(a, b) = (int(s[0]), int(s[1]))
	mi = min(a, b)
	ma = max(a, b)
	if 2 * mi >= ma:
		va = 2 * mi
		print(va * va)
	else:
		print(ma * ma)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	if a < b:
		s = a
		l = b
	else:
		s = b
		l = a
	if s * 2 > l:
		print((2 * s) ** 2)
	elif s == l:
		print((2 * l) ** 2)
	else:
		print(l ** 2)


for i in range(int(input())):
	(a, b) = map(int, input().split())
	t = [2 * a, b]
	v = [a, 2 * b]
	c = [a + b, b]
	print(min(max(t), max(v), max(c)) ** 2)


for _ in range(int(input())):
	(n, m) = map(int, input().split())
	min1 = min(n, m)
	min1 = min1 * 2
	max1 = max(min1, n, m)
	print(max1 * max1)


t = int(input())
for case in range(t):
	(a, b) = list(map(int, input().split()))
	s = 1000
	s = min(s, a + b)
	if a < b:
		(a, b) = (b, a)
	s = min(s, max(a, b + b))
	print(s * s)


tests = int(input())
for i in range(tests):
	(a, b) = map(int, input().split())
	if b < a:
		if 2 * b >= a:
			ans = (2 * b) ** 2
		else:
			ans = a ** 2
	elif a < b:
		if 2 * a >= b:
			ans = (2 * a) ** 2
		else:
			ans = b ** 2
	else:
		ans = (2 * b) ** 2
	print(ans)


import math
import time
from collections import defaultdict, deque
from sys import stdin, stdout
from bisect import bisect_left, bisect_right
t = 1
t = int(input())
for _ in range(t):
	(a, b) = map(int, stdin.readline().split())
	m = min(max(a, b + b), max(b, a + a))
	print(m * m)


for i in range(int(input())):
	(a, b) = sorted(list(map(int, input().split())))
	print(max(2 * a, b) ** 2)


t = int(input())
while t:
	(a, b) = [int(a) for a in input().split()]
	if a > b:
		tm = a
		a = b
		b = tm
	print(max(a + a, b) ** 2)
	t -= 1


t = int(input())
for i in range(t):
	(n, m) = map(int, input().strip().split())
	min_d = min(n, m)
	a1 = 2 * min_d
	a2 = max(a1, max(n, m))
	ans = a2 * a2
	print(ans)


n = int(input())
for i in range(n):
	l = list(map(int, input().split()))
	if min(l) * 2 > max(l):
		k = min(l) * 2
	else:
		k = max(l)
	print(k * k)


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split(' '))
	sm = min(a, b)
	lg = max(a, b)
	print(pow(max(2 * sm, lg), 2))


from sys import stdin, setrecursionlimit, stdout
from collections import deque
from math import sqrt, floor, ceil, log, log2, log10, pi, gcd, sin, cos, asin

def ii():
	return int(stdin.readline())

def fi():
	return float(stdin.readline())

def mi():
	return map(int, stdin.readline().split())

def fmi():
	return map(float, stdin.readline().split())

def li():
	return list(mi())

def lsi():
	x = list(stdin.readline())
	x.pop()
	return x

def si():
	return stdin.readline().rstrip()
res = ['YES', 'NO']
test_case = ii()
while test_case:
	test_case -= 1
	(a, b) = mi()
	if a > b:
		(a, b) = (b, a)
	print(max(2 * a, b) ** 2)


def solve(a, b):
	tmp = min(2 * a, 2 * b)
	if tmp < max(a, b):
		return max(a, b)
	return tmp

def main():
	t = int(input())
	for i in range(t):
		(a, b) = list(map(int, input().split()))
		c = solve(a, b)
		print(c ** 2)
main()


t = int(input())
for i in range(t):
	(x, y) = map(int, input().split())
	if x < y:
		b = x
		l = y
	else:
		l = x
		b = y
	if 2 * b >= l:
		ans = 2 * b * (2 * b)
	else:
		ans = l * l
	print(ans)


t = int(input())
for i in range(t):
	(a, b) = input().split()
	a = int(a)
	b = int(b)
	x = min(a, b)
	if 2 * x >= a * b / x:
		print(int((2 * x) ** 2))
	else:
		print(int((a * b / x) ** 2))


import math

def fit(a, b, m):
	a_ = max(a, b)
	b_ = min(a, b)
	return 2 * a_ <= m or a_ + b_ <= m or (2 * b_ <= m and a_ <= m)
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	l = 1
	r = 40000
	while l + 1 != r:
		m = (l + r) // 2
		if fit(a, b, m):
			r = m
		else:
			l = m
	print(r ** 2)


import math
n = int(input())
for _ in range(n):
	(l, b) = map(int, input().split())
	(l1, b1) = (l * 2, b)
	(l2, b2) = (l, b * 2)
	x = sorted([l1, b1, l2, b2])
	for i in x:
		if i ** 2 >= 2 * l * b:
			print(i ** 2)
			break


for _ in range(int(input())):
	(A, B) = map(int, input().split())
	if A > B:
		a = A
		b = B
	else:
		a = B
		b = A
	if 2 * b <= a:
		print(a * a)
	else:
		print(4 * b * b)


t = int(input())
count = 0
result = []
while count < t:
	a = input().split()
	b = [int(x) for x in a]
	b = sorted(b)
	if b[0] * 2 >= b[1]:
		result.append((b[0] * 2) ** 2)
	else:
		result.append(b[1] ** 2)
	count += 1
for x in result:
	print(x)


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	l = max(n, k)
	b = min(n, k)
	print(pow(max(l, 2 * b), 2))


t = int(input())
for i in range(t):
	(a, b) = list(map(int, input().split()))
	l = max(a, b)
	w = min(a, b)
	if 2 * w > l:
		print(4 * w * w)
	else:
		print(l * l)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	(a, b) = (max(a, b), min(a, b))
	val = (2 * b) ** 2
	val2 = a ** 2
	if val > val2:
		print(val)
	else:
		print(val2)


from math import *
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	if a == b:
		print((2 * a) ** 2)
	elif a > b:
		if b * 2 > a:
			print((2 * b) ** 2)
		else:
			print(a * a)
	elif a * 2 > b:
		print((2 * a) ** 2)
	else:
		print(b * b)


t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	mi = min(a, b)
	ma = max(a, b)
	print(max(2 * mi, ma) ** 2)


(T, *AB) = map(int, open(0).read().split())
for (a, b) in zip(*[iter(AB)] * 2):
	print(max(min(a, b) * 2, max(a, b)) ** 2)


from sys import stdin
from collections import deque
mod = 10 ** 9 + 7
import sys
import random
from queue import PriorityQueue
from bisect import bisect_right
from bisect import bisect_left
from collections import defaultdict
from math import sqrt, factorial, gcd, log2, inf, ceil
import heapq
input = lambda : sys.stdin.readline().rstrip()
from sys import stdin, stdout
from heapq import heapify, heappush, heappop
from itertools import permutations
from math import factorial as f

def ncr(n, r, p):
	num = den = 1
	for i in range(r):
		num = num * (n - i) % p
		den = den * (i + 1) % p
	return num * pow(den, p - 2, p) % p
import sys
t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	x = min(a, b)
	count = max(2 * x, a, b)
	count = count * count
	print(count)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	mi = min(a, b)
	ma = max(a, b)
	ans = 2 * mi
	if ans < ma:
		ans += ma - ans
	print(ans ** 2)


t = int(input())
out = []
for i in range(t):
	ab = input().split()
	a = int(ab[0])
	b = int(ab[1])
	m = min(a, b)
	n = max(a, b)
	if m * 2 >= n:
		out.append((m * 2) ** 2)
	else:
		out.append(n ** 2)
for i in out:
	print(i)


tests = int(input())
for x in range(tests):
	numbers = input().split(' ')
	a = int(numbers[0])
	b = int(numbers[1])
	if a > b:
		if a > 2 * b:
			print(a * a)
		else:
			print(4 * b * b)
	elif 2 * a > b:
		print(4 * a * a)
	else:
		print(b * b)


import sys
import math
import itertools
import random
from collections import deque

def solve():
	(a, b) = map(int, input().split())
	ans = 1000000009
	ans = min(ans, max(a * 2, b) * max(a * 2, b))
	ans = min(ans, max(a, b * 2) * max(a, b * 2))
	print(ans)
t = int(input())
while t > 0:
	solve()
	t -= 1


import sys

def main():
	res = ''
	input = sys.stdin.readline
	print = sys.stdout.write
	t = int(input())
	for _ in range(t):
		(a, b) = map(int, input().split())
		if a > b:
			(a, b) = (b, a)
		if b > 2 * a:
			sub_res = str(b * b)
		else:
			sub_res = str(4 * a * a)
		res += sub_res + '\n'
	print(res)
main()


t = int(input())
for test in range(t):
	(l, b) = [int(x) for x in input().split()]
	ans = max(min(l, b) * 2, max(l, b))
	print(ans * ans)


n = int(input())
i = 0
output = []
while i < n:
	(a, b) = map(int, input().split())
	if a > b:
		if 2 * b > a:
			output.append((2 * b) ** 2)
		else:
			output.append(a ** 2)
	elif a < b:
		if 2 * a > b:
			output.append((2 * a) ** 2)
		else:
			output.append(b ** 2)
	else:
		output.append(4 * b ** 2)
	i += 1
for x in output:
	print(x)


n = int(input())
A = [0] * 2
for i in range(n):
	A = list(map(int, input().split()))
	print(max(A[1], A[0], min(2 * A[0], 2 * A[1])) ** 2)


import sys
import math
input = sys.stdin.buffer.readline
t = int(input())
for _ in range(t):
	(a, b) = [int(c) for c in input().split()]
	(a, b) = (min(a, b), max(a, b))
	if b > 2 * a:
		ans = b ** 2
	else:
		ans = (a * 2) ** 2
	print(ans)


a = int(input().strip())
s = 0
for i in range(a):
	(m, n) = map(int, input().split())
	s = min(max(m * 2, n), max(m, n * 2))
	print(s * s)


def calcArea(l, b):
	if 2 * b >= l and b <= l:
		return b * b * 4
	elif 2 * l >= b and l < b:
		return l * l * 4
	if l > b:
		return l * l
	return b * b
n = int(input())
for i in range(n):
	(l, b) = list((int(x) for x in input().strip().split()))[:2]
	print(calcArea(l, b))


def MinimalSquare(a, b):
	if a > b:
		b *= 2
	else:
		a *= 2
	if a > b:
		return a ** 2
	else:
		return b ** 2
Lista = []
total = int(input())
for i in range(total):
	All = [int(i) for i in input().split()]
	Lista.append(All)
for j in Lista:
	print(MinimalSquare(j[0], j[1]))


t = int(input())
answer = []
for a in range(t):
	line1 = [int(i) for i in input().split()]
	a = line1[0]
	b = line1[1]
	answer.append(str(min(max(2 * b, a), max(2 * a, b)) ** 2))
for b in answer:
	print(b)


t = int(input())
while t:
	(a, b) = map(int, input().split())
	if a == b:
		print(4 * a * b)
	else:
		x = min(a, b)
		y = max(a, b)
		if y <= 2 * x:
			print(4 * x * x)
		else:
			print(y * y)
	t = t - 1


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	if a > b:
		n1 = max(a, 2 * b)
		area1 = n1 * n1
		print(area1)
	else:
		n2 = max(b, 2 * a)
		area2 = n2 * n2
		print(area2)


t = int(input())
for _ in range(t):
	l = list(map(int, input().split()))
	l.sort()
	a = l[0]
	b = l[1]
	if 2 * a >= b:
		print((2 * a) ** 2)
	else:
		print(b ** 2)


from collections import Counter
import sys
sys.setrecursionlimit(10 ** 6)
mod = 1000000007
inf = int(1e+18)
dx = [0, 1, 0, -1]
dy = [1, 0, -1, 0]

def inverse(a):
	return pow(a, mod - 2, mod)

def usearch(x, a):
	lft = 0
	rgt = len(a) + 1
	while rgt - lft > 1:
		mid = (rgt + lft) // 2
		if a[mid] <= x:
			lft = mid
		else:
			rgt = mid
	return lft

def solve():
	(a, b) = map(int, input().split())
	ans = max(min(a, b) + min(a, b), a, b)
	print(ans * ans)

def main():
	n = int(input())
	for i in range(n):
		solve()
main()


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	if a > b:
		(a, b) = (b, a)
	a *= 2
	ans = max(a, b) ** 2
	print(ans)


T = int(input())
for _ in range(T):
	(A, B) = map(int, input().split())
	print(max(min(A, B) * 2, max(A, B)) ** 2)


import sys
import os
import time
import collections
from collections import Counter, deque
import itertools
import math
import timeit
import random
import string

def sieve(n):
	if n < 2:
		return list()
	prime = [True for _ in range(n + 1)]
	p = 3
	while p * p <= n:
		if prime[p]:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 2
	r = [2]
	for p in range(3, n + 1, 2):
		if prime[p]:
			r.append(p)
	return r

def divs(n, start=1):
	divisors = []
	for i in range(start, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n / i == i:
				divisors.append(i)
			else:
				divisors.extend([i, n // i])
	return divisors

def divn(n, primes):
	divs_number = 1
	for i in primes:
		if n == 1:
			return divs_number
		t = 1
		while n % i == 0:
			t += 1
			n //= i
		divs_number *= t

def flin(d, x, default=-1):
	left = right = -1
	for i in range(len(d)):
		if d[i] == x:
			if left == -1:
				left = i
			right = i
	if left == -1:
		return (default, default)
	else:
		return (left, right)

def ceil(n, k):
	return n // k + (n % k != 0)

def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return list(map(int, input().split()))

def lcm(a, b):
	return abs(a * b) // math.gcd(a, b)

def prr(a, sep=' ', end='\n'):
	print(sep.join(map(str, a)), end=end)

def dd():
	return collections.defaultdict(int)

def ddl():
	return collections.defaultdict(list)
for _ in range(ii()):
	(a, b) = sorted(mi())
	print(max((2 * a) ** 2, b * b))


n = int(input())
for i in range(n):
	(a, b) = [int(i) for i in input().split(' ')]
	if a > b:
		if 2 * b > a:
			mina = 2 * b
		else:
			mina = a
	elif 2 * a > b:
		mina = 2 * a
	else:
		mina = b
	print(mina ** 2)


import math
t = int(input())
while t > 0:
	(a, b) = [int(x) for x in input().split()]
	if 2 * min(a, b) >= max(a, b):
		print((2 * min(a, b)) ** 2)
	else:
		print(max(a, b) ** 2)
	t -= 1


t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	Min = min(a, b)
	Max = max(a, b)
	ans = max(Max, 2 * Min)
	print(ans ** 2)


testcase = int(input())
for t in range(1, testcase + 1):
	(a, b) = map(int, input().split(' '))
	(big, small) = (a, b) if a > b else (b, a)
	if (small * 2) ** 2 > big ** 2:
		print((small * 2) ** 2)
	else:
		print(big ** 2)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	if a == b:
		tmp = a + a
		tmp = tmp ** 2
		print(tmp)
	elif a < b:
		tmp = a + a
		newTmp = max(b, tmp)
		print(newTmp ** 2)
	else:
		tmp = b + b
		newTmp = max(a, tmp)
		print(newTmp ** 2)


cnt = 1
p = 0
r = []

def init(a):
	for p in range(len(a)):
		a[p] = int(a[p])
	return a
t = int(input())
for i in range(t):
	d = input().split()
	d = init(d)
	if 2 * int(min(d)) >= int(max(d)):
		r.append((2 * int(min(d))) ** 2)
	elif 2 * int(min(d)) <= int(max(d)):
		r.append(int(max(d)) ** 2)
for j in range(t):
	print(r[j])


def solve():
	t = int(input())
	for i in range(t):
		(a, b) = sorted([int(s) for s in input().split()])
		ans = max(a * 2, b)
		print(ans * ans)
solve()


from math import sqrt
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	x = 2 * min(a, b)
	y = max(a, b)
	ans1 = max(x, y) ** 2
	ans2 = (a + b) ** 2
	ans = min(ans1, ans2)
	print(ans)


for num in range(int(input())):
	(a, b) = map(int, input().split())
	x = a * b
	if a <= b and b <= a * 2:
		print((a * 2) ** 2)
	elif a >= b and a <= b * 2:
		print((b * 2) ** 2)
	else:
		print(int(max([a, b]) ** 2))


import sys
import collections as cc
I = lambda : list(map(int, input().split()))
for tc in range(int(input())):
	(a, b) = I()
	x = [a, 2 * b]
	y = [2 * a, b]
	a = max(x)
	b = max(y)
	print(min(a, b) ** 2)


import sys
input = sys.stdin.readline
tc = int(input())
for _ in range(tc):
	(a, b) = list(map(int, input().split()))
	tmp = min(a, b) * 2
	if tmp < max(a, b):
		tmp += max(a, b) - tmp
	print(pow(tmp, 2))


from pprint import pprint
import sys
input = sys.stdin.readline
q = int(input())
for _ in range(q):
	(a, b) = map(int, input().split())
	(a, b) = (min(a, b), max(a, b))
	x = a * 2
	x = b if x < b else x
	print(x ** 2)


def solve():
	(a, b) = [int(i) for i in input().split()]
	return max(max(a, b), min(a, b) * 2) ** 2
t = int(input())
ans = []
while t:
	ans.append(str(solve()))
	t -= 1
print('\n'.join(ans))


x = int(input())
for i in range(x):
	(a, b) = map(int, input().split())
	c = min(a, b)
	area = 2 * c
	if 2 * c > max(a, b):
		area = 2 * c
	else:
		while area < max(a, b):
			area = area + 1
	print(area * area)


a = input()
for i in range(int(a)):
	s = input()
	v = [int(i) for i in s.split(' ')]
	ans = max(max(v), 2 * min(v))
	print(ans * ans)


n = int(input())
for _ in range(n):
	lst = list(map(int, input().split()))
	(a, b) = (lst[0], lst[1])
	answer = min(max(2 * b, a), max(2 * a, b)) ** 2
	print(answer)


def solve(x, y):
	if x >= y:
		(a, b) = (y, x)
	else:
		(a, b) = (x, y)
	return max(2 * a, b) ** 2
t = int(input())
for _ in range(t):
	inp = input().split()
	(a, b) = (int(inp[0]), int(inp[1]))
	print(solve(a, b))


t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	lado = min(a, b) * 2
	if lado < max(a, b):
		lado = max(a, b)
	area = lado ** 2
	print(area)


import sys
input = iter(sys.stdin.read().splitlines()).__next__
sys.setrecursionlimit(10000)
TC = int(input())
for tc in range(TC):
	(a, b) = list(map(int, input().split()))
	s = min(max(a + a, b), max(b + b, a), a + b)
	print(s * s)


import sys
import math
import heapq
import collections

def inputnum():
	return int(input())

def inputnums():
	return map(int, input().split())

def inputlist():
	return list(map(int, input().split()))

def inputstring():
	return [x for x in input()]
t = int(input())
for q in range(t):
	(a, b) = inputnums()
	side = max(max(a, b), 2 * min(a, b))
	print(side * side)


t = int(input())
while t:
	(a, b) = map(int, input().split())
	c = min(a, b)
	d = max(a, b)
	if c * 2 > d:
		result = c * 2
	else:
		result = d
	print(result ** 2)
	t -= 1


import math

def showarea(m, n):
	s = min(max(2 * b, a), max(2 * a, b))
	return s * s
t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	print(showarea(a, b))


t = int(input())
while t > 0:
	(a, b) = [int(x) for x in input().split()]
	if a < b:
		(a, b) = (b, a)
	if a <= 2 * b:
		print((2 * b) ** 2)
	else:
		print(a ** 2)
	t = t - 1


from math import *
t = int(input())
for loop in range(t):
	(a, b) = map(int, input().split())
	r = sqrt(a * b * 2)
	if r % 1 != 0:
		r += 1
	r = int(r)
	while True:
		if r >= a * 2 and r >= b or (r >= a and r >= b * 2):
			break
		r += 1
	print(int(r) ** 2)


n = int(input())
for i in range(n):
	(dlin, shir) = list(map(int, input().split()))
	(dlin, shir) = (max(dlin, shir), min(dlin, shir))
	stor_kvad = max(shir * 2, dlin)
	s = stor_kvad ** 2
	print(s)


import math
for i in range(int(input())):
	(a, b) = map(int, input().split(' '))
	if a == b:
		res = a + b
		print(int(res * res))
	else:
		max1 = max(a, b)
		min1 = min(a, b)
		res1 = math.ceil(max1 / 2)
		if res1 <= min1:
			res = 2 * min1
			print(res * res)
		else:
			print(max1 * max1)


for t in range(int(input())):
	inp = list(map(int, input().split()))
	mn = min(inp)
	mx = max(inp)
	if mn * 2 >= mx:
		print((mn * 2) ** 2)
	else:
		print(mx ** 2)


t = int(input())
for _ in range(t):
	(a, b) = [int(x) for x in input().split()]
	if a > b:
		(a, b) = (b, a)
	x = b
	y = 2 * a
	if x > y:
		print(x * x)
	else:
		print(y * y)


def minimal_square(a, b):
	if a < b:
		if a * 2 >= b:
			x = (a * 2) ** 2
		else:
			x = b * b
	elif b * 2 >= a:
		x = (b * 2) ** 2
	else:
		x = a * a
	return x
t = input()
a = []
b = []
output = []
for i in range(0, int(t)):
	(p, q) = input().split()
	a.append(p)
	b.append(q)
for i in range(0, int(t)):
	print(minimal_square(int(a[i]), int(b[i])))


import sys
t = int(sys.stdin.readline())
for _ in range(t):
	(a, b) = list(map(int, sys.stdin.readline().split()))
	opt = (a + b) ** 2
	if (a + a) ** 2 >= 2 * (a * b):
		if (a + a) ** 2 < opt:
			opt = (a + a) ** 2
	if (b + b) ** 2 >= 2 * (a * b):
		if (b + b) ** 2 < opt:
			opt = (b + b) ** 2
	if a ** 2 > 2 * (a * b):
		if a ** 2 < opt:
			opt = a ** 2
	if b ** 2 > 2 * (a * b):
		if b ** 2 < opt:
			opt = b ** 2
	print(opt)


for _ in range(int(input())):
	l = sorted(map(int, input().split()))
	print(4 * l[0] * l[0] if l[1] < 2 * l[0] else l[1] * l[1])


import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	x = min(a, b)
	y = max(a, b)
	if 2 * x >= y:
		x *= 2
		print(x * x)
	else:
		print(y * y)


t = int(input())
for i in range(t):
	(a, b) = [int(x) for x in input().split()]
	x = min(a, b)
	y = max(a, b)
	print(min(max(2 * x, y), max(x + y, y)) ** 2, end='\n')


from math import ceil

def read_int():
	return int(input())

def read_string_array():
	for s in input().split():
		yield s

def read_int_array():
	for s in read_string_array():
		yield int(s)

def read_line():
	return input()

def solve(a, b):
	if min(a, b) ** 2 > a * b * 2:
		return min(a, b) ** 2
	elif min(a, b) ** 2 * 4 > a * b * 2:
		return min(a, b) ** 2 * 4
	return max(a, b) ** 2
T = read_int()
for _ in range(T):
	(A, B) = read_int_array()
	print(solve(A, B))


def solve(aa, bb):
	ans = 0
	a = max(aa, bb)
	b = min(aa, bb)
	if a - 2 * b > 0:
		ans = a * a
	elif a == 2 * b:
		ans = a * a
	elif a - 2 * b < 0:
		ans = 4 * b * b
	print(ans)
for i in range(int(input())):
	(n, x) = map(int, input().split())
	solve(n, x)


t = int(input())
for i in range(t):
	ch = input()
	L = [int(i) for i in ch.split()]
	cote1 = min(L)
	cote2 = L[0] + L[1] - cote1
	if 2 * cote1 < cote2:
		print(cote2 ** 2)
	else:
		print((2 * cote1) ** 2)


t = int(input())
result = []
for i in range(t):
	v = [int(x) for x in input().split(' ')]
	if v[0] < v[1]:
		tmp = v[0]
		v[0] = v[1]
		v[1] = tmp
	canh = max(2 * v[1], v[0])
	result.append(canh * canh)
for i in result:
	print(i)


t = int(input())
for i in range(t):
	(x, y) = list(map(int, input().split()))
	z = min(x, y)
	m = max(x, y)
	if m >= 2 * z:
		print(m ** 2)
	else:
		print(4 * z ** 2)


for i in range(int(input())):
	(a, b) = map(int, input().split())
	mini = min(2 * a, 2 * b)
	maxi = max(a, b)
	print(pow(max(mini, maxi), 2))


import sys
import math
from collections import Counter
t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	print(min(max(a, 2 * b), max(b, 2 * a)) ** 2)


t = int(input())
import math
for i in range(t):
	(a, b) = map(int, input().strip().split())
	r = max(a, b)
	p = min(a, b)
	if 2 * p >= r:
		print(pow(2 * p, 2))
	else:
		print(r * r)


import sys
lines = sys.stdin.readlines()
T = int(lines[0].strip())
for t in range(T):
	(a, b) = map(int, lines[t + 1].strip().split(' '))
	print(max(2 * min(a, b), max(a, b)) ** 2)


answer = []
for j in range(int(input())):
	(a, b) = map(int, input().split())
	storona = max(a, b)
	if 2 * min(a, b) <= storona:
		answer.append(storona ** 2)
	else:
		answer.append((2 * min(a, b)) ** 2)
for j in answer:
	print(j)


T = int(input())
for t in range(0, T):
	(a, b) = map(int, input().split())
	if a == b:
		print(2 * a * 2 * b)
	else:
		s1 = max(2 * a, b)
		s2 = max(2 * b, a)
		s = min(s1, s2)
		print(s ** 2)


t = int(input())
for _ in range(t):
	(a, b) = list(map(int, input().split()))
	p = min(a, b)
	q = max(a, b)
	if q >= 2 * p:
		print(q * q)
	else:
		print(4 * p * p)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	if a < b:
		a += b
		b = a - b
		a = a - b
	l = max(a, b + b)
	print(l ** 2)


test = int(input())
for tes in range(test):
	(n, m) = list(map(int, input().split()))
	if 2 * min(n, m) >= max(n, m):
		print(4 * min(n, m) ** 2)
	else:
		print(max(n, m) ** 2)


rw = int(input())
for ewqr in range(rw):
	(a, b) = map(int, input().split())
	print(max((min(a, b) * 2) ** 2, max(a, b) ** 2))


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	if a == b:
		print(4 * a * b)
	elif a == b / 2 or b == a / 2:
		print(int(2 * a * b))
	else:
		mx = max(a, b)
		mi = min(a, b)
		x = mx / 2
		y = 2 * mi
		if x < mi:
			print(int(2 * y * mi))
		elif y < mx:
			print(int(2 * x * mx))


def solve():
	(a, b) = map(int, input().split())
	answer = max(2 * min(a, b), max(a, b)) ** 2
	return answer
t = int(input())
for case in range(t):
	print(solve())


def to_list(s):
	return list(map(lambda x: int(x), s.split(' ')))

def solve(a, b):
	if a == b:
		return str((2 * a) ** 2)
	if a > b:
		if a > 2 * b:
			return str(a ** 2)
		else:
			return str((2 * b) ** 2)
	if b > a:
		if b > 2 * a:
			return str(b ** 2)
		else:
			return str((2 * a) ** 2)
answers = []
t = int(input())
for i in range(t):
	(a, b) = to_list(input())
	answers.append(solve(a, b))
print('\n'.join(answers))


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	if a > b:
		(a, b) = (b, a)
	s = 2 * a
	if s > b:
		print(s ** 2)
		continue
	s = b
	print(s ** 2)


t = int(input())
for g in range(t):
	(n, m) = map(int, input().split())
	x = max(n, m)
	y = min(n, m)
	if x == y:
		print(4 * x * x)
	elif y <= x // 2:
		print(x * x)
	else:
		print(4 * y * y)


t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	m_a = min(a, b)
	m_b = max(a, b)
	if m_b <= 2 * m_a:
		print(pow(2 * m_a, 2))
	else:
		print(pow(m_b, 2))


def main():
	(a, b) = map(int, input().split())
	mx = max(a, b)
	mn = min(a, b)
	print(max(mx, 2 * mn) ** 2)
	return

def test():
	t = int(input())
	while t:
		main()
		t -= 1
test()


t = int(input())
for _ in range(t):
	(a, b) = list(map(int, input().split()))
	if a < b:
		temp = b
		b = a
		a = temp
	if 2 * b > a:
		print(2 * b * (2 * b))
	else:
		print(a * a)


import sys

def min_square(*inp):
	min_num = min(inp[0], inp[1])
	max_num = max(inp[0], inp[1])
	double_min = min_num * 2
	side = max(double_min, max_num)
	return side ** 2

def main():
	output = ''
	no_of_test_cases = int(input())
	for i in range(no_of_test_cases):
		case_input = input()
		sq = min_square(*[int(ele) for ele in str(case_input).split(' ')])
		output += str(sq) + '\n'
	return output
print(main())


t = int(input())
for tes in range(t):
	(a, b) = map(int, input().split())
	ans = 0
	if 2 * b >= a:
		ans = 2 * b * (2 * b)
	else:
		ans = a * a
	if 2 * a >= b:
		ans = min(ans, 4 * a * a)
	else:
		ans = min(ans, b * b)
	print(ans)


for u in range(int(input())):
	(n, m) = map(int, input().split())
	if n < m:
		(n, m) = (m, n)
	p = max(n, m * 2)
	print(p * p)


import sys
t = sys.stdin.readline()
for i in range(int(t)):
	l = sys.stdin.readline().split()
	(a, b) = (min(int(l[0]), int(l[1])), max(int(l[0]), int(l[1])))
	m = min(max(2 * a, b), a + b) ** 2
	sys.stdout.write(str(m) + '\n')


t = int(input())
side = []
while t > 0:
	(a, b) = map(int, input().split())
	side.append(min(max(a * 2, b), max(a, b * 2)))
	t -= 1
for i in side:
	print(i * i)


import sys
lines = []
for line in sys.stdin:
	if 'Exit' == line.rstrip():
		break
	lines.append(line)
n = int(lines[0])
for i in range(1, n + 1):
	(a, b) = ([int(x) for x in lines[i].split(' ')][0], [int(x) for x in lines[i].split(' ')][1])
	if a + a >= b > a:
		print(4 * (a * a))
	elif b + b >= a > b:
		print(4 * (b * b))
	elif a == b:
		print(4 * (a * b))
	elif b > a:
		print(b ** 2)
	elif a > b:
		print(a ** 2)


def solve():
	(a, b) = [int(i) for i in input().split()]
	s = min(a, b)
	ans = max((a + b - s) ** 2, (s + s) ** 2)
	print(ans)
test = int(input())
for i in range(test):
	solve()


t = int(input())
for _ in range(t):
	(x, y) = map(int, input().split())
	ans = min(max(x, 2 * y) * max(x, 2 * y), max(y, 2 * x) * max(y, 2 * x))
	print(ans)


t = int(input())
output = []
for i in range(t):
	(a, b) = map(int, input().split())
	if a > b:
		(a, b) = (b, a)
	temp = max(2 * a, b)
	output.append(temp * temp)
for i in output:
	print(i)


for _ in range(int(input())):
	s = list(map(int, input().split()))
	ans1 = (min(s) * 2) ** 2
	if max(s) ** 2 > ans1:
		print(max(s) ** 2)
	else:
		print(ans1)


import math
import sys
import collections
from collections import defaultdict
sys.setrecursionlimit(10 ** 9)
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	temp = 2 * min(a, b)
	if temp < max(a, b):
		print(max(a, b) ** 2)
	elif temp >= max(a, b):
		print(temp ** 2)


def main():
	import sys
	input = sys.stdin.readline
	sys.setrecursionlimit(10 ** 7)
	from collections import Counter, deque
	from itertools import combinations, permutations, accumulate, groupby, product
	from bisect import bisect_left, bisect_right
	from heapq import heapify, heappop, heappush
	import math
	t = int(input())
	for _ in range(t):
		(a, b) = map(int, input().split())
		if a >= b:
			if a > b * 2:
				print(a ** 2)
			else:
				print((b * 2) ** 2)
		elif b > a * 2:
			print(b ** 2)
		else:
			print((a * 2) ** 2)
main()


t = input()
t = int(t)
shetchikshetchikov = 0
while shetchikshetchikov < t:
	(n, k) = input().split()
	n = int(n)
	k = int(k)
	if n > k:
		if n > k * 2:
			print(n * n)
		else:
			print(k * 2 * (k * 2))
	elif k > n * 2:
		print(k * k)
	else:
		print(n * 2 * (n * 2))
	shetchikshetchikov = shetchikshetchikov + 1


from math import ceil, sqrt

def solve():
	(a, b) = [int(i) for i in input().split()]
	if a > b:
		(a, b) = (b, a)
	if 2 * a >= b:
		ans = 2 * a
	else:
		ans = b
	print(ans * ans)

def main():
	n = int(input())
	for i in range(n):
		solve()
main()


case = int(input())
res = []
for i in range(case):
	arr = list(map(int, input().split()))
	if arr[0] > arr[1]:
		temp = arr[0]
		arr[0] = arr[1]
		arr[1] = temp
	a = arr[0]
	b = arr[1]
	if a == b:
		res.append(a * a * 4)
	elif 2 * a <= b:
		res.append(b * b)
	else:
		res.append(2 * a * (2 * a))
for i in res:
	print(i)


def calc(a, b):
	smallest = min(a, b)
	largest = max(a, b)
	if smallest * 2 >= largest:
		return (smallest * 2) ** 2
	elif largest >= 2 * smallest:
		return largest ** 2
	else:
		return (largest * 2) ** 2
t = int(input())
for i in range(0, t):
	(a, b) = map(int, input().split(' '))
	print(calc(a, b))


its = int(input())
square_dims = []
for x in range(its):
	dim = [int(x) for x in input().split()]
	if min(dim) * 2 < max(dim):
		square_dims.append(max(dim) ** 2)
	else:
		square_dims.append((2 * min(dim)) ** 2)
for x in square_dims:
	print(x)


t = int(input())
for i in range(t):
	(m, n) = map(int, input().split())
	a = min(m, n)
	b = max(m, n)
	comp1 = 2 * a
	if comp1 >= b:
		print(comp1 * comp1)
	else:
		print(b * b)


def main():
	import sys
	sys.setrecursionlimit(10 ** 6)
	input = sys.stdin.readline
	T = int(input())
	for t in range(T):
		(a, b) = [int(x) for x in input().strip().split()]
		if a < b:
			(a, b) = (b, a)
		if 2 * b >= a:
			print((2 * b) ** 2)
		else:
			print(a ** 2)
main()


from sys import stdin, stdout
t = int(input())
for _ in range(t):
	nums = list(map(int, stdin.readline().strip().split()))
	(a, b) = nums
	if a == b:
		print(4 * a ** 2)
		continue
	mx = max(a, b)
	mi = min(a, b)
	if 2 * mi <= mx:
		print(mx ** 2)
		continue
	else:
		print((mi * 2) ** 2)


def main(a, b):
	z = min(a, b)
	b = max(a, b)
	a = z
	if a == b:
		return 4 * a * a
	if 2 * a >= b:
		return 2 * 2 * a * a
	return b * b
n = int(input())
for i in range(n):
	(a, b) = list(map(int, input().split(' ')))
	print(main(a, b))


t = int(input())
for i in range(t):
	(a, b) = list(map(int, input().split()))
	s1 = min(a, b)
	s2 = max(a, b)
	print(max(s2, 2 * s1) ** 2)


t = int(input())
while t:
	t -= 1
	(a, b) = map(int, input().split())
	if a < b:
		(a, b) = (b, a)
	if a == b:
		print((2 * a) ** 2)
	elif a == 2 * b:
		print(4 * b * b)
	elif a > 2 * b:
		print(a * a)
	else:
		print(4 * b * b)


def solve():
	(a, b) = list(map(int, input().split()))
	if a < b:
		(a, b) = (b, a)
	if a > b * 2:
		print(a * a)
	else:
		print(4 * b * b)
t = int(input())
for test in range(t):
	solve()


class Solution:

	def __init__(self):
		test = int(input())
		for i in range(0, test):
			(a, b) = list(map(int, input().split()))
			self.solve(a, b)

	def solve(self, a, b):
		if a > b:
			(a, b) = (b, a)
		res = a + b
		if 2 * a >= b and 2 * a <= 2 * b:
			res = min(res, 2 * a)
		else:
			res = min(res, b)
		print(res ** 2)
Solution()


for i in range(int(input())):
	arr = sorted(map(int, input().split(' ')))
	arr.reverse()
	if arr[0] == arr[1]:
		print(4 * arr[0] * arr[0])
	elif 2 * arr[1] >= arr[0]:
		print(4 * arr[1] * arr[1])
	else:
		print(arr[0] * arr[0])


import sys

def main():
	(a, b) = map(int, input().split())
	if a < b:
		(a, b) = (b, a)
	print(max(4 * b * b, a * a))
input = sys.stdin.readline
tn = int(input())
for _ in range(tn):
	main()


def inp_n():
	return int(input())

def inp_list():
	return list(map(int, input().split()))

def inp_mul_num():
	return map(int, input().split())

def is_odd(n):
	if n & 1:
		return True
	return False
from collections import defaultdict
import math
for _ in range(inp_n()):
	(a, b) = inp_mul_num()
	if a < b:
		(a, b) = (b, a)
	if a == b:
		print((a + b) ** 2)
	elif a < 2 * b:
		print((b * 2) ** 2)
	else:
		print(a ** 2)


import sys
input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return list(map(int, input().split()))
t = inp()
for i in range(t):
	arr = inlt()
	print(max(max(arr), min(arr) * 2) ** 2)


t = int(input())
while t:
	t = t - 1
	(a, b) = map(int, input().split())
	if a == b:
		print((a * 2) ** 2)
		continue
	elif min(a, b) * 2 <= max(a, b):
		print(max(a, b) ** 2)
		continue
	else:
		print((min(a, b) * 2) ** 2)
		continue


for _ in range(0, int(input())):
	ab = list(map(int, input().split()))
	a = ab[0]
	b = ab[1]
	if b > a:
		temp = a
		a = b
		b = temp
	if 2 * b > a:
		print(4 * b * b)
	else:
		print(a * a)


import sys

def compute_min_area(a: int, b: int) -> int:
	return max(min(a, b) * 2, max(a, b)) ** 2
for line in sys.stdin:
	if ' ' in line:
		(a, b) = tuple(map(int, line.split(' ')))
		print(compute_min_area(a, b))


t = int(input())
for testcase in range(t):
	(a, b) = map(int, input().split())
	w = min(a, b) * 2
	l = max(a, b)
	squareLength = max(w, l)
	area = squareLength ** 2
	print(area)


import sys
from collections import defaultdict as dd
import heapq
import math
try:
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
except:
	pass
input = sys.stdin.readline
for i in range(int(input())):
	(a, b) = map(int, input().split())
	print(max(max(a, b), 2 * min(a, b)) ** 2)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	W = min(a, b)
	L = max(a, b)
	W = W * 2
	if W >= L:
		print(W * W)
	else:
		print(L * L)


t = int(input())
for i in range(0, t):
	(a, b) = map(int, input().strip().split())
	l = [a, b]
	z = l.index(min(l))
	l[z] = 2 * l[z]
	p = max(l) ** 2
	print(p)


n = int(input())
l = []
res = []
for i in range(0, n):
	li = list(map(int, input().split()[:2]))
	l.append(li)
for j in l:
	maxi = max(j[0], j[1])
	mini = min(j[0], j[1])
	fin = max(maxi, 2 * mini)
	res.append(fin ** 2)
for g in res:
	print(g)


t = int(input())
for u in range(t):
	(a, b) = list(map(int, input().split()))
	if a == b:
		l = 2 * a
	elif max(a, b) == 2 * min(a, b):
		l = max(a, b)
	elif max(a, b) < 2 * min(a, b):
		l = 2 * min(a, b)
	elif max(a, b) > 2 * min(a, b):
		l = max(a, b)
	print(l ** 2)


te = int(input())
while te != 0:
	(a, b) = map(int, input().split())
	if a < b:
		if 2 * a >= b:
			print((2 * a) ** 2)
		else:
			print(b ** 2)
	elif 2 * b >= a:
		print((2 * b) ** 2)
	else:
		print(a ** 2)
	te -= 1


for xyz in range(0, int(input())):
	(a, b) = map(int, input().split())
	(a, b) = (min(a, b), max(a, b))
	print(max((2 * a) ** 2, b ** 2))


t = int(input())
for k in range(t):
	(a, b) = map(int, input().split())
	ans = 2 * a * b
	res = []
	res.append(2 * a * 2 * a)
	res.append(2 * b * 2 * b)
	res.append(a * a)
	res.append(b * b)
	res.append((a + b) * (a + b))
	res.sort()
	for i in res:
		if i >= ans:
			print(i)
			break


T = int(input())
II = 0
while II < T:
	s = input().split()
	a = int(s[0])
	b = int(s[1])
	if a < b:
		(a, b) = (b, a)
	print(max(2 * b, a) ** 2)
	II += 1


def task(a, b):
	short = min(a, b)
	long = max(a, b)
	if 2 * short >= long:
		size = 2 * short
		print(size * size)
	else:
		size = long
		print(size * size)
t = int(input())
for i in range(0, t):
	(a, b) = map(int, input().split())
	task(a, b)


t = int(input())
for i in range(0, t):
	(a, b) = map(int, input().split())
	max1 = 2 * min(a, b)
	if max1 >= max(a, b):
		max1 = max1
	else:
		max1 = max(a, b)
	ans = max1 * max1
	print(ans)


def s(x, y):
	return pow(min(max(2 * x, y), max(x, 2 * y)), 2)
n = int(input())
for i in range(n):
	(x, y) = map(int, input().split(' '))
	print(s(x, y))


t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	l = min([a, b])
	p = max([a, b])
	if p % l == 0 and a != b:
		print(p ** 2)
	else:
		k = 2 * l - p
		if k > 0:
			print((k + p) ** 2)
		elif k < 0:
			print(p ** 2)


import sys
import math
import random
input = sys.stdin.readline

def inp():
	return int(input())

def inara():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())
t = inp()
for _ in range(t):
	(a, b) = invr()
	w = min(a, b)
	w *= 2
	ans = 0
	if w >= max(a, b):
		ans = w * w
	else:
		ans = max(a, b) * max(a, b)
	print(ans)


def function(a, b):
	if a > b:
		if b + b >= a:
			return (b + b) * (b + b)
		else:
			return a * a
	elif a + a >= b:
		return (a + a) * (a + a)
	else:
		return b * b
t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	print(function(a, b))


testcases = int(input())
for case in range(testcases):
	side = list(map(int, input().split(' ')))
	side.sort()
	if 2 * side[0] >= side[1]:
		print(4 * side[0] * side[0])
	else:
		print(side[1] * side[1])


import sys
t = int(input())
for i in range(t):
	arg = input().split(' ')
	a = min(int(arg[0]), int(arg[1]))
	b = max(int(arg[0]), int(arg[1]))
	print(max(a * 2, b) ** 2)


def sq(sides):
	if sides[0] >= sides[1]:
		(a, b) = sides
	else:
		(a, b) = sides[::-1]
	if 2 * b >= a:
		ans = 4 * b ** 2
	else:
		ans = a ** 2
	return ans
outputs = []
n = int(input())
for i in range(n):
	s = [int(j) for j in input().split()]
	output = sq(s)
	outputs.append(output)
for o in outputs:
	print(o)


import os
import sys
from io import BytesIO, IOBase

def solution(a, b):
	if a == b:
		write((a + b) ** 2)
		return
	(a, b) = sorted([a, b])
	write(max(2 * a, b) ** 2)

def main():
	for _ in range(r_int()):
		(a, b) = r_array()
		solution(a, b)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))

def input():
	return sys.stdin.readline().rstrip('\r\n')

def write(*args, end='\n'):
	for x in args[:-1]:
		sys.stdout.write(str(x) + ' ')
	sys.stdout.write(str(args[-1]))
	sys.stdout.write(end)

def r_array():
	return [int(x) for x in input().split()]

def r_int():
	return int(input())
main()


import math

def solution():
	(n, k) = map(int, input().split())
	ans = max(2 * min(n, k), max(n, k))
	print(ans ** 2)
for _ in range(int(input())):
	solution()


from collections import Counter
import math
import sys
from bisect import bisect, bisect_left, bisect_right

def input():
	return sys.stdin.readline().strip()

def INT():
	return int(input())

def MAP():
	return map(int, input().split())

def LIST(N=None):
	return list(MAP()) if N is None else [INT() for i in range(N)]

def mod():
	return 10 ** 9 + 7
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	x = min(a, b)
	y = max(a, b)
	if 2 * x >= y:
		print((2 * x) ** 2)
	else:
		print(y ** 2)


t = int(input())
while t:
	(a, b) = map(int, input().split())
	max1 = max(a, b)
	min1 = min(a, b)
	if max1 > 2 * min1:
		print(max1 * max1)
	else:
		print(4 * min1 * min1)
	t = t - 1


I = input
t = int(I())
for tt in range(t):
	lis = I().split()
	a = int(lis[0])
	b = int(lis[1])
	A = min(a, b)
	B = a + b - A
	C = 2 * A
	D = max(C, B)
	print(D * D)


import sys
input = sys.stdin.buffer.readline
a = int(input())
h = 0
t = 0
for _ in range(a):
	(b, c) = map(int, input().split())
	j = max(b, c)
	h = min(b, c)
	if 2 * h < j:
		print(j * j)
	else:
		print((h + h) * (h + h))


t = int(input())
while t:
	(a, b) = map(int, input().split())
	r = min(a, b)
	z = max(2 * r, max(a, b))
	print(z ** 2)
	t = t - 1


Answers = []
for i in range(int(input())):
	X = list(map(int, input().split()))
	Answers.append(str(max(min(X) * 2, max(X)) ** 2))
print('\n'.join(Answers))


t = int(input())
while t > 0:
	l = [int(x) for x in input().strip().split()]
	(a, b) = (l[0], l[1])
	a1 = max(2 * a, b)
	a2 = max(2 * b, a)
	x = min(a1, a2)
	print(x * x)
	t -= 1


import math
t = int(input())
while t:
	(a, b) = map(int, input().split())
	if min(a, b) * 2 > max(a, b):
		print(int(math.pow(min(a, b) * 2, 2)))
	else:
		print(int(math.pow(max(a, b), 2)))
	t = t - 1


import sys
input = sys.stdin.readline
output = sys.stdout

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())

def solve(a, b):
	maxi = max(a, b)
	mini = min(a, b)
	temp = mini * 2
	if temp >= maxi:
		res = temp * temp
	elif temp < maxi:
		res = maxi * maxi
	output.write(str(res) + '\n')
n = inp()
for i in range(n):
	my_list1 = inlt()
	a = my_list1[0]
	b = my_list1[1]
	solve(a, b)


import math
import sys
from collections import deque
input = sys.stdin.readline
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	if a > b:
		(a, b) = (b, a)
	if 2 * a <= b:
		print(b ** 2)
	else:
		print(4 * a ** 2)


print(*[max(max(ab), 2 * min(ab)) ** 2 for ab in (list(map(int, input().split())) for _ in range(int(input())))], sep='\n')


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	if a >= b and 2 * b >= a:
		print(2 * b * (2 * b))
	elif a > b and 2 * b < a:
		print(a * a)
	elif a < b and 2 * a >= b:
		print(2 * a * (2 * a))
	elif a < b and 2 * a < b:
		print(b * b)


t = int(input())
sq_ar = []
while t != 0:
	a = input()
	d = []
	d = a.split(' ')
	l = int(d[0])
	b = int(d[1])
	if l < b:
		(l, b) = (b, l)
	if b * 2 > l:
		sq_ar.append((b * 2) ** 2)
	else:
		sq_ar.append(l ** 2)
	t -= 1
for i in sq_ar:
	print(i)


def read_array():
	x = []
	x1 = []
	x = input()
	x = x.split(' ')
	for r in range(len(x)):
		x1.append(int(x[r]))
	return x1

def square(l):
	l1 = min(l)
	l2 = max(l)
	if ((2 * l1) ** 2) ** 0.5 < l2:
		return l2 ** 2
	else:
		return (2 * l1) ** 2
results = []
x = int(input())
for i in range(x):
	l = read_array()
	results.append(square(l))
for v in results:
	print(v)


t = int(input())
lis = []
out = []
for i in range(t):
	lis.append([int(i) for i in input().split()])
	side = 0
	if lis[i][0] < lis[i][1]:
		min = lis[i][0]
		max = lis[i][1]
	else:
		min = lis[i][1]
		max = lis[i][0]
	if 2 * min >= max:
		side = 2 * min
	else:
		side = max
	out.append(side ** 2)
for i in out:
	print(i)


import math
t = int(input())
while t:
	t -= 1
	(a, b) = map(int, input().split())
	c = 2 * min(a, b)
	d = max(c, max(a, b))
	print(d ** 2)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	print(min(max(a * a, 4 * b * b), max(4 * a * a, b * b)))


import math

def is_prime(n):
	if n == 1:
		return False
	for i in range(2, int(math.sqrt(n)) + 1):
		if n % i == 0:
			return False
	return True

def inp():
	ls = list(map(int, input().split()))
	return ls
t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	if min(a, b) + min(a, b) <= max(a, b):
		print(max(a, b) * max(a, b))
	else:
		print(max(max(a, b) + 1, min(a, b) + min(a, b)) * max(max(a, b) + 1, min(a, b) + min(a, b)))


def min_square_area(x: int, y: int):
	smallest_side = min(x, y)
	longest_side = max(x, y)
	square_side = 2 * smallest_side
	if square_side < longest_side:
		square_side = longest_side
	return square_side * square_side
t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	sq_area = min_square_area(a, b)
	print(sq_area)


t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	if a == b:
		print((2 * a) ** 2)
		continue
	ans = 1000000
	if a >= 2 * b:
		ans = min(a ** 2, ans)
	if b >= 2 * a:
		ans = min(b ** 2, ans)
	if 2 * a >= b:
		ans = min((2 * a) ** 2, ans)
	if 2 * b >= a:
		ans = min((2 * b) ** 2, ans)
	ans = min(ans, (a + b) ** 2)
	print(ans)


def solve():
	(a, b) = list(map(int, input().split()))
	print(min(max(2 * a, b), max(a, 2 * b)) ** 2)
	return

def main():
	t = int(input())
	while t:
		solve()
		t -= 1
main()


T = int(input(''))
for t in range(T):
	Lista = list(map(int, input().split()))
	A = max(Lista)
	B = min(Lista)
	if A != B:
		if A % B == 0:
			Lado = A
		elif 2 * B < A:
			Lado = A
		else:
			Lado = (A // B + 1) * B
		print(Lado ** 2)
	else:
		print((2 * A) ** 2)


t = int(input())
for _ in range(t):
	(a, b) = [int(x) for x in input().split()]
	if a == b:
		print(pow(2 * a, 2))
		continue
	if 2 * min(a, b) >= max(a, b):
		print(pow(2 * min(a, b), 2))
		continue
	if 2 * min(a, b) <= max(a, b):
		print(pow(max(a, b), 2))


t = int(input())
for i in range(t):
	(l, b) = map(int, input().split())
	z = min(l, b)
	z = z + z
	print(max(l, b, z) * max(l, b, z))


import sys
import math
from collections import defaultdict

def solve(test):
	(a, b) = map(int, input().split())
	l = max(a, b)
	w = min(a, b)
	ans = max(2 * w, l) ** 2
	print(ans)
test_cases = int(input())
for t in range(1, test_cases + 1):
	solve(t)


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	if b > a:
		c = a
		a = b
		b = c
	if 2 * b >= a:
		side = 2 * b
	else:
		side = a
	print(side * side)


def ans(l, b):
	c = max(l, b)
	d = min(l, b)
	if c >= 2 * d:
		return c * c
	else:
		return 4 * d * d
m = int(input())
for i in range(m):
	a = input().split()
	l = int(a[0])
	b = int(a[1])
	print(ans(l, b))


def main():
	ans = 0
	for i in range(int(input())):
		(x, y) = input().split()
		print(pow(min(max(int(x) * 2, int(y)), max(int(y) * 2, int(x))), 2))
main()


for i in range(int(input())):
	(a, b) = map(int, input().split())
	if a > b:
		(a, b) = (b, a)
	if a == b or 2 * a >= b:
		print((2 * a) ** 2)
	if 2 * a < b:
		print(b ** 2)


t = int(input())
for i in range(t):
	(n, m) = map(int, input().split())
	m1 = min(n, m)
	if m1 == n:
		n = 2 * n
		ans = max(n, m)
		print(ans ** 2)
	else:
		m = 2 * m
		ans = max(n, m)
		print(ans ** 2)


ans = []
t = int(input())
for ti in range(t):
	(a, b) = list(map(int, input().split()))
	minL = min(a, b)
	maxL = max(a, b)
	if minL * 2 > maxL:
		ans.append(minL * minL * 4)
	else:
		ans.append(maxL * maxL)
for i in ans:
	print(i)


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	if b > a:
		if a + a > b:
			ans = (a + a) * (a + a)
		else:
			ans = b * b
	elif b + b > a:
		ans = (b + b) * (b + b)
	else:
		ans = a * a
	print(ans)


t = int(input())
for p in range(t):
	(a, b) = list(map(int, input().split()))
	(i, j) = (max(a, b), min(a, b))
	if 2 * j < i:
		print(i * i)
	else:
		print(4 * j * j)


import sys
from math import floor, sqrt, ceil, factorial, gcd, pi
from itertools import chain, combinations, permutations, accumulate
from collections import Counter, defaultdict, OrderedDict
from array import array
INT_MAX = sys.maxsize
INT_MIN = -sys.maxsize - 1
mod = 1000000007

def solve():
	t = int(sys.stdin.readline())
	for _ in range(t):
		(a, b) = map(int, sys.stdin.readline().split())
		maxx = max(a, b)
		minn = min(a, b)
		print(max(maxx, minn * 2) ** 2)
solve()


import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left, bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil, pi, factorial
from operator import itemgetter

def I():
	return int(input())

def MI():
	return map(int, input().split())

def LI():
	return list(map(int, input().split()))

def LI2():
	return [int(input()) for i in range(n)]

def MXI():
	return [[LI()] for i in range(n)]

def SI():
	return input().rstrip()

def printns(x):
	print('\n'.join(x))

def printni(x):
	print('\n'.join(list(map(str, x))))
inf = 10 ** 17
mod = 10 ** 9 + 7
n = I()
for i in range(n):
	(a, b) = MI()
	if a > b:
		(b, a) = (a, b)
	print(max(2 * a, b) ** 2)


x = int(input())
while x != 0:
	n = list(map(int, input().split(' ')))
	side2 = max(n[0], n[1])
	side = min(n[0], n[1]) * 2
	area = 2 * n[0] * n[1]
	area2 = side * side
	if area2 >= area and side2 <= side:
		print(area2)
	else:
		while side2 > side:
			side = side + 1
		print(side * side)
	x = x - 1


test = int(input())
for _ in range(test):
	(a, b) = map(int, input().split())
	m1 = min(a, b)
	m2 = max(a, b)
	if 2 * m1 >= m2:
		print(2 * m1 * (2 * m1))
	else:
		print(m2 * m2)


def main():
	for _ in range(int(input())):
		(a, b) = map(int, input().split())
		a1 = min(a, b)
		b1 = max(a, b)
		print(max(2 * a1, b1) ** 2)
main()


def minsquare(a, b):
	mini = min(a, b) * 2
	if a == b:
		return (a + b) ** 2
	elif max(a, b) > mini:
		return max(a, b) ** 2
	elif max(a, b) <= mini:
		return mini ** 2
test = int(input())
for i in range(test):
	(a, b) = map(int, input().split())
	print(minsquare(a, b))


N = int(input())
for i in range(N):
	(a, b) = list(map(int, input().split()))
	if a == b:
		print((2 * a) ** 2)
	else:
		d = min(a, b)
		d1 = max(max(a, b), 2 * d)
		print(d1 ** 2)


n = int(input())
for i in range(n):
	str1 = input()
	a = int(str1.split()[0])
	b = int(str1.split()[1])
	if a == b:
		print(4 * a * b)
	elif a > b:
		if 2 * b == a:
			print(2 * a * b)
		elif 2 * b > a:
			print(4 * b * b)
		else:
			print(a * a)
	elif 2 * a == b:
		print(2 * a * b)
	elif 2 * a > b:
		print(4 * a * a)
	else:
		print(b * b)


m = int(input())
for i in range(m):
	(a, b) = input().split(' ')
	e = max(int(a), int(b))
	f = min(int(a), int(b))
	if 2 * f >= e:
		print((2 * f) ** 2)
	else:
		print(e ** 2)


for i in range(int(input())):
	prompt = [int(i) for i in input().split(' ')]
	print(max([min(prompt) * 2, max(prompt)]) ** 2)


def read_int():
	return int(input())

def read_ints():
	return map(int, input().split(' '))
t = read_int()
for case_num in range(t):
	(a, b) = read_ints()
	x = max(2 * min(a, b), max(a, b))
	print(x * x)


import sys
input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())
for n in range(inp()):
	(l, b) = invr()
	if b * 2 <= l:
		print(l ** 2)
	elif l * 2 <= b:
		print(b ** 2)
	elif l > b:
		print((b * 2) ** 2)
	else:
		print((l * 2) ** 2)


t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	q = max(a, b)
	z = min(a, b)
	r = 0
	if 2 * z >= q:
		print(4 * z * z)
	else:
		print(q * q)


n = int(input())

def calc(x, y):
	m = min(x, y)
	ma = max(x, y)
	if 2 * m < ma:
		print(ma * ma)
	else:
		print(pow(2 * m, 2))
for i in range(n):
	(x, y) = map(int, input().split())
	calc(x, y)


def area_check(w, h):
	width = max(w, h)
	height = min(w, h)
	if width >= 2 * height:
		return width ** 2
	else:
		return (2 * height) ** 2
test_case = int(input())
x = 0
while x < test_case:
	x += 1
	(w, h) = list(map(int, input().split()))
	print(area_check(w, h))


import math

def sqar(n):
	sq = math.floor(math.sqrt(n))
	if sq * sq >= n:
		return sq * sq
	else:
		return (sq + 1) * (sq + 1)
n: int = int(input())
l = []
for i in range(n):
	m = list(map(int, input().split()))
	l.append(m)
for i in range(len(l)):
	a = min(l[i][0], l[i][1])
	b = max(l[i][0], l[i][1])
	ans = max(a * 2, b)
	print(ans * ans)


from sys import stdin
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	x = min(a, b) * 2
	x = max([a, b, x])
	print(x ** 2)


for i in range(int(input())):
	(a, b) = map(int, input().split())
	if a < b:
		a = a + a
	else:
		b = b + b
	m = max(a, b)
	print(m * m)


def process(args):
	(lowest, biggest) = sorted(args)
	if biggest < lowest * 2:
		biggest += lowest * 2 - biggest
	return biggest ** 2
for _ in range(int(input())):
	print(process(map(int, input().split())))


t = int(input())
for test in range(t):
	(a, b) = [int(x) for x in input().split()]
	x = min(a, b)
	y = 2 * x
	z = max(y, max(a, b))
	print(z ** 2)


t = int(input())
for i in range(t):
	(aa, bb) = input().split()
	a = int(aa)
	b = int(bb)
	d = min(a, b)
	e = max(a, b)
	f = 2 * d
	if f < e:
		print(e * e)
	else:
		print(f * f)


def solve(a, b):
	return max(a, b, 2 * min(a, b)) ** 2
t = int(input())
for i_t in range(t):
	[a, b] = list(map(int, input().split(' ')))
	print(solve(a, b))


def function(a, b):
	c = min([a, b])
	if c * 2 >= max([a, b]):
		print((c * 2) ** 2)
	else:
		print(max([a, b]) ** 2)
t = int(input())
for k in range(t):
	(a, b) = map(int, input().rstrip().split())
	function(a, b)


t = int(input())
while t > 0:
	(a, b) = map(int, input().split())
	mx = max(a, b)
	mn = min(a, b)
	res = max(mx, 2 * mn)
	print(res ** 2)
	t -= 1


from collections import *
from sys import *
inp = stdin.readline
f = 0
if f & 1:
	out = stdout.write
	str = str
else:
	out = print

def linp(x):
	return list(map(int, x.split()))

def minp(x):
	return map(int, x.split())
t = int(inp())
while t > 0:
	(a, b) = minp(inp())
	aa = max(a, b)
	bb = min(a, b)
	print(max(2 * bb, aa) ** 2)
	t -= 1


t = int(input())
s = 0
for i in range(0, t):
	(a, b) = map(int, input().split())
	if a < b:
		if a * 2 >= b:
			s = (a * 2) ** 2
		else:
			s = b ** 2
	if a > b:
		if b * 2 >= a:
			s = (b * 2) ** 2
		else:
			s = a ** 2
	if a == b:
		s = (a * 2) ** 2
	print(s)


num_lines = int(input())
lineList = [input() for i in range(num_lines)]
for line in lineList:
	line = [int(i) for i in line.split()]
	(line[0], line[1]) = (min(line), max(line))
	if line[0] * 2 > line[1]:
		print((line[0] * 2) ** 2)
	else:
		print(line[1] ** 2)


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	s1 = min(a, b)
	s2 = max(a, b)
	x = 0
	y = s1 * 2
	if y < s2:
		x = s2
	else:
		x = y
	print(x ** 2)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	s = min(a, b)
	if 2 * s <= max(a, b):
		print(max(a, b) * max(a, b))
	else:
		c = max(a, b) + 1
		ans = max(c, 2 * s)
		print(ans * ans)


t = int(input())
for i in range(0, t):
	(a, b) = map(int, input().strip().split())
	if a > b:
		(a, b) = (b, a)
	if a < b:
		if 2 * a > b:
			print(4 * a ** 2)
		elif b >= 2 * a:
			print(b ** 2)
	if a == b:
		print(4 * a ** 2)


n = int(input())
tmp = []
for i in range(n):
	tmp = list(map(int, input().split()))
	if min(tmp) * 2 > max(tmp):
		print((min(tmp) * 2) ** 2)
	else:
		print(max(tmp) ** 2)


z = input
for i in range(int(z())):
	(a, b) = map(int, z().split())
	if a == b:
		print((a + b) ** 2)
	else:
		print(max(a, b, 2 * min(a, b)) ** 2)


from sys import stdin, stdout
from math import ceil
inp = int(stdin.readline())
arr = []
for i in range(inp):
	dimensions = [int(i) for i in stdin.readline().split()]
	arr.append(dimensions)

def minimal_square(array):
	for i in arr:
		area = i[0] * i[1] * 2
		minimum = min(i[0] * 2, i[1] * 2)
		if minimum ** 2 >= area:
			print(minimum ** 2)
		else:
			print(max(i[0], i[1]) ** 2)
minimal_square(arr)


def areaSquare(L, B):
	large = max(L, B)
	small = min(L, B)
	if large >= 2 * small:
		return large * large
	else:
		return 2 * small * (2 * small)
t = int(input())
while t:
	(n, m) = map(int, input().split())
	print(areaSquare(n, m))
	t = t - 1


import sys
input = lambda : sys.stdin.readline().strip()
inp = lambda : list(map(int, input().split()))
for _ in range(int(input())):
	a = inp()
	a.sort()
	print(max((min(a) + min(a)) ** 2, max(a) ** 2))


from sys import stdin as f
t = int(f.readline().strip())
for _ in range(t):
	(a, b) = [int(i) for i in f.readline().strip().split()]
	(x, y) = (min(a, b), max(a, b))
	if 2 * x <= y:
		print(y ** 2)
	else:
		print(4 * x ** 2)


import sys
import math
from collections import defaultdict as dd
mod = 1000000007
T = 1
T = int(sys.stdin.readline())
for _ in range(T):
	(a, b) = map(int, input().split())
	(a, b) = (min(a, b), max(a, b))
	a <<= 1
	ans = max(b * b, a * a)
	print(ans)


T = int(input())
for t in range(T):
	(a, b) = map(int, input().split())
	mn = min(a, b)
	mx = max(a, b)
	cand = [max(mx, 2 * mn), a + b]
	print(int(min(cand) ** 2))


for _ in range(int(input())):
	(a, b) = map(int, input().split(' '))
	temp = min(a, b) * 2
	if a > 2 * b:
		temp = a
	if b > 2 * a:
		temp = b
	print(temp ** 2)


for _ in range(int(input())):
	sides = list(map(int, input().split()))
	a = sides[0]
	b = sides[1]
	if a == b:
		print(pow(a * 2, 2))
		continue
	elif a > b:
		if 2 * b > a:
			print(pow(2 * b, 2))
			continue
		else:
			print(pow(a, 2))
			continue
	elif 2 * a > b:
		print(pow(2 * a, 2))
		continue
	else:
		print(pow(b, 2))
		continue


import sys
max_int = 1000000001
min_int = -max_int
t = int(input())
for _t in range(t):
	(a, b) = map(int, sys.stdin.readline().split())
	(a, b) = (min(a, b), max(a, b))
	print(b * b if 2 * a <= b else 4 * a * a)


import math
test = int(input())
for i in range(test):
	(a, b) = [int(x) for x in input().split(' ')]
	ma = max(a, b)
	mi = min(a, b)
	if ma == mi:
		print(pow(2 * ma, 2))
	elif ma % mi == 0:
		temp = ma // mi
		ans = mi * temp
		print(pow(ans, 2))
	elif pow(2 * mi, 2) < 2 * mi * ma:
		print(pow(ma, 2))
	else:
		print(pow(2 * mi, 2))


from sys import stdin
t = int(stdin.readline())
for _ in range(t):
	(x, y) = map(int, stdin.readline().split())
	if x < y:
		s = 2 * x
		fl = 0
	else:
		s = 2 * y
		fl = 1
	if fl == 0:
		dif = s - y
	else:
		dif = s - x
	if dif >= 0:
		s = s
	else:
		s = s + abs(dif)
	area = s * s
	print(area)


t = int(input())
for i in range(t):
	entrada = input()
	(a, b) = map(int, entrada.split())
	if a == b:
		area = (2 * a) ** 2
		print(area)
		continue
	maior = max(a, b)
	menor = min(a, b)
	if maior == menor * 2:
		area = maior ** 2
		print(area)
		continue
	lado = max(2 * menor, maior)
	area = lado ** 2
	print(area)


import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush
from math import *
from collections import defaultdict as dd, deque, Counter as C
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
from time import perf_counter
from fractions import Fraction
mod = pow(10, 9) + 7
mod2 = 998244353

def data():
	return sys.stdin.readline().strip()

def out(*var, end='\n'):
	sys.stdout.write(' '.join(map(str, var)) + end)

def l():
	return list(sp())

def sl():
	return list(ssp())

def sp():
	return map(int, data().split())

def ssp():
	return map(str, data().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(n, val) for j in range(m)]
for _ in range(int(input())):
	(a, b) = l()
	if a > b:
		(a, b) = (b, a)
	print(max(b, 2 * a) ** 2)


t = int(input())
for _ in range(t):
	inp = list(map(int, input().split()))
	a = min(inp)
	b = max(inp)
	z = 99999999999999
	if b >= 2 * a:
		z = min(z, b ** 2)
	elif 2 * a >= b:
		z = min(z, 4 * a * a)
	else:
		z = min(z, (a + b) ** 2)
	print(z)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	s1 = max(a, 2 * b)
	s2 = max(b, 2 * a)
	side = min(s1, s2)
	print(side * side)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	max1 = max(a, b)
	min1 = min(a, b)
	v = 2 * min1
	m = max(v, max1)
	print(m * m)


def func(a, b):
	small = 0
	big = 0
	if a >= b:
		big = a
		small = b
	else:
		big = b
		small = a
	if small * 2 >= big:
		temp = small * 2
		print(temp ** 2)
	else:
		print(big ** 2)
t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	func(a, b)


def a():
	for _ in range(int(input())):
		(a, b) = map(int, input().split())
		area_quadrado = min(max(2 * b, a), max(2 * a, b)) ** 2
		print(int(area_quadrado))
a()


tc = int(input())
for _ in range(tc):
	(a, b) = map(int, input().split())
	res = max(2 * min(a, b), max(a, b))
	print(res * res)


def mini(a, b):
	if a < b:
		return a
	return b

def maxi(a, b):
	if a < b:
		return b
	return a
t = int(input())
for i in range(t):
	(a, b) = map(int, input().split(' '))
	if a == b:
		print(4 * a ** 2)
	elif 2 * mini(a, b) >= maxi(a, b):
		print((2 * mini(a, b)) ** 2)
	else:
		print(maxi(a, b) ** 2)


def main():
	n = int(input())
	for i in range(n):
		data = tuple(sorted(map(int, input().split())))
		ans = []
		ans.append((data[0] + data[1]) ** 2)
		if 2 * data[0] >= data[1]:
			ans.append((2 * data[0]) ** 2)
		else:
			ans.append(data[1] ** 2)
		print(min(ans))
main()


def minimal_square(a, b):
	edge = max(max(a, b), 2 * min(a, b))
	return edge ** 2
t = int(input())
for t_itr in range(t):
	nk = list(map(int, input().rstrip().split()))
	a = int(nk[0])
	b = int(nk[1])
	result = minimal_square(a, b)
	print(result)


def func(n):
	for i in range(n):
		k = list(map(int, input().split()))
		a = k[0]
		b = k[1]
		length = min(a, b) * 2
		width = max(a, b)
		if width < length:
			width += abs(length - width)
		else:
			length += abs(length - width)
		print(length * width)
n = int(input())
func(n)


import math
T = int(input())
for _ in range(0, T):
	(a, b) = map(int, input().split())
	A = max(a, b)
	B = min(a, b)
	t1 = max(A, B + B) ** 2
	t2 = max(A, A + B) ** 2
	print(min(t1, t2))


n = int(input())
i = 0
while i < n:
	(a, b) = map(int, input().split(' '))
	c = max(2 * b, a)
	d = max(2 * a, b)
	print(min(c, d) ** 2)
	i = i + 1


n = int(input())
alist = []
for i in range(n):
	(a, b) = map(int, input().split())
	if a // b >= 2 or b // a >= 2:
		c = max(a, b)
		size = c * c
		alist.append(size)
	else:
		c = min(a, b)
		size = 4 * c * c
		alist.append(size)
for i in alist:
	print(i)


import sys
import math
from sys import stdin, stdout
for _ in range(int(stdin.readline())):
	(a, b) = list(map(int, stdin.readline().split()))
	if 2 * min(a, b) > max(a, b):
		print(4 * min(a, b) ** 2)
	else:
		print(max(a, b) ** 2)


test = int(input())
for i in range(test):
	(a, b) = [int(i) for i in input().split()]
	k = min(a, b)
	if 2 * k >= max(a, b):
		print((2 * k) ** 2)
	else:
		print(max(a, b) ** 2)


tc = int(input())
for kl in range(tc):
	s = input().split(' ')
	for op in range(len(s)):
		s[op] = int(s[op])
	s.sort()
	s[0] += s[0]
	print(max(s) * max(s))


for i in range(int(input())):
	(a, b) = map(int, input().split())
	c = max(a, b)
	d = 2 * min(a, b)
	k = max(c, d)
	print(k * k)


t = int(input())
while t:
	(a, b) = list(map(int, input().split()))
	result = min(max(a, b + b), max(b, a + a))
	print(result * result)
	t -= 1


t = int(input())
for i in range(t):
	s = 0
	(a, b) = map(int, input().split())
	if a < b:
		d = 2 * a
		c = d - b
		if c >= 0:
			s = 1
	else:
		d = 2 * b
		c = d - a
		if c >= 0:
			s = 1
	if s == 1:
		d = d * d
		print(d)
	elif a < b:
		print(b * b)
	else:
		print(a * a)


t = int(input())
r = [list(map(int, input().split())) for i in range(t)]
for j in range(t):
	if r[j][0] <= r[j][1]:
		if r[j][0] * 2 <= r[j][1]:
			print(r[j][1] * r[j][1])
		else:
			print(r[j][0] * r[j][0] * 4)
	elif r[j][1] * 2 <= r[j][0]:
		print(r[j][0] * r[j][0])
	else:
		print(r[j][1] * r[j][1] * 4)


for _ in range(int(input())):
	(x, y) = map(int, input().split())
	M = min(x, y)
	m = max(x, y)
	sol = max(2 * M, m)
	print(sol * sol)


case = int(input())
for i in range(0, case):
	(x, y) = [int(x) for x in input().split()]
	(biggerComp, smallerComp) = (max(x, y), min(x, y))
	print(max(biggerComp, 2 * smallerComp) ** 2)


a = int(input())
d = 0
for i in range(0, a):
	(b, c) = map(int, input().split())
	if b >= c:
		d = (c * 2) ** 2
		if c * 2 < b:
			d = b ** 2
		print(d)
	if c > b:
		d = (b * 2) ** 2
		if b * 2 < c:
			d = c ** 2
		print(d)


inp = int(input())
for i in range(inp):
	(n, k) = map(int, input().split())
	t = min(n, k) * 2
	j = max(n, k, t)
	n = j ** 2
	print(n)


tt = int(input())
while tt:
	tt -= 1
	ll = list(map(int, input().split()))
	l = sorted(ll, reverse=True)
	a = l[0]
	b = l[1]
	s = min(max(2 * a, b), max(a, b * 2))
	print(s * s)


num = int(input())
ans = []
for i in range(num):
	(a, b) = [int(x) for x in input().split(' ')]
	if a < b / 2:
		ans.append(b * b)
	elif a >= b / 2 and a < b * 2:
		c = min(a, b)
		ans.append(4 * c * c)
	elif a >= b * 2:
		ans.append(a * a)
for i in range(num):
	print(ans[i])


t = int(input())
while t:
	arr = list(map(int, input().strip().split()))[:2]
	(a, b) = (arr[0], arr[1])
	(a1, a2, a3, a4) = (999999999, 999999999, 999999999, 999999999)
	if a + a >= b:
		a1 = a + a
	if b + b >= a:
		a2 = b + b
	if a > 2 * b:
		a3 = a
	if b > 2 * a:
		a4 = b
	l = min(a1, a2, a3, a4)
	print(l * l)
	t -= 1


t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	c = min(a, b)
	d = max(a, b)
	c = c * 2
	if c >= d:
		print(c * c)
	elif c < d:
		m = abs(c - d)
		c = c + m
		print(c * c)


num_test_case = int(input())
i = 1
list_output = []
while num_test_case > 0:
	list_side = input().split()
	for i in range(0, 2):
		list_side[i] = int(list_side[i])
	minl = min(list_side)
	maxl = max(list_side)
	if minl * 2 <= maxl:
		list_output.append(maxl * maxl)
	else:
		list_output.append((minl * 2) ** 2)
	num_test_case -= 1
for i in list_output:
	print(i)


tests = int(input())
for i in range(tests):
	(l, b) = map(int, input().split())
	a = min(l + b, 2 * l, 2 * b)
	y = max(a, l, b)
	print(y * y)


import sys
from collections import deque
input = sys.stdin.buffer.readline
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	s = min(max(a, 2 * b), max(2 * a, b), max(a + b, max(a, b)))
	print(s * s)


import bisect
import os
from collections import Counter
import bisect
from collections import defaultdict
import math
import random
import heapq as hq
from math import sqrt
import sys
from functools import reduce, cmp_to_key
from collections import deque
import threading
from itertools import combinations
from io import BytesIO, IOBase
from itertools import accumulate

def primeFactors(n):
	prime = set()
	while n % 2 == 0:
		prime.add(2)
		n = n // 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			prime.add(i)
			n = n // i
	if n > 2:
		prime.add(n)
	return list(prime)

def getFactors(n):
	factors = []
	i = 1
	while i <= math.sqrt(n):
		if n % i == 0:
			if n // i == i:
				factors.append(i)
			else:
				factors.append(i)
				factors.append(n // i)
		i = i + 1
	return factors

def SieveOfEratosthenes(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	num = []
	for p in range(2, n + 1):
		if prime[p]:
			num.append(p)
	return num

def lcm(a, b):
	return a * b // math.gcd(a, b)

def sort_dict(key_value):
	return sorted(key_value.items(), key=lambda kv: (kv[1], kv[0]))

def list_input():
	return list(map(int, input().split()))

def num_input():
	return map(int, input().split())

def string_list():
	return list(input())

def decimalToBinary(n):
	return bin(n).replace('0b', '')

def binaryToDecimal(n):
	return int(n, 2)

def solve():
	(x, y) = sorted(num_input())
	(a, b) = (min(x, y), max(x, y))
	if 2 * a >= b:
		print((2 * a) ** 2)
	else:
		print(b ** 2)
t = int(input())
for _ in range(t):
	solve()


from math import ceil
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	(a, b) = (min(a, b), max(a, b))
	if b >= 2 * a:
		print(b ** 2)
	else:
		print((a * ceil(b / a)) ** 2 if a != b else (2 * a) ** 2)


te = int(input())
for t in range(te):
	(w, h) = input().split()
	(w, h) = (int(w), int(h))
	print(min(max(w * 2, h), max(w, h * 2)) ** 2)


from collections import *
from bisect import *
from math import *
from heapq import *
import sys
input = sys.stdin.readline
t = int(input())
while t:
	t -= 1
	(a, b) = map(int, input().split())
	x = max(a, b, min(a, b) * 2)
	print(x ** 2)


import sys
import math

def get_array():
	return list(map(int, sys.stdin.readline().strip().split()))

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def input():
	return sys.stdin.readline().strip()
for _ in range(int(input())):
	(a, b) = get_ints()
	if 2 * a < b:
		print(b * b)
	elif 2 * b < a:
		print(a * a)
	else:
		c = min(a, b)
		print(4 * c * c)


t = int(input())
q = 0
for _ in range(t):
	(a, b) = map(int, input().split())
	if a == b:
		print(2 * a * 2 * a)
		continue
	if min(a, b) * 2 == max(a, b):
		print(max(a, b) * max(a, b))
		continue
	if max(a, b) - min(a, b) < min(a, b):
		print(2 * min(a, b) * (2 * min(a, b)))
	elif 2 * min(a, b) < max(a, b):
		print(max(a, b) * max(a, b))
	else:
		print((a + b) * (a + b))


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split(' '))
	smol = 2 * min(a, b)
	diff = smol - max(a, b)
	if diff < 0:
		print((smol + abs(diff)) ** 2)
	else:
		print((max(a, b) + diff) ** 2)


mod = int(1000000000.0) + 7

def sip():
	return input()

def nip():
	return int(input())

def mip():
	return map(int, input().split())
for _ in range(0, int(input())):
	(a, b) = mip()
	t = min(min(max(a + a, b), max(b + b, a)), a + b)
	print(t * t)


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	lo = max(a, b)
	sh = min(a, b)
	if lo > sh * 2:
		print(lo ** 2)
	else:
		print((sh * 2) ** 2)


t = int(input())
while t > 0:
	(x, y) = map(int, input().split())
	A = min(x, y)
	B = max(x, y)
	C = A * 2
	if C > B:
		print(C ** 2)
	else:
		print(B ** 2)
	t -= 1


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	v1 = a + b
	v2 = max(a + a, b)
	v3 = max(b + b, a)
	ans = min(v1, min(v2, v3))
	print(ans * ans)


import math
t = int(input())
for _ in range(t):
	(a, b) = [int(x) for x in input().split()]
	x_min = min(a, b)
	y_max = max(a, b)
	print(max(y_max, x_min * 2) ** 2)


def solve(a, b):
	if a < b:
		return max(2 * a, b) ** 2
	elif a == b:
		return (2 * a) ** 2
	return max(a, 2 * b) ** 2
t = int(input())
for i in range(t):
	(a, b) = (int(p) for p in input().split())
	print(solve(a, b))


x = int(input())
for i in range(x):
	maxi = [int(x) for x in input().split()]
	if 2 * min(maxi) >= max(maxi):
		print((2 * min(maxi)) ** 2)
	else:
		print(max(maxi) ** 2)


t = int(input())
for __ in range(t):
	(a, b) = map(int, input().split())
	if a == 1 and b == 3 or (a == 3 and b == 1):
		print(pow(3, 2))
	elif a < b:
		if b <= 2 * a:
			print(pow(2 * a, 2))
		else:
			print(pow(b, 2))
	elif a <= 2 * b:
		print(pow(2 * b, 2))
	else:
		print(pow(a, 2))


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	mini = min(a, b)
	if 2 * mini >= a + b - mini:
		print((2 * mini) ** 2)
	else:
		print((a + b - mini) ** 2)


t = int(input())
for i in range(t):
	p = input().split()
	a = int(p[0])
	b = int(p[1])
	if a > b:
		n = 2 * b
		if n == a:
			print(n * a)
		elif n < a:
			print(a * a)
		else:
			print(n * n)
	else:
		n = 2 * a
		if n == b:
			print(n * b)
		elif n < b:
			print(b * b)
		else:
			print(n * n)


T = int(input())
for t in range(T):
	(A, B) = list(map(int, input().split()))
	mini = min([A, B])
	maxi = max([A, B])
	res = max(2 * mini, maxi)
	print(res * res)


cases = int(input())
for q in range(cases):
	inp = input().split()
	m = int(inp[0])
	n = int(inp[1])
	(m, n) = (max(m, n), min(m, n))
	M = max(m, 2 * n)
	print(M * M)


t = int(input())
while t:
	(a, b) = map(int, input().split())
	area1 = pow(2 * min(a, b), 2)
	area2 = pow(max(a, b), 2)
	print(max(area1, area2))
	t -= 1


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	if 2 * min(a, b) <= max(a, b):
		print(max(a, b) * max(a, b))
	else:
		l = [2 * a, 2 * b, a + b]
		l.sort()
		print(l[0] * l[0])


from sys import stdin
input = stdin.readline

def main():
	test = int(input())
	for t in range(test):
		l = [int(i) for i in input().split(' ')]
		a = l[0]
		b = l[1]
		if 2 * a <= b:
			print(b * b)
		elif 2 * b <= a:
			print(a * a)
		else:
			print(min(4 * a * a, 4 * b * b))
main()


for _ in range(int(input())):
	(a, b) = [int(i) for i in input().split()]
	side = min(max(a, 2 * b), max(2 * a, b))
	print(side ** 2)


def sideFind(x, y):
	side = min(max(x * 2, y), max(x, y * 2))
	return side ** 2

def solve():
	(a, b) = map(int, input().split())
	print(sideFind(a, b))
for _ in range(int(input())):
	solve()


t = int(input())
while t != 0:
	t -= 1
	(x, y) = map(int, input().split())
	print(max(max(x, y), 2 * min(x, y)) ** 2)


cases = int(input())
sol = []
while cases > 0:
	(a, b) = [int(num) for num in input().split()]
	min = a if a < b else b
	max = a if a >= b else b
	if max / min <= 2:
		sol.append(min * 2 * (min * 2))
	else:
		sol.append(max * max)
	cases -= 1
for s in sol:
	print(s)


n = int(input())
l = []
for i in range(n):
	(x, y) = map(int, input().split())
	l.append(min(max(x * 2, y), max(x, y * 2)) ** 2)
for i in l:
	print(i)


for t in range(int(input())):
	(a, b) = [int(i) for i in input().split()]
	small = min(a, b)
	large = max(a, b)
	area = a * b
	sq = large
	while sq * sq < area:
		sq += 1
	while sq < 2 * small:
		sq += 1
	print(sq * sq)


t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	if b <= a and 2 * b >= a:
		side = 2 * b
		area = side ** 2
		print(area)
	elif a >= b and 2 * b <= a:
		side = a
		area = side ** 2
		print(area)
	elif a <= b and 2 * a >= b:
		side = 2 * a
		area = side ** 2
		print(area)
	elif b >= a and 2 * a <= b:
		side = b
		area = side ** 2
		print(area)


(z, zz, dgraphs) = (input, lambda : list(map(int, z().split())), {})
from string import *
from collections import *
from queue import *
from sys import *
from collections import *
from math import *
from heapq import *
from itertools import *
from bisect import *
from collections import Counter as cc
from math import factorial as f

def lcd(xnum1, xnum2):
	return xnum1 * xnum2 // gcd(xnum1, xnum2)

def prime(x):
	p = ceil(x ** 0.5) + 1
	for i in range(2, p):
		if x % i == 0:
			return 0
	return 1

def dfs(u, visit, graph):
	visit[u] = True
	for i in graph[u]:
		if not visit[i]:
			dfs(i, visit, graph)
num = int(z())
for _ in range(num):
	(a, b) = zz()
	t1 = max(2 * a, b)
	t2 = max(2 * b, a)
	print(min(t1, t2) ** 2)


import math
n = int(input())
for _ in range(n):
	(a, b) = list(map(int, input().split()))
	x = min(a, b)
	if 2 * x >= a + b - x:
		print((2 * x) ** 2)
	else:
		print((a + b - x) ** 2)


def min_sq(a, b):
	if a == b:
		n = 2 * a
		ar = n * n
		return ar
	first = max(a, b)
	sec = min(a, b) * 2
	ar = max(first, sec) ** 2
	return ar
t = int(input())
for _ in range(t):
	ab = input().split()
	a = int(ab[0])
	b = int(ab[1])
	print(min_sq(a, b))


def sq(a, b):
	if a == b:
		print((2 * a) ** 2)
	elif a == 2 * b or b == 2 * a:
		c = max(a, b)
		print(c ** 2)
	elif a > 2 * b or b > 2 * a:
		c = max(a, b)
		print(c ** 2)
	elif a + 1 < 2 * b or b + 1 < 2 * a:
		c = min(a, b)
		print((2 * c) ** 2)
	else:
		c = max(a, b)
		print((c + 1) ** 2)
	return
t = int(input())
temp = []
for i in range(t):
	T = input()
	temp = list(map(int, T.split()))
	a = temp[0]
	b = temp[1]
	sq(a, b)


from sys import stdin, stdout
import sys
from math import *
input = stdin.readline
for __ in range(int(input())):
	(a, b) = map(int, input().split())
	ans = max(a, b + b)
	ans = min(ans, max(a + a, b))
	print(ans * ans)


import sys
for i in range(int(sys.stdin.readline())):
	l = [int(x) for x in sys.stdin.readline().split()]
	print(max(min(l[0], l[1]) * 2, l[0], l[1]) ** 2)


t = int(input())
res = []
for i in range(t):
	(a, b) = (int(n) for n in input().split())
	r = 0
	if 2 * min(a, b) <= max(a, b):
		r = max(a, b)
	else:
		r = min(a, b) * 2
	res.append(r ** 2)
for r in res:
	print(r)


t = int(input())
for x in range(t):
	(a, b) = map(int, input().split())
	if a > b:
		(a, b) = (b, a)
	m = max(a * 2, b)
	print(m * m)


t = int(input())
p = []
for i in range(t):
	u = list(map(int, input().split()))
	p.append(u)
for i in range(t):
	if 2 * min(p[i][0], p[i][1]) > max(p[i][0], p[i][1]):
		print((2 * min(p[i][0], p[i][1])) ** 2)
	else:
		print(max(p[i][0], p[i][1]) ** 2)


from math import ceil
t = int(input())
for i in range(t):
	x = input()
	x1 = x.split()
	a = int(x1[0])
	b = int(x1[1])
	if b < a:
		temp = b
		b = a
		a = temp
	a1 = max(a + a, b)
	a2 = max(a + b, b)
	print(min(a1, a2) ** 2)


t = int(input())
for i in range(t):
	(a, b) = [int(x) for x in input().split()]
	min_num = min(a, b)
	max_num = max(a, b)
	if min_num < max_num / 2:
		print(max_num ** 2)
	else:
		print((min_num * 2) ** 2)


t = int(input())
for i in range(t):
	(yz, zx) = list(map(int, input().split()))
	d = max(2 * yz, zx)
	d1 = max(yz, 2 * zx)
	print(pow(min(d, d1), 2))


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	soln = pow(min(max(2 * a, b), max(2 * b, a)), 2)
	print(soln)


t = int(input())
for i in range(t):
	(a, b) = [int(v) for v in input().split()]
	print(pow(max(min(a, b) * 2, max(a, b)), 2))


import sys
t = sys.stdin.readline()
for i in range(int(t)):
	l = sys.stdin.readline().split()
	(a, b) = (min(int(l[0]), int(l[1])), max(int(l[0]), int(l[1])))
	m = min(max(2 * a, b), a + b)
	print(m ** 2)


for _ in range(int(input())):
	a = list(map(int, input().split()))
	a.sort()
	if 2 * a[0] <= a[1]:
		print(a[1] ** 2)
	else:
		print(4 * a[0] ** 2)


for i in range(int(input())):
	(x, y) = map(int, input().split())
	print(pow(max(x, y), 2) if max(x, y) >= 2 * min(x, y) else pow(2 * min(x, y), 2))


import sys
input = sys.stdin.readline
for t in range(int(input())):
	(a, b) = map(int, input().split())
	ans = min(max(a + a, b), max(b + b, a), max(a + b, b), max(a + b, a))
	print(ans * ans)


for case in range(int(input())):
	l = input().split(' ')
	a = int(l[0])
	b = int(l[1])
	if a > b:
		if a > 2 * b:
			ans = a * a
		else:
			ans = b * b * 4
	elif b > 2 * a:
		ans = b * b
	else:
		ans = a * a * 4
	print(ans)


from math import *
from copy import *
from string import *
from random import *
from sys import stdin
from sys import maxsize
from operator import *
from itertools import *
from collections import Counter
import math
import math
import time

def bin1(l, r, k, t, b, val, ans):
	if l > r:
		return ans
	else:
		mid = (l + r) // 2
		v = k ** mid
		if v == val:
			return v
		elif v > val:
			ans = mid
			return bin1(mid + 1, r, k, t, b, val, ans)
		else:
			return bin1(l, mid - 1, k, t, b, val, ans)

def bin2(l, r, k, t, b, val, ans):
	if l > r:
		return ans
	else:
		mid = (l + r) // 2
		v = t * k ** mid + b * mid
		if v == val:
			return v
		elif v > val:
			ans = mid
			return bin2(l, mid - 1, k, t, b, val, ans)
		else:
			return bin2(mid + 1, r, k, t, b, val, ans)

def SieveOfEratosthenes(n):
	prime = [-1 for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == -1:
			for i in range(p * p, n + 1, p):
				prime[i] = p
		p += 1
	for i in range(2, n + 1):
		if prime[i] == -1:
			prime[i] = i
	return prime

def bin(l, r, ll, val):
	if l > r:
		return -1
	else:
		mid = (l + r) // 2
		if val >= ll[mid][0] and val <= ll[mid][1]:
			return mid
		elif val < ll[mid][0]:
			return bin(l, mid - 1, ll, val)
		else:
			return bin(mid + 1, r, ll, val)

def deci(n):
	s = ''
	while n != 0:
		if n % 2 == 0:
			n = n // 2
			s = '0' + s
		else:
			n = n // 2
			s = '1' + s
	return s

def diff(s1, s2):
	if len(s1) < len(s2):
		v = len(s1)
		while v != len(s2):
			s1 = '0' + s1
			v = v + 1
	else:
		v = len(s2)
		while v != len(s1):
			s2 = '0' + s2
			v = v + 1
	c = 0
	for i in range(len(s1)):
		if s1[i:i + 1] != s2[i:i + 1]:
			c = c + 1
	return c
from sys import stdin, stdout

def fac(a, b):
	v = a
	while a != b:
		v *= a - 1
		a = a - 1
	return v

def bino(l, r, n):
	if l > r:
		return -1
	else:
		mid = (l + r) // 2
		val1 = math.log(n / mid + 1, 2)
		val2 = int(val1)
		if val1 == val2:
			return val1
		elif val1 < 1.0:
			return bino(l, mid - 1, n)
		else:
			return bino(mid + 1, r, n)

def binary(l, r, val, ans):
	if l > r:
		return -1
	else:
		mid = (l + r) // 2
		v = val ** 5 - mid ** 5
		print(v)
		if v == ans:
			print('HOHOHOH')
			return mid
		elif v < ans:
			return binary(mid + 1, r, val, ans)
		else:
			return binary(l, mid - 1, val, ans)

def check(n):
	v = 1
	while n != 0:
		if n % 10 == 0 or n % 10 == 1:
			n = n // 10
		else:
			v = 0
			break
	return v

def stairs(n, m, val, c, l):
	if val > n:
		return 100000
	elif val == n:
		if l[val] != -1:
			return l[val]
		elif c % m == 0:
			l[val] = c
			return l[val]
		else:
			l[val] = 100000
			return l[val]
	else:
		l[val] = min(stairs(n, m, val + 1, c + 1, l), stairs(n, m, val + 2, c + 1, l))
		return l[val]

def fact(n):
	if n == 0 or n == 1:
		return 1
	else:
		return n * fact(n - 1)

def some(n):
	s = 0
	while n != 0:
		s += fact(n % 10)
		n //= 10
	return s

def bin(l, r, val, ll):
	if l > r:
		return -1
	else:
		mid = (l + r) // 2
		if ll[mid] == val:
			return mid
		elif ll[mid] > val:
			return bin(l, mid - 1, val, ll)
		else:
			return bin(mid + 1, r, val, ll)

def fn(n):
	c = -1
	for i in range(2, int(sqrt(n)) + 1):
		if n % 2 == 0:
			c = i
			break
	if c == -1:
		c = n
	return c

def check(n):
	val = 0
	while n != 0:
		if n % 10 > 1:
			val = -1
			break
		n = n // 10
	return val
t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	print(max(2 * min(a, b), max(a, b)) ** 2)


from sys import stdin, stdout
for _ in range(int(stdin.readline())):
	(n, m) = map(int, stdin.readline().split())
	print(max(2 * min(n, m), max(n, m)) ** 2)


for i in range(int(input())):
	(a, b) = [int(elem) for elem in input().split()]
	(min_l, max_l) = (min(a, b), max(a, b))
	if 2 * min_l >= max_l:
		print(2 * min_l * 2 * min_l)
	else:
		print(max_l * max_l)


n = int(input())
for i in range(n):
	x = list(map(int, input().split()))
	a = x[0]
	b = x[1]
	(a, b) = (min(a, b), max(a, b))
	print(max(b ** 2, 4 * a ** 2))


t = int(input())
a = []
for _ in range(t):
	a.append(tuple(map(int, input().split(' '))))
for c in a:
	print(min(max(2 * c[1], c[0]), max(2 * c[0], c[1])) ** 2)


import math
from math import gcd
t = int(input())
cnt = 0
ans = 0
for i in range(t):
	(a, b) = map(int, input().split())
	if 2 * min(a, b) > max(a, b):
		print((2 * min(a, b)) ** 2)
	else:
		print(max(a, b) ** 2)


t = int(input())
for i in range(0, t):
	(a, b) = map(int, input().split())
	m = min(a, b)
	x = max(a, b)
	print(max(2 * m, x) ** 2)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	s = 2 * min(a, b)
	if s < max(a, b):
		s = max(a, b)
	area = s * s
	print(area)


t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	if a == b:
		print(4 * a * b)
	elif a < b:
		x = max(2 * a, b)
		print(x * x)
	elif b < a:
		x = max(2 * b, a)
		print(x * x)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	area = 2 * a * b
	if a >= b:
		big = a
		small = b
	else:
		big = b
		small = a
	print(max(2 * small, big) ** 2)


def fun():
	(a, b) = map(int, input().split())
	if a < b:
		(a, b) = (b, a)
	if a < b * 2:
		return (b * 2) ** 2
	if a == b * 2:
		return a ** 2
	if a == b:
		return a ** 2 * 4
	if a > b * 2:
		return a ** 2
n = int(input())
while n != 0:
	print(fun())
	n -= 1


n1 = int(input())
for i in range(n1):
	sides = [int(n) for n in input().split()]
	a = sides[0]
	b = sides[1]
	c = min(a, b)
	d = max(a, b)
	if 2 * c < d:
		print(d ** 2)
	else:
		print((2 * c) ** 2)


def square(a, b):
	val1 = max(2 * b, a)
	val2 = max(2 * a, b)
	ans = min(val1, val2)
	return ans ** 2
t = int(input())
for i in range(t):
	x = list(map(int, input().rstrip().split()))
	a = x[0]
	b = x[1]
	print(square(a, b))


from collections import defaultdict as dfd
import math
import sys
import heapq

def II():
	return int(sys.stdin.readline())

def MI():
	return map(int, sys.stdin.readline().split())

def LI():
	return list(map(int, sys.stdin.readline().split()))

def LLI(rows_number):
	return [LI() for _ in range(rows_number)]

def main():
	for _ in range(II()):
		(a, b) = MI()
		print(max(min(a, b) * 2, max(a, b)) ** 2)
main()


t = int(input())
for _ in range(t):
	inp = list(map(int, input().split()))
	p = min(inp[0], inp[1])
	q = max(inp[0], inp[1])
	if 2 * p > q:
		a = 2 * p * (2 * p)
	else:
		a = q * q
	print(a)


from sys import stdin, stdout
t = int(stdin.readline())
for _ in range(t):
	(a, b) = map(int, stdin.readline().split())
	l = max(max(a, b), min(a, b) * 2)
	print(l ** 2)


n = int(input())

def solve(a, b):
	return min(max(2 * a, b) ** 2, max(2 * b, a) ** 2)
for _ in range(n):
	(a, b) = list(map(int, input().split()))
	print(solve(a, b))


cases = int(input())
for _ in range(cases):
	(a, b) = map(int, input().split())
	if a > b:
		if a <= 2 * b:
			print(pow(2 * b, 2))
		else:
			print(pow(a, 2))
	elif b > a:
		if b <= 2 * a:
			print(pow(2 * a, 2))
		else:
			print(pow(b, 2))
	else:
		print(pow(2 * a, 2))


import os
os_input = os.read(0, int(10000000.0)).split()
os_input_pos = -1

def cin():
	global os_input_pos
	os_input_pos += 1
	return os_input[os_input_pos]
T = int(cin())
res = []
while T:
	T -= 1
	a = int(cin())
	b = int(cin())
	res.append(str(max(2 * min(a, b), max(a, b)) ** 2).encode())
os.write(1, '\n'.encode().join(res))


for i in range(int(input())):
	(a, b) = list(map(int, input().split()))
	c = max(2 * a, b)
	d = max(a, 2 * b)
	e = min(c, d)
	print(e * e)


for n in range(int(input())):
	(x, y) = map(int, input().split())
	res = max(max(x, y), 2 * min(x, y))
	print(res * res)


def min_square(a, b):
	if a > 2 * b or b > 2 * a:
		return max(a, b) ** 2
	else:
		return min(4 * a ** 2, 4 * b ** 2)
t = int(input())
for i in range(t):
	(a, b) = list(map(int, input().split()))
	print(min_square(a, b))


def main():
	t = int(input())
	for _ in range(t):
		(a, b) = [int(x) for x in input().split()]
		print(max(max(a, b) ** 2, min(a, b) ** 2 * 4))
main()


n = int(input())
for t in range(n):
	b = input().split()
	(l, b) = (int(b[0]), int(b[1]))
	if l < b:
		(l, b) = (b, l)
	ans = max(l, b * 2)
	print(ans * ans)


from sys import stdin
from math import ceil, sqrt
input = stdin.readline

def list_input():
	return list(map(int, input().split()))

def sep_input():
	return map(int, input().split())
for _ in range(int(input())):
	l = list_input()
	l.sort()
	n = l[0]
	m = l[1]
	print(max(m ** 2, (2 * n) ** 2))


import sys
import math
from copy import copy, deepcopy
from copy import deepcopy as dcp
from operator import itemgetter
from bisect import bisect_left, bisect, bisect_right
from collections import deque
from collections import Counter
from itertools import accumulate, combinations, permutations
from heapq import heapify, heappop, heappush
from functools import lru_cache

def input():
	return sys.stdin.readline()[:-1]

def printl(li):
	_ = print(*li, sep='\n') if li else None

def argsort(s, return_sorted=False):
	inds = sorted(range(len(s)), key=lambda k: s[k])
	if return_sorted:
		return (inds, [s[i] for i in inds])
	return inds

def alp2num(c, cap=False):
	return ord(c) - 97 if not cap else ord(c) - 65

def num2alp(i, cap=False):
	return chr(i + 97) if not cap else chr(i + 65)

def matmat(A, B):
	(K, N, M) = (len(B), len(A), len(B[0]))
	return [[sum([A[i][k] * B[k][j] for k in range(K)]) for j in range(M)] for i in range(N)]

def matvec(M, v):
	(N, size) = (len(v), len(M))
	return [sum([M[i][j] * v[j] for j in range(N)]) for i in range(size)]

def T(M):
	(n, m) = (len(M), len(M[0]))
	return [[M[j][i] for j in range(n)] for i in range(m)]

def main():
	mod = 1000000007
	N = int(input())
	S = tuple((tuple(map(int, input().split())) for i in range(N)))
	for (a, b) in S:
		print(max(min(a, b) * 2, max(a, b)) ** 2)
main()


test_cases = int(input())
for z in range(test_cases):
	(a, b) = list(map(int, input().split()))
	x = max(a, b)
	y = min(a, b)
	if 2 * y >= x:
		print((2 * y) ** 2)
	elif x > 2 * y:
		print(x ** 2)


testcases = int(input())
for i in range(testcases):
	(a, b) = map(int, input().split())
	mins = min(a, b)
	maxs = max(a, b)
	if mins * 2 < maxs:
		print(maxs ** 2)
	else:
		print((mins * 2) ** 2)


t = int(input())
while t:
	t -= 1
	(a, b) = list(map(int, input().split()))
	mini = max(2 * min(a, b), max(a, b))
	print(mini ** 2)


import math
N = int(input())
for i in range(N):
	a = list(map(int, input().strip().split()))
	a.sort(reverse=True)
	l = a[0]
	b = a[1]
	ar = 2 * (l * b)
	num = math.floor(ar ** 0.5)
	if num >= l and num >= 2 * b:
		print(num ** 2)
	elif num >= l and num <= 2 * b:
		num = 2 * b
		print(num ** 2)
	elif num < l and num >= 2 * b:
		num = l
		print(num ** 2)
	elif num <= l and num <= 2 * b:
		if l > 2 * b:
			num = l
			print(num ** 2)
		elif l < 2 * b:
			num = 2 * b
			print(num ** 2)


t = int(input())
for i in range(t):
	(x, y) = [int(x) for x in input().split()]
	if x < y:
		s = x
		l = y
	else:
		s = y
		l = x
	if 2 * s < l:
		print(l * l)
	else:
		print(4 * s * s)


numberOfTestCases = int(input())
result = []
for i in range(numberOfTestCases):
	(a, b) = map(int, input().split(' '))
	if a < b:
		(a, b) = (b, a)
	if a == b:
		area = a ** 2 * 4
	elif a >= 2 * b:
		area = a ** 2
	else:
		area = (2 * b) ** 2
	result.append(area)
for j in result:
	print(j)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	mini = min(a, b)
	maxi = max(a, b)
	mini = mini + mini
	ans = max(mini, maxi)
	print(ans * ans)


x = int(input())
for i in range(x):
	(a, b) = map(int, input().split())
	if a < b:
		c = a
		a = b
		b = c
	if 2 * b < a:
		print(a * a)
	else:
		print(4 * b * b)


t = int(input())
for _ in range(t):
	(b, l) = map(int, input().split())
	low = min(b, l) * 2
	ans = low ** 2
	if low < max(b, l):
		ans = max(b, l) ** 2
	print(ans)


for x in range(int(input())):
	(a, b) = map(int, input().strip().split()[:2])
	if a == b:
		print((a * 2) ** 2)
	elif a == 1 or b == 1:
		print(max(a, b) ** 2)
	else:
		print(max(max(a, b), 2 * min(a, b)) ** 2)


import math
t = int(input())
while t > 0:
	k = 0
	(l, b) = map(int, input().strip().split())
	if l > b:
		if b <= l / 2:
			print(l * l)
		elif b > l / 2:
			if b > l:
				print(4 * (l * l))
			elif b < l:
				print(4 * (b * b))
	if b > l:
		if l <= b / 2:
			print(b * b)
		elif l > b / 2:
			if b > l:
				print(4 * (l * l))
			elif b < l:
				print(4 * (b * b))
	if l == b:
		print(4 * (l * l))
	t = t - 1


import sys
input = sys.stdin.readline
t = int(input())
for test in range(t):
	(a, b) = list(map(int, input().split()))
	M = max(a, b)
	m = min(a, b)
	m_1 = 2 * m
	side = max(M, m_1)
	print(side ** 2)


k = int(input())
for i in range(k):
	s = input()
	s = s.split()
	a = int(s[0])
	b = int(s[1])
	if a < b:
		a *= 2
		print(max(a, b) ** 2)
	elif b < a:
		b *= 2
		print(max(a, b) ** 2)
	else:
		print((a + b) ** 2)


t = int(input())
lst = []
for i in range(t):
	b = input().split(' ')
	a = int(b[0])
	b = int(b[1])
	if a < b:
		minD = a
		maxD = b
	else:
		minD = b
		maxD = a
	if minD * 2 > maxD:
		lst.append((minD * 2) ** 2)
	else:
		lst.append(maxD ** 2)
for i in lst:
	print(i)


from sys import stdin, stdout

def find(M, N):
	return max(2 * min(M, N), max(M, N)) ** 2
	pass

def main():
	for _ in range(int(stdin.readline())):
		(N, M) = list(map(int, stdin.readline().split()))
		print(find(M, N))
main()


t = int(input())
for we in range(t):
	(a, b) = map(int, input().split())
	s1 = max(a, 2 * b) * max(a, 2 * b)
	s2 = max(2 * a, b) * max(2 * a, b)
	print(min(s1, s2))


t = int(input())
for i in range(t):
	line = input()
	lis = line.split()
	ar = list()
	ar.append(int(lis[0]))
	ar.append(int(lis[1]))
	ar.sort()
	a = int(ar[0])
	b = int(ar[1])
	if a * 2 >= b:
		ans = (a * 2) ** 2
	else:
		ans = b ** 2
	print(ans)


import sys
from collections import defaultdict as dd

def eprint(*args):
	print(*args, file=sys.stderr)
zz = 1
import copy
if zz:
	input = sys.stdin.readline
else:
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('all.txt', 'w')

def li():
	return [int(x) for x in input().split()]

def fi():
	return int(input())

def si():
	return list(input().rstrip())

def mi():
	return map(int, input().split())

def bo(i):
	return ord(i) - ord('a')
t = fi()
while t > 0:
	t -= 1
	(a, b) = mi()
	print(max(min(a, b) * 2, max(a, b)) ** 2)


case_n = int(input())
ans = []
for i in range(case_n):
	a_b = input()
	a = int(a_b.split(' ')[0])
	b = int(a_b.split(' ')[1])
	if a == b:
		ans.append((a * 2) ** 2)
	elif a > b:
		if b * 2 < a:
			ans.append(a ** 2)
		else:
			ans.append((b * 2) ** 2)
	elif a * 2 < b:
		ans.append(b ** 2)
	else:
		ans.append((a * 2) ** 2)
for i in ans:
	print(i)


def read_int():
	n = int(input())
	return n

def read_ints():
	ints = [int(x) for x in input().split(' ')]
	return ints

def solve(a, b):
	min_side = min(a, b) * 2
	max_dim = max(a, b, min_side)
	return max_dim ** 2
t = read_int()
for case in range(t):
	(a, b) = read_ints()
	sol = solve(a, b)
	print(sol)


from sys import stdin
for i in range(int(input())):
	[a, b] = [int(x) for x in stdin.readline().split()]
	if b < a:
		c = a
		a = b
		b = c
	if b < 2 * a:
		print((2 * a) ** 2)
	else:
		print(b ** 2)


n = int(input())
a = list()
b = list()
for i in range(n):
	a = input().split()
	if int(a[0]) == int(a[1]):
		b.append(int(a[0]) * int(a[1]) * 4)
	elif int(a[0]) > int(a[1]):
		if int(a[0]) >= 2 * int(a[1]):
			b.append(int(a[0]) * int(a[0]))
		else:
			b.append(int(a[1]) * int(a[1]) * 4)
	elif int(a[0]) < int(a[1]):
		if 2 * int(a[0]) <= int(a[1]):
			b.append(int(a[1]) * int(a[1]))
		else:
			b.append(int(a[0]) * int(a[0]) * 4)
	a.clear()
for i in b:
	print(i)


from sys import stdin
N = int(stdin.readline())
for case in range(N):
	(a, b) = map(int, stdin.readline().split())
	smaller = min(a, b)
	larger = max(a, b)
	side = max(2 * smaller, larger)
	print(side ** 2)


for x in range(int(input())):
	(h, m) = list(map(int, input().split()))
	k = max(2 * min(h, m), max(h, m))
	print(k * k)


t = int(input())
for i in range(t):
	(a, b) = input().split()
	a = int(a)
	b = int(b)
	mn = min(a, b)
	val = 2 * mn
	if val >= max(a, b):
		ans = val * val
	else:
		res = max(a, b)
		ans = res * res
	print(ans)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	if a == 1 and b == 1:
		print(4)
	elif a == 1 or b == 1:
		print(max(a, b) ** 2)
	else:
		a1 = max(2 * a, b) ** 2
		a2 = max(a, 2 * b) ** 2
		a3 = (b + a) ** 2
		print(min(a1, a2, a3))


for t in range(int(input())):
	(a, b) = map(int, input().split())
	side1 = max(a, b)
	side2 = min(a, b)
	res = max(side1, side2 * 2)
	area = res ** 2
	print(area)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	z = min(a, b) * 2
	zz = max(max(a, b), z)
	print(zz ** 2)


A = int(input(''))
for a in range(A):
	(x, y) = input().split()
	x = int(x)
	y = int(y)
	z = 0
	q = 0
	l = []
	if x == y:
		z = x + y
	elif x > y:
		if 2 * y > x:
			z = 2 * y
		else:
			z = x
	elif 2 * x > y:
		z = 2 * x
	else:
		z = y
	f = z ** 2
	print(f)


import sys
import math

def I():
	return int(sys.stdin.readline())

def IL():
	return list(map(int, sys.stdin.readline().strip().split()))

def ILS():
	return list(map(str, sys.stdin.readline().strip().split()))
t = I()
for i in range(t):
	(n, m) = IL()
	x = min(n, m)
	x = max(max(2 * x, n), m)
	print(x * x)


def codeforces(a, b):
	if a == b:
		p = a + b
		return p * p
	if a < b:
		s = 2 * a
		if s > b:
			return s * s
		else:
			return b * b
	else:
		s = 2 * b
		if s > a:
			return s * s
		else:
			return a * a
n = int(input())
for i in range(n):
	(a, b) = [int(ele) for ele in input().split()]
	res = codeforces(a, b)
	print(res)


from sys import stdin, stdout

def main():
	t = int(stdin.readline())
	for _ in range(t):
		(a, b) = list(map(int, stdin.readline().split()))
		mn = min(max(a * 2, b), max(a, b * 2))
		mn *= mn
		stdout.write(str(mn) + '\n')
main()


for _ in range(int(input())):
	(x, y) = list(map(int, input().split()))
	m = min(x, y)
	ma = max(x, y)
	if 2 * m >= ma:
		print((2 * m) ** 2)
	else:
		print(ma ** 2)


def sqr(x):
	return x * x
n = int(input())
for i in range(n):
	x = input().split()
	x = list(map(int, x))
	y = min(x[0], x[1])
	z = max(x[0], x[1])
	print(sqr(max(z, y * 2)))


T = int(input())
while T > 0:
	(a, b) = [int(el) for el in input().split(' ')]
	(n, k) = (min(a, b), max(a, b))
	if k / 2 <= n:
		print(4 * n ** 2)
	else:
		print(k ** 2)
	T -= 1


t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	(mini, maxx) = (0, 0)
	if a < b:
		(mini, maxx) = (a, b)
	else:
		(mini, maxx) = (b, a)
	if 2 * mini >= maxx:
		print((2 * mini) ** 2)
	else:
		print(maxx ** 2)


def solution(n, m):
	side = max(min(n, m) * 2, max(n, m))
	print(side ** 2)
inp = int(input())
for _ in range(inp):
	(n, m) = tuple(map(int, input().split()))
	solution(n, m)


def solve():
	(a, b) = map(int, input().split())
	if a != b:
		if a > b:
			c = abs(2 * b - a)
			if 2 * b > a:
				print((c + a) ** 2)
			else:
				print((c + 2 * b) ** 2)
		else:
			d = abs(2 * a - b)
			if 2 * a > b:
				print((d + b) ** 2)
			else:
				print((d + 2 * a) ** 2)
	else:
		print(a * b * 4)

def main():
	t = int(input())
	for _ in range(t):
		solve()
main()


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	large = max(a, b)
	small = 2 * min(a, b)
	print(max(large, small) ** 2)


def ans(a, b):
	M = max(a, b)
	N = min(a, b)
	breadth = 2 * N
	if breadth >= M:
		return breadth ** 2
	else:
		return M ** 2
n = int(input())
L = []
for i in range(n):
	L.append([int(x) for x in input().split()])
for (a, b) in L:
	print(ans(a, b))


import sys
input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())
t = inp()
for i in range(t):
	d = inlt()
	mi = min(d)
	ma = max(d)
	mind = max(2 * mi, ma)
	print(mind * mind)


import math
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	x = min(a, b)
	y = max(a, b)
	print(max(2 * x, y) * max(2 * x, y))


for i in range(int(input())):
	(l, b) = map(int, input().split())
	if l >= b:
		b = 2 * b
	else:
		l = 2 * l
	j = max(l, b)
	print(j * j)


t = int(input())
for n in [list(map(int, input().split())) for i in range(t)]:
	print(pow(max(min(n) * 2, max(n)), 2))


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	if n == k:
		num = n + k
	else:
		num1 = min(n, k)
		num2 = max(n, k)
		num = max(2 * num1, num2)
	print(num * num)


for _ in range(int(input())):
	(a, b) = list(map(int, input().split()))
	min_num = min(a, b)
	max_num = max(a, b)
	if min_num * 2 >= max_num:
		print((min_num * 2) ** 2)
	else:
		print(max_num ** 2)


for _ in range(int(input())):
	(n, m) = map(int, input().strip().split())
	a = max(n, m)
	b = min(n, m)
	print(max(2 * b, a) ** 2)


import math
t = int(input())
while t > 0:
	(a, b) = map(int, input().split())
	if a == b:
		print(4 * a * b)
		t -= 1
		continue
	x = min(a, b)
	if max(a, b) > 2 * x:
		x = max(a, b)
		print(x * x)
		t -= 1
		continue
	print(4 * x * x)
	t -= 1


import math
el = int(input())
for j in range(el):
	ar = []
	for i in input().split():
		ar.append(int(i))
	temp = max(ar)
	temp2 = min(ar)
	print(max(temp * temp, 2 * temp2 * (2 * temp2)))


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	if a < b:
		q = 2 * a
		if q >= b:
			print(pow(q, 2))
		else:
			print(pow(b, 2))
	else:
		q = 2 * b
		if q >= a:
			print(pow(q, 2))
		else:
			print(pow(a, 2))


from sys import stdin, gettrace
if not gettrace():

	def input():
		return next(stdin)[:-1]

def main():

	def solve():
		(a, b) = map(int, input().split())
		if a < b:
			(b, a) = (a, b)
		print(max(a, b * 2) ** 2)
	q = int(input())
	for _ in range(q):
		solve()
main()


t = int(input())
x = 0
for _ in range(t):
	(a, b) = map(int, input().split())
	if a >= b:
		if a <= 2 * b:
			print(pow(2 * b, 2))
		elif a > 2 * b:
			print(pow(a, 2))
	elif 2 * a >= b:
		print(pow(2 * a, 2))
	else:
		print(pow(b, 2))


for i in range(int(input())):
	(a, b) = map(int, input().split())
	c = 10 ** 18
	if 2 * a >= b:
		c = min(c, (2 * a) ** 2)
	if 2 * b >= a:
		c = min(c, (2 * b) ** 2)
	c = min(c, (a + b) ** 2)
	if a >= 2 * b:
		c = min(c, a ** 2)
	if b >= 2 * a:
		c = min(c, b ** 2)
	print(c)


from sys import stdin
inp = lambda : stdin.readline().strip()
t = int(inp())
for _ in range(t):
	(a, b) = [int(x) for x in inp().split()]
	minimum = min(a, b)
	maximum = max(a, b)
	print(max(maximum, 2 * minimum) ** 2)


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
testcases = int(input())
for j in range(testcases):
	(a, b) = map(int, input().split())
	minl = min(a, b)
	maxl = max(a, b)
	length = 0
	if 2 * minl >= maxl:
		length = 2 * minl
	elif 2 * minl < maxl:
		length = maxl
	print(length ** 2)


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	if 2 * min(a, b) <= max(a, b):
		print(max(a, b) * max(a, b))
	else:
		l = [2 * a, 2 * b, a + b]
		l.sort()
		for j in l:
			if j >= a and j >= b:
				print(j * j)
				break


t = int(input())
a = list()
b = list()
for i in range(t):
	inputs = input()
	(ai, bi) = list(map(int, inputs.split(' ')))
	a.append(ai)
	b.append(bi)
for i in range(t):
	if a[i] == b[i]:
		print(4 * a[i] ** 2)
	elif a[i] == 2 * b[i]:
		print(a[i] ** 2)
	elif b[i] == 2 * a[i]:
		print(b[i] ** 2)
	elif a[i] > 2 * b[i]:
		print(a[i] ** 2)
	elif b[i] > 2 * a[i]:
		print(b[i] ** 2)
	elif a[i] > b[i]:
		print(4 * b[i] ** 2)
	else:
		print(4 * a[i] ** 2)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	yo = max(a, b)
	yo2 = min(a, b)
	if 2 * yo2 < yo:
		print(yo ** 2)
	else:
		print((2 * yo2) ** 2)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	s = a * b * 2
	s1 = 4 * min(a, b) * min(a, b)
	s2 = max(a, b) * max(a, b)
	if s1 > s:
		print(s1)
	else:
		print(s2)


import os
import sys
from io import BytesIO, IOBase
from collections import Counter
from collections import deque
import heapq
import math
import statistics

def sin():
	return input()

def ain():
	return list(map(int, sin().split()))

def sain():
	return input().split()

def iin():
	return int(sin())
MAX = float('inf')
MIN = float('-inf')

def main():
	for _ in range(iin()):
		(a, b) = ain()
		if a == b:
			print((a + b) ** 2)
		else:
			(a, b) = (min(a, b), max(a, b))
			if 2 * a >= b:
				print((2 * a) ** 2)
			else:
				print(b ** 2)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


t = int(input())
lyst = []
for q in range(t):
	(a, b) = [int(i) for i in input().split(' ')]
	lyst.append(a)
	lyst.append(b)
	lyst.sort(reverse=True)
	if lyst[0] > 2 * lyst[1]:
		print(lyst[0] ** 2)
	else:
		print((2 * lyst[1]) ** 2)
	lyst = []


t = int(input())
output = []
for _ in range(t):
	(a, b) = list(map(int, input().split()))
	big = 0
	if a > b:
		big = a
		small = b
	elif a == b:
		big = a
		small = b
	else:
		big = b
		small = a
	if a != b and 2 * small > big:
		output.append(4 * small ** 2)
	elif a != b and 2 * small < big:
		output.append(big ** 2)
	elif a != b and 2 * small == big:
		output.append(big ** 2)
	else:
		output.append(4 * big ** 2)
for item in output:
	print(item)


def strLine():
	return input().split()

def intLine():
	return map(int, input().split())

def FloatLine():
	return map(float, input().split())

def readInt():
	return int(input())

def __main():
	t = readInt()
	while t:
		t -= 1
		(a, b) = intLine()
		mx = min(max(a, 2 * b), max(a * 2, b))
		print(mx * mx)
__main()


for _ in range(int(input())):
	(a, b) = map(int, input().strip().split())
	if a <= b:
		m = a
		mm = b
	else:
		m = b
		mm = a
	if 2 * m >= mm:
		print((2 * m) ** 2)
	else:
		print(mm ** 2)


T = int(input())
for i in range(T):
	(a, b) = list(map(int, input().split()))
	s = a + b
	c1 = s * s
	su = a + a
	ma = max(su, b)
	c2 = ma * ma
	su = b + b
	ma = max(su, a)
	c3 = ma * ma
	print(min(c1, c2, c3))


def function(x, y):
	if x == y:
		return pow(x * 2, 2)
	else:
		x1 = min(x, y)
		y1 = max(x, y)
		if x1 * 2 >= y1:
			return pow(x1 * 2, 2)
		else:
			return pow(y1, 2)
n = int(input())
for i in range(n):
	(a, b) = input().split()
	(a, b) = [int(a), int(b)]
	m = function(a, b)
	print(m)


t = int(input())
for i in range(t):
	x = input().split()
	(x[0], x[1]) = (int(x[0]), int(x[1]))
	max = x[0] if x[0] > x[1] else x[1]
	min = (x[0] if x[0] < x[1] else x[1]) * 2
	max2 = max if max > min else min
	print(max2 * max2)


t = int(input())
for item in range(t):
	(a, b) = input().split()
	(a, b) = (int(a), int(b))
	if a > b:
		(a, b) = (b, a)
	if b <= 2 * a:
		print((2 * a) ** 2)
	else:
		print(b ** 2)


import sys
from math import tan, pi, cos, sin
_INPUT_LINES = sys.stdin.read().splitlines()
input = iter(_INPUT_LINES).__next__
from itertools import islice, cycle

def go():
	(a, b) = map(int, input().split())
	(a, b) = (min(a, b), max(a, b))
	return max(2 * a, b) ** 2
t = int(input())
ans = []
for _ in range(t):
	ans.append(str(go()))
print('\n'.join(ans))


import math
number_of_test_cases = int(input())
for i in range(number_of_test_cases):
	(x, y) = sorted([int(i) for i in input().split()])
	if x * 2 < y:
		print(y * y)
	else:
		print(2 * x * 2 * x)


import sys

def read():
	return sys.stdin.readline().strip()

def write(a):
	sys.stdout.write(a)

def solve(a, b):
	(a, b) = (max(a, b), min(a, b))
	if b * 2 <= a:
		x = a
	else:
		x = 2 * b
	return x * x

def bruh():
	t = int(read())
	ans = [0] * t
	for i in range(t):
		(a, b) = [int(i) for i in read().split()]
		ans[i] = solve(a, b)
	write('\n'.join(map(str, ans)))
bruh()


from sys import stdin, stdout
lis = lambda : list(map(int, input().split()))
ma = lambda : map(int, input().split())
inte = lambda : int(input())
st = lambda : input()
for i in range(inte()):
	(a, b) = ma()
	print(pow(max(2 * min(a, b), max(a, b)), 2))


def solve():
	(n, k) = [int(x) for x in input().split()]
	mn = min(n, k)
	mx = max(n, k)
	if mn * 2 >= mx:
		print((mn * 2) ** 2)
	else:
		print(mx ** 2)
t = int(input())
for i in range(t):
	solve()


for _ in range(int(input())):
	(l, b) = map(int, input().split())
	if 2 * l > b:
		x = 4 * l ** 2
	else:
		x = b ** 2
	if 2 * b > l:
		y = 4 * b ** 2
	else:
		y = l ** 2
	print(min(x, y))


T = int(input())
ab = [list(map(int, input().split())) for _ in range(T)]
for i in range(T):
	(a, b) = (ab[i][0], ab[i][1])
	print(max(min(a, b) * 2, max(a, b)) ** 2)


for query in range(int(input())):
	ab = [int(x) for x in input().split()]
	ab = sorted(ab)
	print(max(2 * ab[0], ab[1]) ** 2)


t = int(input())
while t:
	(a, b) = map(int, input().split())
	if a == b:
		print(4 * a * b)
	elif a <= b / 2 or b <= a / 2:
		print(max(a, b) ** 2)
	else:
		print((min(a, b) * 2) ** 2)
	t = t - 1


n = int(input())
for _ in range(n):
	(a, b) = map(int, input().split())
	s = 0
	if 2 * a > 2 * b:
		s = 2 * b if 2 * b > a else a
	else:
		s = 2 * a if 2 * a > b else b
	print(s * s)


t = int(input())
for _ in range(0, t):
	s = input().split()
	a = int(s[0])
	b = int(s[1])
	if a < b:
		(a, b) = (b, a)
	if 2 * b >= a:
		ans = 4 * b * b
	elif 2 * b < a:
		ans = a * a
	print(ans)


(t,) = map(int, input().split())
for _ in range(t):
	(a, b) = map(int, input().split())
	(mn, mx) = (min(a, b), max(a, b))
	x = max(mn * 2, mx)
	print(x ** 2)


def so(m, n):
	(area, h, v) = (m * n * 2, 2 * m, 2 * n)
	cursq = max(m, n)
	while 1:
		if (cursq >= h or cursq >= v) and cursq ** 2 >= area:
			break
		cursq += 1
	return cursq ** 2
for i in range(int(input())):
	print(so(*list(map(int, input().split()))))


def Sol(l, b):
	if 2 * b >= l and b <= l:
		return b * b * 4
	elif 2 * l >= b and l < b:
		return l * l * 4
	if l > b:
		return l * l
	return b * b
T = int(input())
for i in range(T):
	(n, k) = list((int(x) for x in input().strip().split()))[:2]
	print(Sol(n, k))


def parse():
	t = int(input())
	for d in range(t):
		(a, b) = [int(num) for num in input().split(' ')]
		length = max(max(a, b), min(a * 2, b * 2))
		print(length * length)
parse()


from sys import stdin

def main():
	input = lambda : stdin.readline()[:-1]
	T = int(input())
	for _ in [0] * T:
		(A, B) = map(int, input().split())
		l = max(min(A, B) * 2, max(A, B))
		print(l * l)
main()


for _ in range(int(input())):
	ab = list(map(int, input().split()))
	if ab[0] == ab[1]:
		print(2 * ab[0] ** 2 * 2)
	elif min(ab) * 2 > max(ab):
		print((2 * min(ab)) ** 2)
	else:
		print(max(ab) ** 2)


import math
from collections import defaultdict
import itertools
import random

def solve(a, b):
	if a < b:
		(a, b) = (b, a)
	if 2 * b >= a:
		print(4 * b * b)
	else:
		print(a * a)
t = int(input())
for _ in range(t):
	(a, b) = [int(x) for x in input().split()]
	solve(a, b)


for i in range(int(input())):
	(a, b) = (int(j) for j in input().split())
	if a > b:
		(a, b) = (b, a)
	print(max(2 * a, b) * max(2 * a, b))


import sys

def input():
	return sys.stdin.readline()[:-1]

def main():
	for _ in range(int(input())):
		(a, b) = map(int, input().split())
		if a < b:
			(a, b) = (b, a)
		for k in range(1, 201):
			if k >= a and k >= b + b:
				print(k * k)
				break
main()


t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	big = max(a, b)
	small = min(a, b)
	while small * 2 > big:
		big += 1
	print(big * big)


t = int(input())
for j in range(t):
	(a, b) = input().split()
	a = int(a)
	b = int(b)
	Area = int(a * b * 2)
	start = max(a, b)
	for i in range(start, 201):
		h = i * i
		if i < a * 2 and i < b * 2:
			continue
		if h >= Area:
			print(h)
			break


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	(a, b) = (max(a, b), min(a, b))
	if 2 * b == a or a > 2 * b:
		print(a * a)
		continue
	elif 2 * b > a:
		print(4 * b * b)
		continue


for _ in range(int(input())):
	(n, m) = map(int, input().split())
	c = max(n, m)
	k = min(n, m)
	l = max(2 * k, c)
	print(l * l)


num = int(input())
for _ in range(num):
	(a, b) = [int(i) for i in input().split()]
	max_ = max(a, b)
	min_ = min(a, b)
	if max_ >= 2 * min_:
		print(max_ ** 2)
	else:
		print((2 * min_) ** 2)


t = int(input())
rez = []
for i in range(t):
	A = input().split(' ')
	a = int(A[0])
	b = int(A[1])
	rez.append(max(max(a, b), 2 * min(a, b)) ** 2)
for i in range(len(rez)):
	print(rez[i])


t = int(input())
while t:
	t -= 1
	(a, b) = [int(i) for i in input().split()]
	if a > b:
		(b, a) = (a, b)
	print(max(b * b, 4 * a * a))


import io, os
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
import sys

def main():
	t = int(input())
	for _ in range(t):
		(a, b) = map(int, input().split())
		if a < b:
			(a, b) = (b, a)
		l = max(a, b * 2)
		ans = l ** 2
		sys.stdout.write(str(ans) + '\n')
main()


import queue
import math
t = int(input())
while t:
	line = input().split()
	(a, b) = (int(line[0]), int(line[1]))
	if a > b:
		(a, b) = (b, a)
	if 2 * a >= b:
		print(4 * a * a)
	else:
		print(b * b)
	t -= 1


t = int(input())
for i in range(t):
	(a, s) = map(int, input().split())
	f = min(a, s)
	g = max(a, s, 2 * f)
	print(g * g)


an = []
t = int(input())
for i in range(t):
	(n, m) = map(int, input().split())
	v = min(n, m)
	v = v + v
	ans = max(max(n, m), v) ** 2
	an.append(ans)
for i in range(t):
	print(an[i])


t = int(input())
s = []
for i in range(t):
	(a, b) = map(int, input().split())
	if a == b:
		s.append((2 * a) ** 2)
	elif a > b:
		dub = 2 * b
		if a >= dub:
			s.append(a ** 2)
		else:
			s.append(dub ** 2)
	else:
		dub = 2 * a
		if b >= dub:
			s.append(b ** 2)
		else:
			s.append(dub ** 2)
for item in s:
	print(item)


def main():
	for __ in [0] * int(input()):
		(a, b) = map(int, input().split())
		ans = 10 ** 10
		ans = min(ans, max(2 * a, b) ** 2)
		ans = min(ans, max(2 * b, a) ** 2)
		print(ans)
main()


t = int(input())
for r in range(t):
	(a, b) = list(map(int, input().split()))
	if a == 1 and b == 1:
		print(4 * b ** 2)
	elif b == 1:
		print(a ** 2)
	elif a == 1:
		print(b ** 2)
	elif 2 * min(a, b) >= max(a, b):
		print(4 * min(a, b) ** 2)
	else:
		print(max(a, b) ** 2)


from sys import stdin
for case in range(int(stdin.readline())):
	(a, b) = [int(x) for x in stdin.readline().split()]
	high = max(a, b)
	low = min(a, b)
	print(max(high, low * 2) ** 2)


t = int(input(''))
for i in range(t):
	(a, b) = map(int, input('').split())
	if a > b:
		if a * a >= 2 * a * b:
			print(a * a)
		else:
			while True:
				a += 1
				if a * a >= 2 * a * b:
					print(a * a)
					break
	elif a < b:
		if b * b >= 2 * a * b:
			print(b * b)
		else:
			while True:
				b += 1
				if b * b >= 2 * a * b:
					print(b * b)
					break
	else:
		print(4 * a * a)


t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	k = min(a, b)
	k1 = max(a, b)
	c = k * 2
	print(max(c, k1) ** 2)


def main():
	t = int(input())
	for _t in range(t):
		i = list(map(int, input().split()))
		(a, b) = (i[0], i[1])
		x = 2 * min(a, b)
		y = max(a, b)
		if x > y:
			print(x * x)
		else:
			print(y * y)
main()


import sys
input = sys.stdin.buffer.readline

def solution():
	for _ in range(int(input())):
		(a, b) = map(int, input().split())
		x = min(a, b)
		y = max(a, b)
		x *= 2
		if x > y:
			print(x ** 2)
		else:
			print(y ** 2)
solution()


import math
t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	mn = min(a, b)
	mx = max(a, b)
	if 2 * mn < mx:
		print(mx * mx)
	else:
		mn = 2 * mn
		print(mn ** 2)


t = int(input())
for gf in range(t):
	(a, b) = [int(x) for x in input().split()]
	if min(a, b) * 2 > max(a, b):
		print((2 * min(a, b)) ** 2)
	else:
		print(max(a, b) ** 2)


t = int(input())
for q in range(0, t):
	(a, b) = map(int, input().split())
	m = 2 * min(a, b)
	ans = max(max(a, b), m)
	print(ans * ans)


for j in range(int(input())):
	(a, b) = map(int, input().split())
	x = max(2 * min(a, b), max(a, b))
	print(x * x)


x = int(input())
l = []
for i in range(x):
	l.append(list(map(int, input().split())))
for i in l:
	print(min(max(i[0], 2 * i[1]), max(i[1], 2 * i[0])) ** 2)


import math
import random
mod = 1000000007
r1 = lambda : int(input())
rm = lambda : map(int, input().split())
rls = lambda : list(rm())
test = r1()
while test:
	test -= 1
	(a, b) = rm()
	if a == b:
		print((2 * a) ** 2)
	elif 2 * min(a, b) >= max(a, b):
		print((2 * min(a, b)) ** 2)
	else:
		print(max(a, b) ** 2)


t = int(input())

def solve(a, b):
	(a, b) = (min(a, b), max(a, b))
	print(max(2 * a, b) ** 2)
for _ in range(t):
	(a, b) = map(int, input().split())
	solve(a, b)


t = int(input())
for i in range(t):
	(a1, b1) = input().split(' ')
	a = int(a1)
	b = int(b1)
	m = max(a, b)
	n = min(a, b)
	if m > 2 * n:
		print(m * m)
	else:
		print(4 * n * n)


test_case = int(input())
while test_case:
	(a, b) = sorted(map(int, input().split()))
	print(b ** 2 if 2 * a < b else 4 * a ** 2)
	test_case -= 1


import sys
import math
input = sys.stdin.readline

def int_array():
	return list(map(int, input().strip().split()))

def str_array():
	return input().strip().split()

def lower_letters():
	lowercase = [chr(i) for i in range(97, 97 + 26)]
	return lowercase

def upper_letters():
	uppercase = [chr(i) for i in range(65, 65 + 26)]
	return uppercase
for i in range(int(input())):
	(a, b) = int_array()
	n = min(a, b) * 2
	m = max(a, b)
	print(max(n, m) ** 2)


def form_sq(a, b):
	length = max(a, b)
	breadth = min(a, b)
	if breadth * 2 >= length:
		return (breadth * 2) ** 2
	return length ** 2
for _ in range(int(input())):
	(a, b) = [int(x) for x in input().split()]
	print(form_sq(a, b))


t = int(input())
while t:
	(a, b) = list(map(int, input().split()))
	m1 = min(a, b)
	m2 = max(a, b)
	print(max(2 * m1, m2) ** 2)
	t -= 1


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	L1 = max(2 * a, b)
	L2 = max(a, 2 * b)
	print(min(L1, L2) ** 2)


def calc(a, b):
	if a == b:
		print((2 * a) ** 2)
	else:
		print(max(2 * min(a, b), max(a, b)) ** 2)
t = int(input())
for i in range(t):
	(a, b) = list(map(int, input().split()))
	calc(a, b)


def answer(a, b):
	if b > a:
		(a, b) = (b, a)
	x = min(a + b, max(a, 2 * b))
	return x ** 2
t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	print(answer(a, b))


import math
T = int(input())
while T > 0:
	user = input()
	user_list = user.split()
	a = int(user_list[0])
	b = int(user_list[1])
	if a > b:
		if b * 2 >= a:
			b = b * 2
			print(b * b)
		else:
			print(a * a)
	elif b > a:
		if a * 2 >= b:
			a = a * 2
			print(a * a)
		else:
			print(b * b)
	else:
		a = a * 2
		print(a * a)
	T -= 1


def main_function():
	from sys import stdin
	from sys import stdout
	input = stdin.readline
	print = stdout.write
	t = int(input())
	for _ in range(t):
		(a, b) = list(map(int, input().split()))
		if a <= b:
			tmp = max(a * 2, b)
		else:
			tmp = max(b * 2, a)
		print(f'{tmp * tmp}\n')
main_function()


t = int(input())
for t_itr in range(t):
	ab = input().split()
	a = int(ab[0])
	b = int(ab[1])
	mini = min(a, b) * 2
	maxi = max(a, b)
	if mini >= maxi:
		print(mini * mini)
	else:
		print(maxi * maxi)


import collections, heapq, itertools, math, functools
groupby = itertools.groupby
rs = lambda : input()
ri = lambda : int(input())
rm = lambda : map(int, input().split())
rai = lambda : [int(x) for x in input().split()]

def solve():
	w = max(a, b)
	h = min(a, b)
	return max(2 * h, w) ** 2
for t in range(ri()):
	(a, b) = rm()
	print(solve())


t = int(input())
while t > 0:
	(a, b) = map(int, input().split())
	if a < b:
		squareSide = a + a
		if squareSide >= b:
			square = squareSide
		else:
			square = b
	elif b < a:
		squareSide = b + b
		if squareSide >= a:
			square = squareSide
		else:
			square = a
	else:
		square = a + b
	print(pow(square, 2))
	t = t - 1


for _ in range(int(input())):
	(a, b) = list(map(int, input().split()))
	mini = min(a, b)
	if 2 * mini > max(a, b):
		print(pow(2 * mini, 2))
	else:
		print(pow(max(a, b), 2))


t = int(input())
for j in range(t):
	g = input().split()
	a = int(g[0])
	b = int(g[1])
	s = a * b * 2
	mn = min(a, b)
	mx = max(a, b)
	if 2 * mn >= mx:
		print((2 * mn) ** 2)
	else:
		print(mx ** 2)


t = int(input())
for tc in range(t):
	(a, b) = sorted([int(i) for i in input().split()])
	if b > 2 * a:
		print(b * b)
	else:
		print(4 * a * a)


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	if a >= b * 2:
		ans = pow(a, 2)
	elif b >= a * 2:
		ans = pow(b, 2)
	else:
		ans = pow(min(a, b) * 2, 2)
	print(ans)


w = int(input())
a = []
if w >= 1 and w <= 10000:
	for i in range(0, w):
		p = input().split(' ')
		a.append(p)
	for i in range(0, w):
		r = a[i]
		if int(r[0]) == int(r[1]):
			t = int(4 * int(r[0]) * int(r[0]))
			print(t)
		elif int(r[0]) > int(r[1]):
			if int(r[0]) >= 2 * int(r[1]):
				t = int(int(r[0]) * int(r[0]))
				print(t)
			else:
				t = int(4 * int(r[1]) * int(r[1]))
				print(t)
		elif int(r[0]) < int(r[1]):
			if int(r[1]) >= 2 * int(r[0]):
				t = int(int(r[1]) * int(r[1]))
				print(t)
			else:
				t = int(4 * int(r[0]) * int(r[0]))
				print(t)


t = int(input())
for tt in range(t):
	(a, b) = map(int, input().split())
	x = [a, b]
	x = sorted(x)
	if x[1] % x[0] == 0 and x[1] == x[0]:
		print((2 * x[1]) ** 2)
	elif x[1] % x[0] == 0:
		print(x[1] ** 2)
	elif x[1] / x[0] > 2:
		print(x[1] ** 2)
	else:
		print((2 * x[0]) ** 2)


def dhana(a, b):
	x = max(2 * a, b)
	y = max(2 * b, a)
	z = min(x, y)
	return z * z
n = int(input())
for i in range(n):
	(a, b) = map(int, input().split())
	c = dhana(a, b)
	print(c)


import io
import os
from collections import Counter, defaultdict, deque

def solve(A, B):
	return min(max(2 * A, B), max(2 * B, A), max(max(A, B), A + B)) ** 2
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
T = int(input())
for t in range(T):
	(A, B) = [int(x) for x in input().split()]
	ans = solve(A, B)
	print(ans)


x = int(input())
for u in range(x):
	l = input().split()
	l[0] = int(l[0])
	l[1] = int(l[1])
	if l[0] == l[1]:
		print(l[0] ** 2 * 4)
	elif l[0] > l[1]:
		k = max(l[0], 2 * l[1])
		print(k ** 2)
	else:
		k = max(l[1], 2 * l[0])
		print(k ** 2)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	lis = []
	lis.append(a + b)
	if a >= 2 * b:
		lis.append(a)
	if b >= 2 * a:
		lis.append(b)
	if 2 * a >= b:
		lis.append(2 * a)
	if 2 * b >= a:
		lis.append(2 * b)
	print(min(lis) ** 2)


test = int(input())
for t in range(test):
	dim = input().split()
	l = int(dim[0])
	b = int(dim[1])
	if l > b:
		if 2 * b > l:
			print(4 * b * b)
		else:
			print(l * l)
	elif b > l:
		if 2 * l > b:
			print(4 * l * l)
		else:
			print(b * b)
	else:
		print(4 * l * l)


import math
t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	if a == b:
		ans = a + b
		print(ans * ans)
		continue
	area = a * b * 2
	mi = min(a, b)
	ma = max(a, b)
	ans = math.ceil(math.sqrt(area))
	if ans >= mi * 2 and ans > ma:
		print(ans * ans)
	else:
		mi = 2 * mi
		while ans < mi or ans < ma:
			ans += 1
		print(ans * ans)


from sys import stdin, stdout
T = int(stdin.readline())
for _ in range(T):
	(A, B) = map(int, stdin.readline().split(' '))
	if A > B:
		(A, B) = (B, A)
	l = max(A << 1, B)
	stdout.write(str(l * l) + '\n')


t = int(input())
while t:
	(a, b) = map(int, input().split())
	mi = min(a, b)
	ma = max(a, b)
	m = max(2 * mi, ma)
	print(m ** 2)
	t -= 1


for _ in range(int(input())):
	a = [*map(int, input().split())]
	x = max(a[0], a[1])
	y = min(a[0], a[1])
	y *= 2
	ma = max(x, y)
	print(ma * ma)


t = int(input())
i = 0
while i < t:
	(a, b) = [int(x) for x in input().split()]
	k = min(a, b)
	l = max(a, b)
	m = max(k * 2, l)
	print(m * m)
	i = i + 1


from operator import itemgetter
from collections import Counter
from collections import deque
import queue as Q
import math as m
import copy as c

def solution():
	AB = list(map(int, input().rstrip().split()))
	a = AB[0]
	b = AB[1]
	width = min(a, b)
	length = max(a, b)
	l = max(2 * width, length)
	area = l * l
	print(area)
T = int(input())
for _ in range(T):
	solution()


n = int(input())
for i in range(0, n):
	(a, b) = list(map(int, input().split()))
	h = min(a, b)
	t = max(a, b)
	print(max(2 * h, t) ** 2)


for case in range(int(input())):
	(a, b) = map(int, input().split())
	(MAX, MIN) = (max(a, b), min(a, b))
	res = MIN * 2 if MIN * 2 > MAX else MAX
	print(res ** 2)


import sys
input = sys.stdin.readline

def solve(a, b):
	i = min(a, b)
	mn = min(a, b)
	mx = max(a, b)
	while mx > i or 2 * mn > i:
		i += 1
	return i ** 2
t = int(input().strip())
for _ in range(t):
	(a, b) = map(int, input().split())
	print(solve(a, b))


import sys

def compute_min_area(a: int, b: int) -> int:
	side = max(a, b)
	while min(a, b) * 2 > side or max(a, b) > side:
		side += 1
	return side ** 2
for line in sys.stdin:
	if ' ' in line:
		(a, b) = tuple(map(int, line.split(' ')))
		print(compute_min_area(a, b))


t = int(input())
while t > 0:
	a = [int(i) for i in input().split(' ')]
	c = min(a)
	c *= 2
	b = max(c, max(a))
	print(b ** 2)
	t -= 1


t = int(input())
i = 0
while i < t:
	(a, b) = map(int, input().split())
	if a > b:
		(a, b) = (b, a)
	c = a + a
	if c == b:
		print(c * c)
	else:
		print(max(c * c, b * b))
	i = i + 1


for i in range(int(input())):
	(n, m) = map(int, input().split())
	if n == m:
		print(pow(n + m, 2))
	else:
		a = max(m, n)
		b = min(m, n)
		if a % b == 0:
			print(pow(a, 2))
		else:
			print(max(pow(a, 2), pow(2 * b, 2)))


test = int(input())
while test != 0:
	a = input()
	a = a.split()
	l = int(a[0])
	b = int(a[1])
	if b < l:
		b = 2 * b
		if b < l:
			an = l - b
			an = b + an
		else:
			an = b
	else:
		l = 2 * l
		if b > l:
			an = b - l
			an = l + an
		else:
			an = l
	print(an * an)
	test -= 1


import sys
sys.setrecursionlimit(10000000)
MOD = 10 ** 9 + 7
INF = 10 ** 15

def main():
	T = int(input())
	for _ in range(T):
		(a, b) = map(int, input().split())
		if a >= b:
			(a, b) = (b, a)
		X = max(2 * a, b)
		print(X * X)
main()


for i in range(int(input())):
	ab = list(map(int, input().split()))
	a = ab[0]
	b = ab[1]
	x = min(a, b)
	y = max(a, b)
	z = 2 * x
	if y >= z:
		print(y ** 2)
	else:
		print(z ** 2)


for i in range(int(input())):
	(a, b) = map(int, input().split())
	if b > a:
		(a, b) = (b, a)
	if a == b:
		print((a + b) ** 2)
	elif a / 2 == b:
		print(a ** 2)
	else:
		s = (b * 2) ** 2
		c = a ** 2
		print(max(s, c))


for _ in range(int(input())):
	s = list(map(int, input().split()))
	s = sorted(s)
	if s[0] * 2 > s[1]:
		print(2 * s[0] * (2 * s[0]))
	else:
		print(s[1] * s[1])


def minimal_square(arr):
	a = min(arr) * 2
	arr.append(a)
	ans = max(arr)
	return ans ** 2
n = int(input())
while n != 0:
	arr = [int(x) for x in input().split()]
	print(minimal_square(arr))
	n -= 1


testCases = int(input())
for i in range(testCases):
	sides = list(map(int, input().split(' ')))
	sides.sort()
	a = sides[0]
	b = sides[1]
	if 2 * a < b:
		min = pow(b, 2)
		print(min)
	else:
		min = pow(2 * a, 2)
		print(min)


N = int(input())
answers = []
for i in range(N):
	(a, b) = map(int, input().split())
	if max(a, b) // min(a, b) < 2:
		answers.append(pow(min(a, b) * 2, 2))
	else:
		answers.append(pow(max(a, b), 2))
for i in answers:
	print(i)


for _ in range(int(input())):
	(l, b) = list(map(int, input().split()))
	if l * 2 == b or b * 2 == l:
		print(l * b * 2)
	else:
		print(max(min(l, b) * 2, max(l, b)) ** 2)


t = int(input())
while t > 0:
	(a, b) = input().split(' ')
	a = int(a)
	b = int(b)
	if b > a:
		(a, b) = (b, a)
	dtbn = 1000000000
	if 2 * b >= a:
		dtbn = min(dtbn, (2 * b) ** 2)
	dtbn = min(dtbn, (2 * a) ** 2)
	if 2 * b <= a:
		dtbn = min(dtbn, a ** 2)
	dtbn = min(dtbn, (a + b) ** 2)
	print(dtbn)
	t -= 1


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	e = max(a, b)
	z = min(a, b)
	z = 2 * z
	if z > e:
		print(z * z)
	elif e == z:
		print(e * z)
	elif e > z:
		print(e * e)


for _ in range(int(input())):
	(a, b) = list(map(int, input().split()))
	l = [a, b, 2 * a, 2 * b]
	l.sort()
	ans = l[2] ** 2
	print(ans)


n = int(input())
for __ in range(n):
	(a, b) = map(int, input().split())
	minArea = 2 * a * b
	side = 2 * min(a, b)
	ans = side * side
	j = side + 1
	while ans < minArea:
		ans = j * j
		side = j
		j += 1
	if side >= max(a, b):
		print(ans)
	else:
		while side < max(a, b):
			side += 1
		print(side * side)


def solve(a, b):
	width = max(a, b)
	height = 2 * min(a, b)
	return max(width, height) ** 2

def main():
	t = int(input())
	for i in range(t):
		d = input()
		d = [int(i) for i in d.split()]
		n = d[0]
		a = d[1]
		ans = solve(n, a)
		print(ans)
main()


import io
import os
import functools
import itertools
import math
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
t = int(input())
while t:
	t -= 1
	(a, b) = [int(x) for x in input().split()]
	(a, b) = (min(a, b), max(a, b))
	print((2 * a) ** 2 if 2 * a >= b else b ** 2)


t = int(input())
for i in range(0, t):
	ab = input().split()
	a = int(ab[0])
	b = int(ab[1])
	x = max(a, b)
	y = min(a, b)
	z = max(2 * y, x)
	print(z * z)


import sys
T = int(sys.stdin.readline())
for _ in range(T):
	(a, b) = map(int, sys.stdin.readline().split())
	if min(a, b) * 2 >= max(a, b):
		print((min(a, b) * 2) ** 2)
	else:
		print(max(a, b) ** 2)


t = int(input())
ans = []
for i in range(t):
	(a, b) = map(int, input().split(' '))
	v_min = min(a, b)
	v_max = max(v_min * 2, a, b)
	ans.append(v_max ** 2)
for i in range(t):
	print(ans[i])


import math
t = int(input())
while t > 0:
	t = t - 1
	(n, m) = map(int, input().split())
	a = min(n, m)
	b = max(n, m)
	if b <= 2 * a:
		print(2 * a * 2 * a)
	else:
		print(b * b)


t = int(input())
anss = [0] * t
for i in range(t):
	(a, b) = map(int, input().split())
	anss[i] = max(2 * min(a, b), max(a, b)) ** 2
for ans in anss:
	print(ans)


t = int(input())
for i in range(t):
	(a, b) = list(map(int, input().split()))
	k = min(a, b)
	l = max(a, b)
	print(max((k * 2) ** 2, l ** 2))


t = int(input())
for k in range(t):
	(a, b) = map(int, input().rstrip().split())
	min_a = max(a + a, b)
	min_b = max(a, b + b)
	ans = min(min_a, min_b)
	print(ans * ans)


ab = []
for i in range(int(input())):
	ab.append(list(map(int, input().split())))
for x in ab:
	x.sort()
	(a, b) = (x[0], x[1])
	if 1 not in x:
		t = a * 2
		if t > b:
			print(t * t)
		else:
			print(b * b)
	elif a != b:
		print(max(x) * max(x))
	else:
		print((a + b) * (a + b))


t = int(input())
for _ in range(t):
	(l, w) = map(int, input().split())
	if l < w:
		(l, w) = (w, l)
	len = max(w * 2, l)
	print(len * len)


t = int(input())
s = [tuple(map(int, input().split())) for i in range(t)]
for v in s:
	long = max(v[0], v[1])
	short = min(v[0], v[1])
	side = max(long, 2 * short)
	print(side * side)


x = int(input())
for i in range(x):
	arr = list(map(int, input().split()))
	w = arr[0]
	h = arr[1]
	if w * 2 >= h and w < h:
		s = (w * 2) ** 2
	elif h * 2 >= w and h < w:
		s = (h * 2) ** 2
	elif h == w:
		s = (h * 2) ** 2
	else:
		s = max(w, h) ** 2
	print(s)


import sys
import math

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def get_array():
	return list(map(int, sys.stdin.readline().strip().split()))

def input():
	return sys.stdin.readline().strip()
for _ in range(int(input())):
	(a, b) = get_ints()
	m = min(a, b)
	m = (2 * m) ** 2
	if max(a, b) ** 2 > m:
		print(max(a, b) ** 2)
	else:
		print(m)


n = int(input())
for _ in range(n):
	inp = input().split(' ')
	x = int(inp[0])
	y = int(inp[1])
	if min(x, y) * 2 > max(x, y):
		print((min(x, y) * 2) ** 2)
	else:
		print(max(x, y) ** 2)


n = int(input())
x = []
for i in range(n):
	arr = list(map(int, input().split()))
	arr.sort()
	if 2 * arr[0] >= arr[1]:
		x.append((2 * arr[0]) ** 2)
	else:
		x.append(arr[1] ** 2)
for elm in x:
	print(elm)


t = int(input())
for T in range(t):
	sides = list(map(int, input().split()))
	if 2 * min(sides) >= max(sides):
		print((2 * min(sides)) ** 2)
	else:
		print(max(sides) ** 2)


import sys

def minSq(a, b):
	if a == b:
		c = (2 * a) ** 2
		print(c)
	else:
		c = min(a, b)
		d = max(a, b)
		if d >= 2 * c:
			out = d ** 2
		else:
			out = (2 * c) ** 2
		print(out)
n = int(input())
for i in range(n):
	(a, b) = map(int, sys.stdin.readline().strip().split())
	minSq(a, b)


t = int(input())
for test in range(t):
	(a, b) = map(int, input().split())
	p = min(a, b)
	o = 2 * p
	y = max(o, max(a, b))
	print(y * y)


n = int(input())
i = 1
while i <= n:
	(x, y) = input().split()
	x = int(x)
	y = int(y)
	if x > y:
		if 2 * y > x:
			hasil = 4 * y * y
		else:
			hasil = x * x
	elif 2 * x > y:
		hasil = 4 * x * x
	else:
		hasil = y * y
	print(hasil)
	i = i + 1


import sys
for _ in range(int(input())):
	(n, m) = map(int, input().split())
	print(max(max(n, m), 2 * min(n, m)) * max(max(n, m), 2 * min(n, m)))


n = int(input())
lis = []
for j in range(n):
	li = [int(x) for x in input().split()]
	li.sort()
	if li[0] * 2 == li[1]:
		lis.append(li[1] * li[1])
	else:
		li[0] *= 2
		if li[0] > li[1]:
			lis.append(li[0] * li[0])
		elif li[1] > li[0]:
			lis.append(li[1] * li[1])
for i in lis:
	print(i)


from math import sqrt
t = int(input())
while t:
	t -= 1
	(a, b) = map(int, input().split())
	k = min(a, b)
	l = max(a, b)
	if 2 * k >= l:
		print(pow(2 * k, 2))
	else:
		print(pow(l, 2))


t = int(input())
for _ in range(t):
	(a, b) = list(map(int, input().split()))
	(mi, mx) = (min(a, b), max(a, b))
	if mi + mi < mx:
		mi = mx
	else:
		mi += mi
	print(mi ** 2)


for _ in range(int(input())):
	(length, breadth) = map(int, input().split())
	print(max(min(length, breadth) * 2, length, breadth) ** 2)


import math
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	k = 1000
	k = min(k, max(2 * b, a))
	k = min(k, max(2 * a, b))
	k = min(k, a + b)
	print(k * k)


def fun(a, b):
	(a, b) = (min(a, b), max(a, b))
	if 2 * a > b:
		return 4 * a * a
	else:
		return b * b
for _ in range(int(input())):
	(a, b) = [int(i) for i in input().split()]
	print(fun(a, b))


for _ in range(int(input())):
	(a, b) = sorted(map(int, input().split()))
	x = max(a + a, b)
	print(x * x)


t = int(input())
for _ in range(0, t):
	(n, m) = map(int, input().split())
	if n < m:
		p = n + n
		q = m
	else:
		p = m + m
		q = n
	z = max(p, q)
	print(z ** 2)


import math
d = int(input())
for i in range(0, d):
	(a, b) = map(int, input().split())
	print(min(max(a * 2, b), max(b * 2, a)) ** 2)


for _ in range(int(input())):
	(a, b) = [int(i) for i in input().split()]
	if b < a:
		(a, b) = (b, a)
	if 2 * a < b:
		print(b ** 2)
	else:
		print((2 * a) ** 2)


n = int(input())
l = []
for i in range(0, n):
	s = [int(x) for x in input().split()]
	l.append(s)
for k in range(0, n):
	p = min(l[k][0], l[k][1])
	p1 = max(l[k][0], l[k][1])
	if 2 * p > p1:
		print(4 * p * p)
	else:
		print(p1 * p1)


from sys import stdin, stdout
from math import gcd, ceil, sqrt
ii1 = lambda : int(stdin.readline().strip())
is1 = lambda : stdin.readline().strip()
iia = lambda : list(map(int, stdin.readline().strip().split()))
isa = lambda : stdin.readline().strip().split()
mod = 1000000007
tc = ii1()
for _ in range(tc):
	(a, b) = iia()
	num = min(max(a, 2 * b), max(2 * a, b))
	print(num ** 2)


n = int(input())
for _ in range(n):
	n1 = list(map(int, input().split(' ')))
	a = n1[0]
	b = n1[1]
	side = min(max(a * 2, b), max(a, b * 2))
	print(side * side)


n = int(input())
while n != 0:
	(l, b) = map(int, input().split())
	m = max(l, b)
	mins = min(l, b)
	if m >= 2 * mins:
		print(m * m)
	else:
		print(2 * mins * (2 * mins))
	n = n - 1


n = int(input())
for i in range(n):
	(a, b) = map(int, input().split())
	c = min(a, b)
	min_2 = 2 * c
	square_area = 0
	if min_2 > a and min_2 < b:
		square_area = b * b
	elif min_2 > b and min_2 < a:
		square_area = a * a
	else:
		square_area = min_2 * min_2
	print(square_area)


import math
n1 = int(input())
for x in range(n1):
	l1 = input().split(' ')
	a = int(l1[0])
	b = int(l1[1])
	if a > b:
		(a, b) = (b, a)
	if 2 * a >= b:
		print(int(math.pow(2 * a, 2)))
	else:
		print(int(math.pow(b, 2)))


n = int(input())
for i in range(n):
	(x, y) = map(int, input().split())
	if y > x:
		(x, y) = (y, x)
	z = max(2 * y, x)
	print(z ** 2)


t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	s1 = max(a, 2 * b)
	s2 = max(b, 2 * a)
	s3 = a + b
	s = min(s1, s2, s3)
	print(s ** 2)


for t in range(int(input())):
	(a, b) = input().split()
	a = int(a)
	b = int(b)
	m = min(a, b)
	k = max(a, b)
	j = max(2 * m, k)
	print(j * j)


t = int(input())
for t_ in range(t):
	(a, b) = map(int, input().split())
	big = a if a >= b else b
	small = b if a > b else a
	if small * 2 < big:
		print(big * big)
	else:
		print(small * 2 * (small * 2))


def solve(a, b):
	max_width = max(2 * b, a)
	max_height = max(2 * a, b)
	min_square_side = min(max_width, max_height)
	print(min_square_side ** 2)
test_case = int(input())
while test_case != 0:
	(a, b) = map(int, input().split(' '))
	solve(a, b)
	test_case = test_case - 1


import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush
from math import ceil, floor, gcd, fabs, factorial, fmod, sqrt, inf, log, pi, sin
from collections import defaultdict as dd, deque, Counter as C
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
from time import perf_counter
from fractions import Fraction
mod = pow(10, 9) + 7
mod2 = 998244353

def data():
	return sys.stdin.readline().strip()

def out(*var, end='\n'):
	sys.stdout.write(' '.join(map(str, var)) + end)

def l():
	return list(sp())

def sl():
	return list(ssp())

def sp():
	return map(int, data().split())

def ssp():
	return map(str, data().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(n, val) for j in range(m)]
for _ in range(int(data())):
	(a, b) = sp()
	(a, b) = (min(a, b), max(a, b))
	answer = pow(max(a * 2, b), 2)
	out(answer)


for case in range(int(input())):
	(a, b) = list(map(int, input().split()))
	(a, b) = (min(a, b), max(a, b))
	print(max(2 * a, b) ** 2)


from math import *
import math

def r1(t):
	return t(input())

def r2(t):
	return [t(i) for i in input().split()]
for zzz in range(r1(int)):
	(a, b) = r2(int)
	t = min(max(b, 2 * a), max(2 * b, a))
	print(t * t)


rep = int(input())
for i in range(rep):
	(h, w) = [int(x) for x in input().split()]
	long = max(h, w)
	short = min(h, w)
	if long >= short * 2:
		print(long * long)
	else:
		print(4 * short * short)


cases = int(input())
for trials in range(cases):
	(x, y) = map(int, input().split())
	if 2 * min(x, y) <= max(x, y):
		print(max(x, y) ** 2)
	else:
		print((2 * min(x, y)) ** 2)


t = input('')
t = int(t)
for i in range(0, t):
	a = input('')
	a = a.split(' ')
	b = int(a[1])
	a = int(a[0])
	if a * 2 >= b and a < b:
		print((a * 2) ** 2)
	elif b * 2 >= a and b < a:
		print((b * 2) ** 2)
	elif b == a:
		print((2 * a) ** 2)
	elif b > a:
		print(b * b)
	elif a > b:
		print(a * a)


t = int(input())
for case in range(t):
	(n, m) = map(int, input().split())
	if n > m:
		(n, m) = (m, n)
	if 2 * n > m:
		n = 2 * n
	else:
		n = m
	print(n * n)


for i in range(int(input())):
	(x, y) = map(int, input().split())
	minn1 = x
	if 2 * y > x:
		minn1 = 2 * y
	minn2 = y
	if 2 * x > y:
		minn2 = 2 * x
	print(min(minn1, minn2) ** 2)


M = lambda : list(map(int, input().split()))
for i in range(int(input())):
	(a, b) = M()
	print(max(max(a, b), 2 * min(a, b)) ** 2)


from sys import stdin, stdout

def II():
	return int(stdin.readline())

def MI():
	return map(int, stdin.readline().split())
t = II()
for _ in range(t):
	(a, b) = MI()
	ans = 0
	s1 = 2 * min(a, b)
	s2 = max(a, b)
	ans = max(s1, s2)
	ans *= ans
	stdout.write(str(ans) + '\n')


n = int(input())
for i in range(n):
	(m1, m2) = map(int, input().split())
	m3 = min(m1, m2)
	s = (2 * m3) ** 2
	if s < max(m1, m2) ** 2:
		print(max(m1, m2) ** 2)
	else:
		print((2 * m3) ** 2)


import math
n = int(input())
for i in range(n):
	(a, b) = [int(i) for i in input().split()]
	if a >= b:
		b = b * 2
		if a == b:
			pass
		elif a < b:
			a = a + (b - a)
		else:
			b = b + (a - b)
	else:
		a = a * 2
		if a == b:
			pass
		elif a < b:
			a = a + (b - a)
		else:
			b = b + (a - b)
	print(a * b)


for case in range(int(input())):
	(a, b) = [int(x) for x in input().split()]
	if a == min(a, b):
		a *= 2
	elif b == min(a, b):
		b *= 2
	ans = max(a, b) ** 2
	print(ans)


for _ in range(int(input())):
	(x, y) = map(int, input().split())
	mx = max(x, y)
	mn = 2 * min(x, y)
	print(max(mn, mx) * max(mn, mx))


t = int(input())
for _ in range(t):
	(l, b) = map(int, input().split())
	if l < b:
		poss = 2 * l
		if b <= poss:
			print(poss ** 2)
		else:
			print(b ** 2)
	else:
		poss = 2 * b
		if l <= poss:
			print(poss ** 2)
		else:
			print(l ** 2)


t = int(input())
for i in range(t):
	(a, b) = list(map(int, input().split()))
	c = max(a, b)
	d = min(a, b)
	square = 0
	if c != d:
		if c > 2 * d:
			square = c * c
		elif c < 2 * d:
			e = 2 * d
			square = e * e
		elif c == 2 * d:
			square = c * c
	elif c == d:
		f = c + d
		square = f * f
	print(square)


k = int(input())
lst = []
for i in range(k):
	(a, b) = map(int, input().split())
	if a < b and a + a >= b:
		res = a * a * 4
		lst.append(res)
	elif b < a and b + b >= a:
		res = b * b * 4
		lst.append(res)
	elif b < a and b + b <= a:
		res = a * a
		lst.append(res)
	elif a < b and a + a <= b:
		res = b * b
		lst.append(res)
	elif a == b:
		res = a * a * 4
		lst.append(res)
for i in range(len(lst)):
	print(lst[i])


n = int(input())
answers = []
for i in range(n):
	(a, b) = map(int, input().split())
	height = min(a, b) * 2
	width = max(a, b)
	if height >= width:
		answers.append(str(height ** 2))
	else:
		answers.append(str(width ** 2))
print('\n'.join(answers))


import sys
input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())

def main():
	n = inp()
	for i in range(n):
		(a, b) = invr()
		res = max(min(2 * a, 2 * b), a, b)
		ans = res ** 2
		print(ans)
main()


import math
t = int(input())
for _ in range(0, t):
	(a, b) = map(int, input().split())
	x = max(a, b)
	y = min(a, b)
	r = x
	s = y * 2
	print(max(r * r, s * s))


for _ in range(int(input())):
	(n, m) = sorted(list(map(int, input().split())))
	if 2 * n < m:
		print(m * m)
	else:
		print((2 * n) ** 2)


t = int(input())
for i in range(t):
	values = list(map(int, input().split()))
	(l, b) = (values[0], values[1])
	possibilities = [l, b, l + l, b + b, l + b]
	possibilities.sort()
	answer = None
	for i in possibilities:
		if i >= 2 * min(l, b) and i >= max(l, b):
			answer = i
			break
	print(answer ** 2)


t = int(input())
for i in range(t):
	(n, m) = [int(i) for i in input().split()]
	print(max(max(n, m), min(n, m) * 2) ** 2)


from sys import stdin
input = iter(stdin.readlines()).__next__
t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	(a, b) = (max(a, b), min(a, b))
	print(max(a, 2 * b) ** 2)


for t in range(int(input())):
	(a, b) = map(int, input().split())
	if a < b:
		(a, b) = (b, a)
	f = 2 * b
	if f > a:
		print(f ** 2)
	else:
		print(a ** 2)


from sys import stdin, stdout
n = int(stdin.readline())
for i in range(n):
	arr = [int(x) for x in stdin.readline().split()]
	ans = 0
	if 2 * min(arr[0], arr[1]) > max(arr[0], arr[1]):
		ans = 2 * min(arr[0], arr[1])
	else:
		ans = max(arr[0], arr[1])
	ans = ans * ans
	stdout.write(str(ans) + '\n')


from sys import stdin, stdout
import math
from itertools import permutations, combinations
from collections import defaultdict
from bisect import bisect_left
from bisect import bisect_right

def L():
	return list(map(int, stdin.readline().split()))

def In():
	return map(int, stdin.readline().split())

def I():
	return int(stdin.readline())
P = 1000000007

def main():
	for t in range(I()):
		(a, b) = In()
		m = max(min(2 * a, 2 * b), a, b)
		print(m * m)
main()


t = int(input())
for k in range(t):
	(a, b) = map(int, input().split())
	maximum = max(a, b)
	minimum = min(a, b)
	if maximum == minimum:
		print((2 * maximum) ** 2)
	elif maximum % minimum == 0:
		print(maximum ** 2)
	elif minimum * 2 > maximum:
		print((minimum * 2) ** 2)
	else:
		print(maximum ** 2)


from sys import stdin
for t in range(int(input())):
	(a, b) = map(int, stdin.readline().split())
	if b > a:
		(a, b) = (b, a)
	if a == b:
		print(4 * a * a)
	elif b <= a // 2:
		print(a * a)
	else:
		print(4 * b * b)


import os
import sys
from io import BytesIO, IOBase

def readvars():
	k = map(int, input().split())
	return k

def readlist():
	li = list(map(int, input().split()))
	return li

def anslist(li):
	ans = ' '.join([str(v) for v in li])
	return ans

def main():
	t = 1
	t = int(input())
	for xx in range(t):
		(a, b) = readvars()
		l = min(a, b)
		r = max(a, b)
		ans = max(2 * l, r)
		print(ans * ans)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


def main():
	t = int(input())
	for _ in range(t):
		(a, b) = map(int, input().split())
		k = min(a, b)
		k = k * 2
		ans = max(a, b, k)
		print(ans * ans)
main()


import sys
t = int(input())
while t > 0:
	num = input().split()
	a = int(num[0])
	b = int(num[1])
	side = min(max(2 * a, b), max(a, 2 * b))
	print(side * side)
	t -= 1


import sys
import heapq
import random
import collections

def solve(a, b):
	(a, b) = sorted([a, b])
	if b > 2 * a:
		return b ** 2
	else:
		return (2 * a) ** 2

def console(*args):
	print('\x1b[36m', *args, '\x1b[0m', file=sys.stderr)
	return
for case_num in range(int(input())):
	(a, b) = list(map(int, input().split()))
	res = solve(a, b)
	print(res)


test = int(input())
for i in range(test):
	(a, b) = input().split()
	a = int(a)
	b = int(b)
	if a > b:
		temp = b
		b = a
		a = temp
	if b < 2 * a:
		res = 2 * a
	if b == 2 * a:
		res = b
	if b > 2 * a:
		res = b
	print(res * res)


try:
	for _ in range(int(input())):
		(aa, bb) = map(int, input().split())
		if aa < bb:
			print(max(2 * aa, bb) * max(2 * aa, bb))
		else:
			print(max(2 * bb, aa) * max(2 * bb, aa))
except:
	pass


import os
import sys
from io import BytesIO, IOBase
import heapq as h
from bisect import bisect_left, bisect_right
from types import GeneratorType
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		import os
		self.os = os
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = self.os.read(self._fd, max(self.os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = self.os.read(self._fd, max(self.os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			self.os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
from collections import defaultdict as dd, deque as dq
import math, string

def getInts():
	return [int(s) for s in input().split()]

def getInt():
	return int(input())

def getStrs():
	return [s for s in input().split()]

def getStr():
	return input()

def listStr():
	return list(input())
MOD = 10 ** 9 + 7

def solve():
	(A, B) = getInts()
	if A > B:
		(A, B) = (B, A)
	side = max(2 * A, B)
	return side ** 2
for _ in range(getInt()):
	print(solve())


n = int(input())
c = []
for i in range(n):
	(m, n) = map(int, input().split())
	x = min(m, n)
	if 2 * x > max(m, n):
		c.append((2 * x) ** 2)
	else:
		c.append(max(m, n) ** 2)
for i in c:
	print(i)


t = int(input())

def solve(a, b):
	side = min(max(2 * a, b), max(2 * b, a))
	return side * side
for i in range(t):
	(a, b) = [int(x) for x in input().split()]
	print(solve(a, b))


for _ in range(int(input())):
	(n, m) = map(int, input().split())
	side = min(max(2 * n, m), max(n, 2 * m))
	print(side ** 2)


t = int(input())
for it in range(t):
	inp = input().strip().split()
	a = int(inp[0])
	b = int(inp[1])
	x = max(2 * a, b)
	y = max(2 * b, a)
	z = a + b
	print(min(x, y, z) ** 2)


n = int(input())
for i in range(n):
	line = input()
	integers = [int(s) for s in line.split()]
	(a, b) = (integers[0], integers[1])
	minimum = min(a, b)
	maximum = max(a, b)
	if minimum == maximum:
		print((2 * maximum) ** 2)
		continue
	if 2 * minimum >= maximum:
		print((2 * minimum) ** 2)
		continue
	else:
		print(maximum ** 2)


t = int(input())
x = []
y = []
for i in range(t):
	(a, b) = input().split()
	a = int(a)
	b = int(b)
	x.append(a)
	y.append(b)
for j in range(t):
	n = x[j]
	m = y[j]
	if n < m:
		if m <= 2 * n:
			print((2 * n) ** 2)
		else:
			print(m ** 2)
	elif n > m:
		if n <= 2 * m:
			print((2 * m) ** 2)
		else:
			print(n ** 2)
	elif m == n:
		print((2 * n) ** 2)


import math
t = int(input())
for i in range(t):
	(a, b) = [int(x) for x in input().split()]
	z = min(a, b)
	if z == a:
		if 2 * a > b:
			print(4 * a * a)
		else:
			print(b * b)
	elif 2 * b > a:
		print(4 * b * b)
	else:
		print(a * a)


from sys import stdin, stdout
for _ in range(int(stdin.readline())):
	(a, b) = map(int, stdin.readline().split())
	t = min(a, b) * 2
	c = max(a, b)
	if t < c:
		t = c
	res = t ** 2
	stdout.write(f'{res}\n')


t = int(input())
while t:
	t -= 1
	(a, b) = input().split()
	(a, b) = (int(a), int(b))
	ans = min(a, b)
	ans = ans * 2
	if ans < max(a, b):
		ans = max(a, b)
	print(ans * ans)


for i in range(int(input())):
	c = tuple(map(int, input().split()))
	k = min(c) * 2
	while k < max(c):
		k += 1
	print(k ** 2)


import sys
sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep='\n')

def II():
	return int(sys.stdin.readline())

def MI():
	return map(int, sys.stdin.readline().split())

def LI():
	return list(map(int, sys.stdin.readline().split()))

def LLI(rows_number):
	return [LI() for _ in range(rows_number)]

def SI():
	return sys.stdin.readline()[:-1]

def main():
	for _ in range(II()):
		(a, b) = MI()
		if a > b:
			(a, b) = (b, a)
		print(max(2 * a, b) ** 2)
main()


from sys import stdin

def main():
	t = int(stdin.readline())
	while t > 0:
		(a, b) = stdin.readline().split(' ')
		a = int(a)
		b = int(b)
		minS = min(a, b)
		maxS = max(a, b)
		print(pow(max(2 * minS, maxS), 2))
		t = t - 1
	stdin.close()
main()


t = int(input())
outputs = []
for i in range(t):
	(a, b) = map(int, input().split())
	if min(a, b) * 2 > max(b, a):
		outputs.append((min(a, b) * 2) ** 2)
	else:
		outputs.append(max(a, b) ** 2)
for ans in outputs:
	print(ans)


test = int(input())
test_arr = []
for _ in range(test):
	(a, b) = map(int, input().split())
	length = min(a, b) * 2
	side = max(max(a, b), length)
	test_arr.append(side * side)
for t in test_arr:
	print(t)


t = int(input(''))
while t > 0:
	(a, b) = map(int, input().split())
	x = a + b
	miin = min(a, b)
	if 2 * miin >= a * b // miin:
		x = 2 * miin
	else:
		x = a * b // miin
	if x > a + b:
		x = a + b
	print(x ** 2)
	t -= 1


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	(longest, smallest) = (max(a, b), min(a, b))
	if longest == 2 * smallest:
		print(longest * longest)
	else:
		longest = max(longest, 2 * smallest)
		print(longest * longest)


def comp(x, y):
	if x > y:
		return (x, y)
	else:
		return (y, x)
n = int(input())
while n:
	(a, b) = tuple(map(int, input().split()))
	(max, min) = comp(a, b)
	if max > min * 2:
		print(max ** 2)
	else:
		print((min * 2) ** 2)
	n -= 1


for i in range(int(input())):
	(a, b) = list(map(int, input().split()))
	c = max(a, 2 * b)
	c1 = max(b, 2 * a)
	f = min(c, c1)
	print(f * f)


x = int(input())
a = list()
for i in range(x):
	a.append(list(map(int, input().split())))
for i in a:
	if max(i) < min(i) * 2:
		print((min(i) * 2) ** 2)
	else:
		print(max(i) ** 2)


T = int(input())
for t in range(T):
	(a, b) = [int(i) for i in input().split()]
	(c, d) = (max(a, b), min(a, b))
	print(max(2 * d, c) ** 2)


t = int(input())
for q in range(t):
	ch = input()
	L = [int(i) for i in ch.split()]
	(a, b) = (L[0], L[1])
	print(max(max(a, b), 2 * min(a, b)) ** 2)


def main():
	t = int(input())
	for _ in range(t):
		(a, b) = map(int, input().split())
		k1 = max(2 * a, b)
		k2 = max(a, 2 * b)
		print(min(k1 ** 2, k2 ** 2))
	return
main()


t = int(input())
for sheet in range(t):
	(a, b) = map(int, input().split())
	c = min(a, b)
	c = 2 * c
	d = max(a, b)
	print(max(c, d) ** 2)


t = int(input())
for i in range(t):
	(x, y) = [int(x) for x in input().split()]
	m = min(x, y)
	m = m + m
	M = max(x, y)
	if m >= M:
		print(m * m)
	else:
		print(M * M)


def solve(a, b):
	return max(min(a, b) * 2, a, b) ** 2
t = int(input())
for i_t in range(t):
	current_str = input().split(' ')
	a = int(current_str[0])
	b = int(current_str[1])
	print(solve(a, b))


t = int(input())
while t > 0:
	(a, b) = map(int, input().split())
	mi = min(a, b)
	ma = max(a, b)
	s = max(2 * mi, ma)
	print(s * s)
	t -= 1


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	(smaller_side, larger_side) = (min(a, b), max(a, b))
	square_side = max(smaller_side * 2, larger_side)
	print(square_side * square_side)


test_case = int(input())
my_list = []
for i in range(test_case):
	my_list.append([int(j) for j in input().split()])
for x in range(test_case):
	if min(my_list[x]) * 2 >= max(my_list[x]):
		print((min(my_list[x]) * 2) ** 2)
	elif min(my_list[x]) == max(my_list[x]):
		print((min(my_list[x]) * 2) ** 2)
	elif min(my_list[x]) * 2 < max(my_list[x]):
		print(max(my_list[x]) ** 2)


n = int(input())
x = [0] * n
for i in range(0, n):
	x = list(map(int, input().split()))
	x.sort()
	if 2 * x[0] > x[1]:
		print((2 * x[0]) ** 2)
	elif 2 * x[0] <= x[1]:
		print(x[1] ** 2)


t = int(input())
for i in range(t):
	ab = list(map(int, input().split()))
	p1 = max(ab[0], 2 * ab[1]) ** 2
	p2 = max(ab[1], 2 * ab[0]) ** 2
	print(min(p1, p2))


import sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from functools import lru_cache
import bisect
import re
import queue
from decimal import *

class Scanner:

	@staticmethod
	def int():
		return int(sys.stdin.readline().rstrip())

	@staticmethod
	def string():
		return sys.stdin.readline().rstrip()

	@staticmethod
	def map_int():
		return [int(x) for x in Scanner.string().split()]

	@staticmethod
	def string_list(n):
		return [Scanner.string() for i in range(n)]

	@staticmethod
	def int_list_list(n):
		return [Scanner.map_int() for i in range(n)]

	@staticmethod
	def int_cols_list(n):
		return [Scanner.int() for i in range(n)]

class Math:

	@staticmethod
	def gcd(a, b):
		if b == 0:
			return a
		return Math.gcd(b, a % b)

	@staticmethod
	def lcm(a, b):
		return a * b // Math.gcd(a, b)

	@staticmethod
	def divisor(n):
		res = []
		i = 1
		for i in range(1, int(n ** 0.5) + 1):
			if n % i == 0:
				res.append(i)
				if i != n // i:
					res.append(n // i)
		return res

	@staticmethod
	def round_up(a, b):
		return -(-a // b)

	@staticmethod
	def is_prime(n):
		if n < 2:
			return False
		if n == 2:
			return True
		if n % 2 == 0:
			return False
		d = int(n ** 0.5) + 1
		for i in range(3, d + 1, 2):
			if n % i == 0:
				return False
		return True

def pop_count(x):
	x = x - (x >> 1 & 6148914691236517205)
	x = (x & 3689348814741910323) + (x >> 2 & 3689348814741910323)
	x = x + (x >> 4) & 1085102592571150095
	x = x + (x >> 8)
	x = x + (x >> 16)
	x = x + (x >> 32)
	return x & 127
MOD = int(1000000000.0) + 7
INF = int(1000000000000000.0)

def solve():
	(A, B) = Scanner.map_int()
	ans = max(2 * A, B)
	ans = min(ans, max(2 * B, A))
	print(ans ** 2)

def main():
	T = Scanner.int()
	for _ in range(T):
		solve()
main()


import math
TT = int(input())
for _ in range(TT):
	(a, b) = map(int, input().split())
	mm = min(a, b)
	mma = max(a, b)
	s = 2 * mm
	if mma <= 2 * mm:
		print(s ** 2)
	else:
		print(mma ** 2)


t = int(input())
for i in range(t):
	(a, b) = [int(x) for x in input().split()]
	l = min(a, b)
	m = a + b - l
	if 2 * l >= m:
		print(4 * l * l)
	else:
		print(m * m)


t = int(input())
for g in range(t):
	(a, b) = map(int, input().split())
	if a == b:
		print(a * b * 4)
		continue
	l = a if a > b else b
	s = a if a < b else b
	if 2 * s >= l:
		print((2 * s) ** 2)
	else:
		print(l * l)


def areaSquare(L, B):
	large = max(L, B)
	small = min(L, B)
	if large >= 2 * small:
		return large * large
	else:
		return 2 * small * (2 * small)
t = int(input())
for i in range(t):
	(l, b) = [int(x) for x in input().split()]
	print(areaSquare(l, b), end='')
	if i < t - 1:
		print()


try:
	T = int(input())
	for t in range(T):
		(a, b) = list(map(int, input().split()))
		if a < b:
			(a, b) = (b, a)
		if 2 * b > a:
			print(2 * b * 2 * b)
		else:
			print(a * a)
except Exception:
	pass


import sys
t = int(sys.stdin.readline())
ans_arr = []
for x in range(t):
	[a, b] = [int(i) for i in sys.stdin.readline().split()]
	y1 = pow(max(a, 2 * b), 2)
	y2 = pow(max(b, 2 * a), 2)
	y3 = pow(max(a + b, max(a, b)), 2)
	ans = min(min(y1, y2), y3)
	ans_arr.append(str(ans))
print('\n'.join(ans_arr))


def f(a, b):
	return 4 * a * a if 2 * a > b else b * b
t = int(input())
for _ in range(t):
	(a, b) = [int(x) for x in input().split()]
	print(f(min(a, b), max(a, b)))


T = int(input())
for _ in range(T):
	(a, b) = list(map(int, input().split()))
	ans = max(2 * min(a, b), max(a, b))
	print(ans ** 2)


t = int(input())
while t > 0:
	t -= 1
	(a, b) = map(int, input().split())
	m = min(a, b)
	M = max(a, b)
	if 2 * m <= M:
		ans = M
	else:
		ans = 2 * m
	print(ans * ans)


def solve():
	(a, b) = map(int, input().split())
	if a <= b:
		return max(2 * a, b) ** 2
	return max(2 * b, a) ** 2
for _ in range(int(input())):
	print(solve())


import sys
reader = (s.rstrip() for s in sys.stdin)
input = reader.__next__

def gift():
	for _ in range(t):
		(a, b) = list(map(int, input().split()))
		c = min(a, b)
		d = max(a, b)
		if c == d:
			yield ((d * 2) ** 2)
		elif d >= 2 * c:
			yield (d ** 2)
		else:
			yield ((c * 2) ** 2)
t = int(input())
ans = gift()
print(*ans, sep='\n')


t = int(input())
for i in range(t):
	(a, b) = (int(x) for x in input().split())
	min_side = min(a, b)
	max_side = max(a, b)
	print(max(max_side, min_side * 2) ** 2)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	m = min(a, b)
	ma = max(a, b)
	if ma > 2 * m:
		m = ma / 2
	print(int((2 * m) ** 2))


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	m = min(a, b)
	mx = max(a, b)
	if m * 2 >= mx:
		print(m * m * 2 * 2)
	else:
		print(mx * mx)


def main():
	t = int(input())
	for i in range(t):
		(a, b) = map(int, input().split())
		if a < b:
			(a, b) = (b, a)
		stranica = max(b * 2, a)
		print(stranica * stranica)
main()


testcase = int(input())
for test in range(testcase):
	(a, b) = map(int, input().split())
	print(int(max(min(a, b) * 2, max(a, b)) ** 2))


for i in [*open(0)][1:]:
	(a, b) = map(int, i.split())
	if a > b:
		(a, b) = (b, a)
	print(4 * a * a if 2 * a > b else b * b)


for p in range(0, int(input())):
	b = list(map(int, input().split(' ')))
	l = 0
	b.sort()
	if b[0] * 2 >= b[1]:
		l = 2 * b[0]
	else:
		l = b[1]
	print(l ** 2)


from sys import stdout
text = [*open(0)]
for s in text[1:]:
	(a, b) = map(int, s.strip().split())
	ans = min(max(a + a, b), max(a, b + b))
	ans *= ans
	stdout.write(str(ans) + '\n')


t = int(input())
for j in range(t):
	ls = [int(i) for i in input().split()]
	min_ = min(ls)
	max_ = max(ls)
	if min_ * 2 < max_:
		print(max_ ** 2)
	else:
		print((min_ * 2) ** 2)


import sys
import os

def changeStdioToFile():
	path = os.path.dirname(os.path.abspath(__file__))
	sys.stdin = open(f'{path}/input.txt', 'r')
	sys.stdout = open(f'{path}/output.txt', 'w')
t = int(input())
for _ in range(t):
	(l, w) = [int(x) for x in input().split()]
	if l < w:
		(l, w) = (w, l)
	if l >= w * 2:
		print(l ** 2)
	else:
		print(w ** 2 * 4)


t = int(input())
for i in range(t):
	l = list(map(int, input().split()))
	a = l[0]
	b = l[1]
	if a != b and (2 * a < b or 2 * b < a):
		if 2 * a < b:
			print(b ** 2)
		elif 2 * b < a:
			print(a ** 2)
	elif 2 * a <= 2 * b:
		print((2 * a) ** 2)
	else:
		print((2 * b) ** 2)


from functools import reduce
import collections
import math
import sys

class Read:

	@staticmethod
	def string():
		return input()

	@staticmethod
	def int():
		return int(input())

	@staticmethod
	def list(delimiter=' '):
		return input().split(delimiter)

	@staticmethod
	def list_int(delimiter=' '):
		return list(map(int, input().split(delimiter)))

def main():
	t = Read.int()
	for _ in range(t):
		(a, b) = Read.list_int()
		if min(a, b) * 2 < max(a, b):
			print(max(a, b) ** 2)
		else:
			print((min(a, b) * 2) ** 2)
main()


tc = int(input())
for ctr in range(tc):
	(a, b) = map(int, input().split())
	print(min(max(2 * b, a), max(2 * a, b)) ** 2)


import sys
import math
import itertools
import functools
import collections
import operator
import fileinput
import copy
ORDA = 97

def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return [int(i) for i in input().split()]

def lcm(a, b):
	return abs(a * b) // math.gcd(a, b)

def revn(n):
	return str(n)[::-1]

def dd():
	return collections.defaultdict(int)

def ddl():
	return collections.defaultdict(list)

def sieve(n):
	if n < 2:
		return list()
	prime = [True for _ in range(n + 1)]
	p = 3
	while p * p <= n:
		if prime[p]:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 2
	r = [2]
	for p in range(3, n + 1, 2):
		if prime[p]:
			r.append(p)
	return r

def divs(n, start=1):
	r = []
	for i in range(start, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n / i == i:
				r.append(i)
			else:
				r.extend([i, n // i])
	return r

def divn(n, primes):
	divs_number = 1
	for i in primes:
		if n == 1:
			return divs_number
		t = 1
		while n % i == 0:
			t += 1
			n //= i
		divs_number *= t

def prime(n):
	if n == 2:
		return True
	if n % 2 == 0 or n <= 1:
		return False
	sqr = int(math.sqrt(n)) + 1
	for d in range(3, sqr, 2):
		if n % d == 0:
			return False
	return True

def convn(number, base):
	newnumber = 0
	while number > 0:
		newnumber += number % base
		number //= base
	return newnumber

def cdiv(n, k):
	return n // k + (n % k != 0)
for _ in range(ii()):
	(a, b) = sorted(mi())
	print(max(2 * a, b) ** 2)


tests = int(input())
for _ in range(tests):
	[a, b] = list(map(int, input().split()))
	m = a
	if a >= b:
		m = max(a, 2 * b)
	else:
		m = max(2 * a, b)
	print(m ** 2)


import math
t = int(input())
for z in range(t):
	(a, b) = [int(i) for i in input().split()]
	if a == b:
		print(2 * a * (2 * a))
	elif a < b:
		r = 2 * a
		if r > b:
			print(r * r)
		else:
			print(b * b)
	elif b < a:
		r = 2 * b
		if r > a:
			print(r * r)
		else:
			print(a * a)


def solution():
	(a, b) = map(lambda x: int(x), input().split())
	min_edge = min(a, b)
	print(max(min_edge * 2, max(a, b)) ** 2)
t = int(input())
for _ in range(t):
	solution()


n = int(input())
for i in range(n):
	(n, m) = map(int, input().split())
	bred = min(n, m)
	req = max(bred * 2, max(n, m))
	print(req ** 2)


t = int(input())
for _ in range(t):
	(a, b) = [int(i) for i in input().split()]
	mi = min(a, b)
	ma = max(a, b)
	fin = 2 * mi
	la = max(fin, ma)
	print(la * la)


T = int(input())
for i in range(T):
	(a, b) = map(int, input().split())
	lst = []
	lst.append(a)
	lst.append(b)
	lst.sort()
	x = lst[0]
	y = lst[1]
	z = 0
	if x * 2 >= y:
		z = x * 2
		print(z * z)
	else:
		print(y * y)


import sys
import math as mt
input = sys.stdin.buffer.readline
t = int(input())
for __ in range(t):
	(a, b) = map(int, input().split())
	mini = min(a, b)
	mini = 2 * mini
	maxi = max(a, b)
	mini = max(mini, maxi)
	print(mini ** 2)


import math
n = int(input())
for t in range(n):
	a = 0
	(a, b) = input().split()
	(a, b) = (int(a), int(b))
	if max(a, b) <= 2 * min(a, b):
		a = (2 * min(a, b)) ** 2
	else:
		a = max(a, b) ** 2
	print(a)


from sys import stdin
t = int(input())
while t > 0:
	(a, b) = [int(x) for x in stdin.readline().split()]
	x1 = max(2 * a, b)
	x2 = max(a, 2 * b)
	z = min(x1, x2)
	print(z * z)
	t -= 1


t = int(input())
if 1 <= t <= 10000:
	for i in range(t):
		(a, b) = input().split()
		a = int(a)
		b = int(b)
		if 1 <= a <= 100 and 1 <= b <= 100:
			if a == b:
				m = 4 * a * b
				print(m)
			else:
				m = 2 * a * b
				n = m ** 0.5
				if n % 2 == 0 or (n - 1) % 2 == 0:
					n = int(n)
					if n >= a and n >= b:
						if n < a + b and n < 2 * a and (n < 2 * b):
							if a + b <= 2 * a and a + b <= 2 * b:
								p = (a + b) ** 2
								print(p)
							elif 2 * a <= a + b and 2 * a <= 2 * b:
								p = (2 * a) ** 2
								print(p)
							elif 2 * b <= a + b and 2 * b <= 2 * a:
								p = (2 * b) ** 2
								print(p)
						else:
							print(m)
					elif a > n and a > b:
						p = a ** 2
						p = int(p)
						print(p)
					elif b > n and b > a:
						p = b ** 2
						p = int(p)
						print(p)
				else:
					q = n // 1 + 1
					q = int(q)
					if q >= a and q >= b:
						if q < a + b and q < 2 * a and (q < 2 * b):
							if a + b <= 2 * a and a + b <= 2 * b:
								p = (a + b) ** 2
								print(p)
							elif 2 * a <= a + b and 2 * a <= 2 * b:
								p = (2 * a) ** 2
								print(p)
							elif 2 * b <= a + b and 2 * b <= 2 * a:
								p = (2 * b) ** 2
								print(p)
						else:
							p = q ** 2
							p = int(p)
							print(p)
					elif a > q:
						p = a ** 2
						p = int(p)
						print(p)
					elif b > q:
						p = b ** 2
						p = int(p)
						print(p)


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	min_value = min(a, b)
	max_value = max(a, b)
	if 2 * min_value >= max_value:
		print((min_value * 2) ** 2)
	else:
		print(max_value ** 2)


n = int(input())
for i in range(n):
	(a, b) = [int(x) for x in input().split()]
	(a, b) = (min(a, b), max(a, b))
	if a * 2 > b:
		print((a * 2) ** 2)
	else:
		print(b ** 2)


from sys import stdin
input = lambda : stdin.readline().strip()
from math import ceil, sqrt, factorial, gcd
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	x = 2 * min(a, b)
	y = max(a, b)
	print(pow(max(x, y), 2))


import sys, re, math
from collections import deque, defaultdict, Counter, OrderedDict
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd
from heapq import heappush, heappop, heapify, nlargest, nsmallest

def STR():
	return list(input())

def INT():
	return int(input())

def MAP():
	return map(int, input().split())

def LIST():
	return list(map(int, input().split()))

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def sortListWithIndex(listOfTuples, idx):
	return sorted(listOfTuples, key=lambda x: x[idx])

def sortDictWithVal(passedDic):
	temp = sorted(passedDic.items(), key=lambda kv: (kv[1], kv[0]))[::-1]
	toret = {}
	for tup in temp:
		toret[tup[0]] = tup[1]
	return toret

def sortDictWithKey(passedDic):
	return dict(OrderedDict(sorted(passedDic.items())))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7
t = INT()
while t != 0:
	(A, B) = MAP()
	a = max(A, B)
	b = min(A, B)
	mn = max(2 * b, a)
	print(mn ** 2)
	t -= 1


def func():
	(a, b) = map(int, input().split())
	k = 2 * min(a, b)
	return pow(max(k, max(a, b)), 2)
for _ in range(int(input())):
	print(func())


import sys
from math import floor, sqrt
INT_MAX = sys.maxsize
INT_MIN = -sys.maxsize - 1
mod = 1000000007

def solve():
	t = int(sys.stdin.readline())
	for _ in range(t):
		(a, b) = map(int, sys.stdin.readline().split())
		maxx = max(a, b)
		minn = min(a, b)
		print(max(maxx, minn * 2) ** 2)
solve()


n = int(input())
while n:
	(a, b) = list(map(int, input().split()))
	x = min(a, b)
	x *= 2
	x = max(a, b, x)
	print(x ** 2)
	n -= 1


cases = int(input())
for i in range(cases):
	raw = input()
	for i in range(len(raw)):
		if raw[i] == ' ':
			break
	a = int(raw[:i])
	b = int(raw[i + 1:])
	if 2 * min(a, b) > max(a, b):
		print((2 * min(a, b)) ** 2)
	else:
		print(max(a, b) ** 2)


import math

def solve():
	(a, b) = map(int, input().split())
	m1 = max(a, b)
	m2 = min(a, b)
	m = max(m1, 2 * m2)
	print(m * m)
	return
t = 1
t = int(input())
while t > 0:
	t -= 1
	solve()


import sys
t = int(input())
for tc in range(t):
	(a, b) = [int(x) for x in input().split()]
	if a > b:
		temp = a
		a = b
		b = temp
	if 2 * a >= b:
		print((2 * a) ** 2)
	else:
		print(b ** 2)


t = int(input())
for hh in range(0, t):
	(a, b) = [int(x) for x in input().split()]
	(a, b) = (max(a, b), min(a, b))
	mx = a
	mx2 = b * 2
	print(max(mx * mx, mx2 * mx2))


t = int(input())
for i in range(t):
	(l, b) = map(int, input().split())
	print(max(max(l, b) ** 2, 4 * min(l, b) ** 2))


def main():
	n = int(input())
	for i in range(n):
		temp = str(input())
		splited = temp.split(' ')
		temp1 = int(splited[0])
		temp2 = int(splited[1])
		if temp1 == temp2:
			a = temp1
			b = temp2
		else:
			a = min(temp2, temp1)
			b = max(temp2, temp1)
		area = max(2 * a, b) ** 2
		print(area)
main()


for _ in range(int(input())):
	sides = list(map(int, input().split()))
	side_sq = min(sides) * 2
	if side_sq < max(sides):
		side_sq = max(sides)
	print(side_sq ** 2)


def minimal_square(a, b):
	if b < a:
		if 2 * b >= a:
			return (2 * b) ** 2
		else:
			return a ** 2
	elif a < b:
		if 2 * a >= b:
			return (2 * a) ** 2
		else:
			return b ** 2
	else:
		return (a * 2) ** 2
t = int(input())
while t > 0:
	ab = input().split()
	a = int(ab[0])
	b = int(ab[1])
	print(minimal_square(a, b))
	t -= 1


t = int(input())
for i in range(t):
	arr = [int(x) for x in input().split()]
	arr.sort(reverse=True)
	a = arr[0]
	b = arr[1]
	if a <= 2 * b:
		print(4 * b * b)
	else:
		print(a * a)


for _ in range(int(input())):
	n = sorted(list(map(int, input().split())))
	print(max(2 * n[0], n[1]) ** 2)


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	if a > b:
		b *= 2
	else:
		a *= 2
	while a != b:
		if a > b:
			b += 1
		else:
			a += 1
	print(a * b)


for _ in range(int(input().strip())):
	(a, b) = map(int, input().strip().split())
	ans = max(max(a, b), 2 * min(a, b)) ** 2
	print(str(ans))


from math import sqrt
t = int(input())
for _ in range(t):
	arr = list(map(int, input().split()))
	arr.sort(reverse=True)
	if arr[1] * 2 <= arr[0]:
		print(arr[0] ** 2)
	else:
		print((arr[1] * 2) ** 2)


for _ in range(int(input())):
	[a, b] = list(map(int, input().split(' ')))
	if a >= b:
		mini = b
		maxi = a
	else:
		mini = a
		maxi = b
	if mini * 2 <= maxi:
		print(maxi ** 2)
	else:
		mini = mini * 2
		print(mini ** 2)


for t in range(int(input())):
	(a, b) = map(int, input().split())
	s = 0
	c = []
	if a >= 2 * b:
		c.append(a)
	if b >= 2 * a:
		c.append(b)
	if 2 * a >= b:
		c.append(2 * a)
	if 2 * b >= a:
		c.append(2 * b)
	c.append(a + b)
	s = int(min(c) ** 2)
	print(s)


n = int(input())
for i in range(n):
	a = list(map(int, input().split(' ')))
	b = min(a)
	c = max(a)
	e = b * 2
	if e >= c:
		print(e * e)
	else:
		print(c * c)


n = int(input())
for i in range(n):
	line = input().split()
	(a, b) = (int(line[0]), int(line[1]))
	if a < b:
		tmp = a
		a = b
		b = tmp
	sqr_len = max(a, 2 * b)
	sqr_len = min(sqr_len, a + b)
	print(sqr_len * sqr_len)


testcases = int(input())
for i in range(testcases):
	(a, b) = map(int, input().strip().split(' '))
	x = 2 * min(a, b)
	m = max(a, b)
	if x >= m:
		print(x * x)
	else:
		print(m * m)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	if a < b:
		(a, b) = (b, a)
	if a > 1 and b == 1:
		print(a ** 2)
	else:
		a1 = 2 * a
		a2 = 2 * b
		if a2 > a:
			print(a2 ** 2)
		else:
			print(a ** 2)


num_case = input()
cases = []
for i in range(int(num_case)):
	case = input().split()
	case = [int(i) for i in case]
	cases.append(case)
for i in range(int(num_case)):
	case = cases[i]
	side_l = 0
	if min(case) * 2 > max(case):
		side_l = min(case) * 2
	else:
		side_l = max(case)
	print(side_l ** 2)


def fun(a, b):
	if a == b:
		return 4 * pow(a, 2)
	if min(a, b) * 2 == max(a, b):
		return pow(min(a, b) + min(a, b), 2)
	if min(a, b) * 2 < max(a, b):
		return max(a, b) * max(a, b)
	if min(a, b) * 2 > max(a, b):
		return pow(min(a, b) + min(a, b), 2)
for i in range(0, int(input())):
	(a, b) = [int(x) for x in input().split()]
	print(fun(a, b))


n = int(input())
l = []
for i in range(n):
	c = list(map(int, input().split(' ')))
	l.append(c.copy())

def func(a, b):
	if a == b:
		print(4 * a * b)
		return
	x = max(a, b)
	mx = x
	recarea = 2 * a * b
	while True:
		if x * x >= recarea and (x >= 2 * mx or (x >= 2 * (a + b - mx) and x >= mx)):
			print(x * x)
			return
		x += 1
for i in l:
	func(i[0], i[1])


T = int(input())
for t in range(0, T):
	(a, b) = map(int, input().split())
	flag = 0
	if a > b:
		mx = a
		mn = b
	elif a < b:
		mx = b
		mn = a
	else:
		print(4 * a * a)
		flag = 1
	if flag == 0:
		if mn + mn >= mx:
			print(4 * mn * mn)
		else:
			print(mx * mx)


for i in range(int(input())):
	(a, b) = [int(i) for i in input().split()]
	if a > b:
		(a, b) = (b, a)
	k = 2 * a
	if k < b:
		k = b
	print(k * k)


def min_square_area(a, b):
	return max(min(a, b) * 2, max(a, b)) ** 2
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	print(min_square_area(a, b))


for i in range(int(input())):
	(a, b) = map(int, input().split())
	c = 0
	x = min(a, b) * 2
	c = max(x, max(a, b))
	print(c ** 2)


for _ in range(int(input())):
	(a, b) = [int(i) for i in input().split()]
	mn = min(a, b)
	mx = a + b - mn
	i = 1
	while True:
		if i ** 2 >= 2 * a * b and i >= 2 * mn and (i >= mx):
			print(i ** 2)
			break
		i += 1


def time(a, b):
	if b > a:
		(a, b) = (b, a)
	if 2 * b >= a:
		return 4 * b * b
	else:
		return a * a
t = int(input())
ans = []
for i in range(t):
	n = list(map(int, input().rstrip().split()))
	a = n[0]
	b = n[1]
	r = time(a, b)
	ans.append(r)
for i in ans:
	print(i)


tests = int(input())
while tests > 0:
	(a, b) = [int(i) for i in input().split(' ')]
	minSide = min(a, b)
	maxSide = max(a, b)
	if maxSide / minSide <= 2:
		print(pow(minSide * 2, 2))
	else:
		print(pow(maxSide, 2))
	tests = tests - 1


T = int(input())
while T > 0:
	(a, b) = map(int, input().split())
	a1 = max(2 * a, b) ** 2
	a2 = max(2 * b, a) ** 2
	a3 = max(a + b, a) ** 2
	print(min(a1, a2, a3))
	T -= 1


tc = int(input())
while tc > 0:
	(a, b) = map(int, input().split())
	print(max(min(a, b) * 2, max(a, b)) ** 2)
	tc -= 1


import sys

def in_int():
	return int(sys.stdin.readline())

def in_str():
	return sys.stdin.readline().rstrip()

def in_map_int():
	return map(int, sys.stdin.readline().split())

def in_arr_int():
	return list(map(int, sys.stdin.readline().split()))

def in_arr_str():
	return sys.stdin.readline().split()

def is_prime(n):
	for i in range(2, int(n ** (1 / 2)) + 1):
		if n % i == 0:
			return True
	return False

def solve(a, b):
	(mn, mx) = (min(a, b), max(a, b))
	if mn * 2 >= mx:
		return 4 * mn * mn
	return mx * mx

def main():
	t = in_int()
	for _ in range(t):
		(a, b) = in_map_int()
		print(solve(a, b))
main()


numb = int(input())
for n in range(numb):
	word = str(input()).split(' ')
	word[0] = int(word[0])
	word[1] = int(word[1])
	s1 = min(word)
	s2 = max(word)
	if 2 * s1 <= s2:
		print(s2 ** 2)
	else:
		s1 = s1 * 2
		if s1 > s2:
			print(s1 ** 2)
		else:
			print(s2 ** 2)


x = int(input())
for q in range(x):
	inp = input().split()
	lst = [int(i) for i in inp]
	lst.sort()
	lst[0] = lst[0] * 2
	print(max(lst) * max(lst))


t = int(input())
for testcase in range(t):
	args = input().split()
	a = int(args[0])
	b = int(args[1])
	ans = min(a + b, min(max(2 * a, b), max(a, 2 * b)))
	print(ans * ans)


n = int(input())
for i in range(n):
	(a, b) = map(int, input().strip().split(' '))
	c = 0
	if a < b:
		c = a * 2
		if c > b:
			print(c * c)
		else:
			print(b * b)
	else:
		c = b * 2
		if c < a:
			print(a * a)
		else:
			print(c * c)


t = int(input())
for x in range(t):
	(a, b) = map(int, input().split())
	mi = min(a, b)
	ma = max(a, b)
	if 2 * mi < ma:
		print(ma * ma)
	else:
		print(4 * mi * mi)


from math import ceil
t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	if a > b:
		(a, b) = (b, a)
	c = a * b * 2
	d = a + a
	e = b * b
	f = a + b
	if d * d >= c:
		print(d * d)
	elif e >= c:
		print(e)
	else:
		print(f * f)


t = int(input())
for i in range(1, t + 1):
	(n, m) = [int(s) for s in input().split(' ')]
	minside = min(m, n)
	maxside = max(m, n)
	if minside * 2 <= maxside:
		print(maxside ** 2)
		continue
	else:
		print((minside * 2) ** 2)
		continue


t = int(input())
res = []
for i in range(t):
	(a, b) = list(map(int, input().split()))
	l = max(a, b)
	w = min(a, b)
	df = max(2 * w, l)
	res.append(str(df ** 2))
print('\n'.join(res))


import os, sys
t = int(input())
for nc in range(t):
	(a, b) = [int(x) for x in input().strip().split()]
	ans = []
	ans.append(max(2 * a, b) ** 2)
	ans.append(max(2 * b, a) ** 2)
	print(min(ans))


t = int(input())
while t > 0:
	(a, b) = [int(i) for i in input().split()]
	if b > a:
		(a, b) = (b, a)
	elif b == a:
		print((a * 2) ** 2)
		t -= 1
		continue
	if a <= 2 * b:
		print((b * 2) ** 2)
	else:
		print(a ** 2)
	t -= 1


t = int(input())
for i in range(t):
	ab = list(map(int, input().split()))
	littleside = min(ab[0], ab[1])
	biggestside = max(ab[0], ab[1])
	print(max(2 * littleside, biggestside) ** 2)


t = int(input())
while t:
	t -= 1
	(n, k) = map(int, input().rstrip().split(' '))
	m = max(n, k)
	mi = min(n, k)
	if 2 * mi >= m:
		print((2 * min(n, k)) ** 2)
	else:
		print(m ** 2)


from __future__ import division, print_function
import itertools
import sys
import os
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
	input = raw_input
	range = xrange
	filter = itertools.ifilter
	map = itertools.imap
	zip = itertools.izip

def is_it_local():
	script_dir = str(os.getcwd()).split('/')
	username = 'dipta007'
	return username in script_dir

def READ(fileName):
	if is_it_local():
		sys.stdin = open(f'./{fileName}', 'r')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
if not is_it_local():
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
	input = lambda : sys.stdin.readline().rstrip('\r\n')

def input1(type=int):
	return type(input())

def input2(type=int):
	[a, b] = list(map(type, input().split()))
	return (a, b)

def input3(type=int):
	[a, b, c] = list(map(type, input().split()))
	return (a, b, c)

def input_array(type=int):
	return list(map(type, input().split()))

def input_string():
	s = input()
	return list(s)

def main():
	t = input1()
	for ci in range(t):
		(a, b) = input2()
		for i in range(1, 201):
			if a + a <= i and b <= i or (b + b <= i and a <= i) or (a + b <= i and max(a, b) <= i):
				print(i * i)
				break
	pass
READ('in.txt')
main()


t = int(input())
for i in range(t):
	t -= 1
	(n, m) = map(int, input().split())
	p = min(n, m) * 2
	if p > max(n, m):
		print(p * p)
	else:
		print(max(n, m) ** 2)


from sys import stdin, stdout
import heapq
import cProfile
from collections import Counter, defaultdict, deque
from functools import reduce
import math

def get_int():
	return int(stdin.readline().strip())

def get_tuple():
	return map(int, stdin.readline().split())

def get_list():
	return list(map(int, stdin.readline().split()))

def solve():
	(x, y) = get_tuple()
	ans = max(2 * min(x, y), max(x, y))
	print(ans ** 2)

def main():
	solve()
TestCases = True
if TestCases:
	for i in range(get_int()):
		main()
else:
	main()


t = int(input())
for i in range(t):
	s = input().split()
	a = int(s[0])
	b = int(s[1])
	if a > b and a < 2 * b or a == b:
		x = (2 * b) ** 2
	elif b > a and b < 2 * a:
		x = (2 * a) ** 2
	elif a > b:
		x = a * a
	else:
		x = b * b
	print(x)


t = int(input())
for i in range(t):
	a = sorted(list(map(int, input().split())))
	if 2 * min(a) >= max(a):
		print(pow(2 * min(a), 2))
	else:
		print(pow(max(a), 2))


import math

def side(a, b):
	if 2 * a > b:
		return 2 * a
	else:
		return b
for _ in range(int(input())):
	(a, b) = map(int, input().strip().split(' '))
	if a > b:
		(a, b) = (b, a)
	print(pow(side(a, b), 2))


t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	minA = min(a, b)
	miniSquare = (minA + minA) ** 2
	if miniSquare - 2 * a * b >= 0:
		print(miniSquare)
	else:
		print(max(a, b) ** 2)


def read():
	return list(map(int, input().split()))
for i in range(int(input())):
	(a, b) = read()
	print(min(max(2 * a, b), max(2 * b, a)) ** 2)


import sys

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def get_list():
	return list(map(int, sys.stdin.readline().strip().split()))
testCases = int(input())
while testCases != 0:
	(a, b) = get_ints()
	if b > a:
		switchy = a
		a = b
		b = switchy
	if a >= 2 * b:
		print(int(a * a))
	else:
		print(int(4 * b * b))
	testCases -= 1


from sys import stdin, stdout

def solution():
	(a, b) = [int(x) for x in stdin.readline().rstrip().split()]
	if 2 * min(a, b) < max(a, b):
		return max(a, b) ** 2
	else:
		return (2 * min(a, b)) ** 2
cases = int(stdin.readline())
for i in range(cases):
	print(solution())


T = int(input())
c = []
for i in range(T):
	(a, b) = map(int, input().split())
	d = pow(min(max(2 * a, b), max(2 * b, a)), 2)
	c.append(d)
for i in range(T):
	print(c[i])


import math
for i in range(int(input())):
	(a, b) = list(map(int, input().split()))
	if a > b:
		if a < b * 2:
			print((b * 2) ** 2)
		elif a >= b * 2:
			print(a ** 2)
	elif b > a:
		if b < a * 2:
			print((a * 2) ** 2)
		elif b >= a * 2:
			print(b ** 2)
	else:
		print((a * 2) ** 2)


t = int(input())
for i in range(t):
	(a, b) = list(map(int, input().split()))
	if a < b:
		ans = max(2 * a, b)
	else:
		ans = max(2 * b, a)
	print(ans ** 2)


test = int(input())
while test:
	(a, b) = map(int, input().split())
	large = max(a, b)
	small = min(a, b)
	if large >= 2 * small:
		print(large ** 2)
	else:
		print((small * 2) ** 2)
	test -= 1


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	mi = min(a, b)
	mi = 2 * mi
	mx = max(a, b)
	for i in range(500):
		if i >= mi and i >= mx:
			print(i * i)
			break


import sys
input = sys.stdin.readline
t = int(input())
for t1 in range(t):
	(a, b) = list(map(int, input().split(' ')))
	temp = min(a, b)
	z = max(a, b)
	if 2 * temp >= z:
		print((2 * temp) ** 2)
	else:
		print(z ** 2)


import math
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	(l, g) = (min(a, b), max(a, b))
	if 2 * l < g:
		print(int(math.pow(g, 2)))
	else:
		print(int(math.pow(2 * l, 2)))


for i in range(int(input())):
	(a, b) = map(int, input().split())
	m = min(a, b)
	ar = 2 * m
	while ar < max(a, b):
		ar += 1
	print(ar ** 2)


t = int(input())
for _ in range(t):
	(a, b) = list(map(int, input().split()))
	if a < b:
		s = a + a
		if s >= b:
			print(s * s)
		else:
			print(b * b)
	elif a >= b:
		s = b + b
		if s >= a:
			print(s * s)
		else:
			print(a * a)


import math
for i in range(int(input())):
	(n, k) = map(int, input().split())
	l = [n, k]
	l.sort()
	n = l[0]
	k = l[1]
	if 2 * n >= k:
		print(2 * n * n * 2)
	else:
		print(k * k)


import math, sys
from sys import stdin, stdout
from collections import Counter, defaultdict, deque
input = stdin.readline
I = lambda : int(input())
li = lambda : list(map(int, input().split()))

def solve():
	a = li()
	a.sort()
	(a, b) = a
	if 2 * a >= b:
		print(2 * a * 2 * a)
	else:
		print(b * b)
for _ in range(I()):
	solve()


t = int(input())
for z in range(t):
	(a, b) = map(int, input().split())
	if a > b:
		(a, b) = (b, a)
	a = 2 * a
	answer = max(a, b) ** 2
	print(answer)


def min_area(x, y):
	size = min(max(x * 2, y), max(a, y * 2))
	return size * size
t = int(input())
for i in range(t):
	(a, b) = list(map(int, input().split()))
	print(min_area(a, b))


def calcolo_quadrato(a, b):
	c = min(a, b)
	d = max(a, b)
	lato = c
	if c <= d / 2:
		lato = d
		print(lato * lato)
		return
	else:
		lato = 2 * c
		print(lato * lato)
		return
T = int(input())
for k in range(T):
	(a, b) = [int(x) for x in input().split()]
	calcolo_quadrato(a, b)


t = int(input())
a = []
for i in range(t):
	l = [int(i) for i in input().split(' ')]
	l.sort()
	if l[0] == l[1] or l[0] > l[1] // 2:
		s = 2 * l[0]
	else:
		s = l[1]
	a.append(s)
for i in a:
	print(i * i)


test_count = int(input())
for i in range(test_count):
	(a, b) = map(int, input().split())
	ways = [(a + a, b), (a + b, a), (a + b, b), (b + b, a)]
	ways.sort(key=lambda x: max(x))
	print(max(ways[0]) ** 2)


n = int(input())
for i in range(n):
	string = input().split()
	a = int(string[0])
	b = int(string[1])
	square = a * b * 2
	x1 = (a + a) ** 2
	x2 = (b + b) ** 2
	x3 = (b + a) ** 2
	if a * a >= square:
		print(a * a)
	elif b * b >= square:
		print(b * b)
	else:
		arr = []
		if x1 >= square:
			arr.append(x1)
		if x2 >= square:
			arr.append(x2)
		if x3 >= square:
			arr.append(x3)
		print(min(arr))


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	a_2 = 2 * a
	b_2 = 2 * b
	new_a = a
	new_b = b
	maxa = 0
	maxb = 0
	i = b
	while True:
		if i >= 0 and i <= a_2:
			if new_b == a_2:
				maxa = int(new_b ** 2)
				break
			new_b += 1
			i = i - 1
		else:
			break
	j = a
	while True:
		if j >= 0 and j <= b_2:
			if new_a == b_2:
				maxb = int(new_a ** 2)
				break
			new_a += 1
			j = j - 1
		else:
			break
	if max(maxa, maxb) == 0:
		if a > b:
			print(int(a ** 2))
		else:
			print(int(b ** 2))
	else:
		print(max(maxa, maxb))


def read_tokens():
	return input().strip().split(' ')

def read_ints():
	return [int(s) for s in read_tokens()]
T = int(input())

def solve(a, b) -> int:
	if a > 2 * b:
		return a * a
	if b > 2 * a:
		return b * b
	if (2 * a) ** 2 > (2 * b) ** 2:
		return (2 * b) ** 2
	return (2 * a) ** 2
for test in range(T):
	(a, b) = read_ints()
	ans = solve(a, b)
	print(ans)


n = int(input())
for w in range(n):
	(a, b) = map(int, input().split())
	m1 = min(a, b)
	m2 = max(a, b)
	if 2 * m1 < m2:
		print(m2 ** 2)
	else:
		print((2 * m1) ** 2)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	(f, q) = (min(a, b), max(a, b))
	if f * 2 >= q:
		a = 2 * f
	else:
		a = q
	print(a ** 2)


import sys
cases = int(sys.stdin.readline())
for _ in range(cases):
	(a, b) = map(int, sys.stdin.readline().split())
	small = min(a, b)
	large = max(a, b)
	if 2 * small > large:
		print((2 * small) ** 2)
	else:
		print(large ** 2)


t = int(input())
for _ in range(t):
	inp1 = str(input())
	inp = inp1.split()
	a = int(inp[0])
	b = int(inp[1])
	c = max(a, b)
	d = min(a, b)
	if a == b:
		e = a + b
		ans = e * e
	elif c / 2 >= d:
		ans = c * c
	else:
		ans = (d * 2) ** 2
	print(ans)


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	t1 = 2 * b
	t2 = 2 * a
	if t2 >= b and a < b:
		print(t2 * t2)
	elif t1 >= a and a >= b:
		print(t1 * t1)
	elif t2 < b:
		if t1 >= a:
			print(b * b)
	elif t1 < a:
		if t2 >= b:
			print(a * a)
	else:
		print(a * a)


t = int(input())
for j in range(t):
	(a, b) = map(int, input().split())
	if b > a:
		s = a
		a = b
		b = s
	if a <= 2 * b:
		print((2 * b) ** 2)
	else:
		print(a * a)


inp = lambda : map(int, input().split())
t = int(input())
for _ in range(t):
	(a, b) = inp()
	ma = max(a, b)
	mi = min(a, b)
	if a != b:
		if ma >= 2 * mi:
			print(ma * ma)
		else:
			print(4 * mi * mi)
		continue
	else:
		print(4 * a * b)
		continue


for _ in [0] * int(input()):
	(a, b) = map(int, input().split())
	sides = sorted([a, b])
	if 2 * sides[0] >= sides[1]:
		print((2 * sides[0]) ** 2)
	else:
		print(sides[1] ** 2)


t = int(input())
for _ in range(t):
	(a, b) = [int(i) for i in input().split()]
	ans = 0
	if a > b:
		t = b
		b = a
		a = t
	if a + a < b:
		ans = b * b
	elif a + a > b:
		ans = 4 * a * a
	else:
		ans = a * b * 2
	print(ans)


x = int(input())
if x < 1 or x > 10000:
	exit()
r = [0 for i in range(x)]
s = [0 for i in range(x)]
d = [[0, 0] for i in range(x)]
for i in range(x):
	(d[i][0], d[i][1]) = map(int, input().split())
	if (d[i][0] < 1 or d[i][0] > 100) and (d[i][1] < 1 or d[i][1] > 100):
		exit()
for i in range(x):
	r[i] = min(max(d[i][0], 2 * d[i][1]), max(d[i][1], 2 * d[i][0]))
	s[i] = r[i] * r[i]
	print(s[i])


testcase = int(input())
for i in range(testcase):
	lengths = [int(x) for x in input().split()]
	minimum = min(lengths)
	while min(lengths) * 2 > minimum or max(lengths) > minimum:
		minimum += 1
	print(minimum ** 2)


t = int(input())
size = lambda a, b: min(max(2 * a, b), max(a, 2 * b), max(a + b, b), max(a + b, a))
while t > 0:
	(a, b) = list(map(int, input().split()))
	side = size(a, b)
	print(side * side)
	t = t - 1


number = int(input())
for i in range(number):
	inputs = input()
	(a, b) = list(map(int, inputs.split(' ')))
	aMin = min(a, b)
	aMax = max(a, b)
	if 2 * aMin <= aMax:
		print(aMax * aMax)
	else:
		print(4 * aMin * aMin)


def N():
	return int(input())

def NM():
	return map(int, input().split())

def L():
	return list(NM())

def LN(n):
	return [N() for i in range(n)]

def LL(n):
	return [L() for i in range(n)]
t = N()
for i in range(t):
	l = L()
	l.sort()
	(a, b) = l
	print(max(2 * a, b) ** 2)


a = int(input())
for i in range(0, a):
	(x, y) = input().split()
	x = int(x)
	y = int(y)
	if 2 * x < y or 2 * y < x:
		print(max(x, y) ** 2)
	else:
		print((min(x, y) * 2) ** 2)


try:
	for i in range(int(input())):
		(a, b) = list(map(int, input().split()))
		print(max(max(a, b), 2 * min(a, b)) ** 2)
except:
	pass


from sys import stdin, stdout, setrecursionlimit
from collections import deque, defaultdict
import math
rl = lambda : stdin.readline()
rll = lambda : stdin.readline().split()
rli = lambda : map(int, stdin.readline().split())
(INF, NINF) = (float('inf'), float('-inf'))

def main():
	T = int(rl())
	for _ in range(T):
		(a, b) = rli()
		s1 = max(2 * b, a)
		s2 = max(2 * a, b)
		s4 = a + b
		print(min(s1 ** 2, s2 ** 2, s4 ** 2))
	stdout.close()
main()


for ii in range(int(input())):
	(a, b) = map(int, input().split())
	if a == b:
		print(a * b * 4)
	elif min(a, b) == 1:
		print(max(a, b) ** 2)
	else:
		x = max(a, b)
		y = min(a, b)
		if y + y > x:
			print((y + y) * (y + y))
		elif y + y <= x:
			print(x * x)


t = int(input())
while t > 0:
	t -= 1
	L = list(map(int, input().split()))
	L.sort()
	if L[0] == L[1]:
		print(sum(L) ** 2)
	else:
		print(max(2 * L[0], L[1]) ** 2)


def main():
	count = input()
	a = [[] for i in range(int(count))]
	for i in range(len(a)):
		inputstr = input()
		a[i] = inputstr.split()
	for x in range(len(a)):
		l = int(a[x][0])
		w = int(a[x][1])
		if l < w:
			min = l
			max = w
		else:
			min = w
			max = l
		if max > 2 * min:
			print(max * max)
		else:
			print(2 * min * (2 * min))
main()


def solve():
	from sys import stdin, stdout
	t = int(stdin.readline())
	while t > 0:
		(l, b) = map(int, input().strip().split())
		if l == b:
			print((2 * l) ** 2)
		elif l < b:
			if 2 * l <= b:
				print(b ** 2)
			else:
				print((2 * l) ** 2)
		elif 2 * b <= l:
			print(l ** 2)
		else:
			print((2 * b) ** 2)
		t -= 1
solve()


t = int(input())
for i in range(t):
	(a, b) = input().split()
	a = int(a)
	b = int(b)
	k = min(a, b)
	if k * 2 >= max(a, b):
		print(k * k * 4)
	else:
		print(max(a, b) * max(a, b))


import sys
IN = [x.strip() for x in sys.stdin.readlines()]
T = int(IN[0])
for i in range(T):
	(a, b) = [int(x) for x in IN[1 + i].split(' ')]
	area = 0
	if a < b:
		if 2 * a <= b:
			area = b * b
		else:
			area = 2 * a * 2 * a
	elif 2 * b <= a:
		area = a * a
	else:
		area = 2 * b * 2 * b
	print(f'{area}')


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	(x, y) = (max(a, b), min(a, b))
	while x ** 2 < x * (2 * y):
		x += 1
	print(x ** 2)


def main(a, b):
	return max(min(a, b) * 2, a, b) ** 2
t = int(input())
for i in range(t):
	(n, k) = input().split()
	a = int(n)
	b = int(k)
	print(main(a, b))


t = int(input())
for _ in range(t):
	(n, m) = map(int, input().split())
	ans = min(max(n, 2 * m), max(2 * n, m))
	print(ans ** 2)


n = int(input())
for i in range(n):
	test = input().split()
	a = int(test[0])
	b = int(test[1])
	l = list()
	if a == 2 * b or b == a * 2:
		l.append(2 * a * b)
	if (2 * a) ** 2 >= 2 * a * b:
		l.append((2 * a) ** 2)
	if (2 * b) ** 2 >= 2 * a * b:
		l.append((2 * b) ** 2)
	if a > 2 * b:
		l.append(a * a)
	if b > 2 * a:
		l.append(b * b)
	print(min(l))


import sys
TEST = 0
if TEST == 1:
	input_file = open('inputA.txt', 'r')
	input_from_file = input_file.readlines()

def read_int():
	if TEST:
		return int(input_from_file.pop(0))
	else:
		return int(sys.stdin.readline())

def read_ints():
	if TEST:
		return list(map(int, input_from_file.pop(0).rstrip().split()))
	else:
		return list(map(int, sys.stdin.readline().split()))
t = read_int()
for test in range(t):
	(a, b) = read_ints()
	l = max(2 * min(a, b), max(a, b))
	print(l ** 2)


t = input()
y = 0
k = int(t)
while y < k:
	(l, b) = [int(x) for x in input().split()]
	m = min(l, b)
	if m == l:
		if 2 * m >= b:
			print(2 * m * (2 * m))
		else:
			print(b * b)
	elif m == b:
		if 2 * m >= l:
			print(2 * m * (2 * m))
		else:
			print(l * l)
	y = y + 1


x = int(input())
first = []
sec = []
for i in range(0, x):
	(a, b) = map(int, input().split())
	first.append(a)
	sec.append(b)
for i in range(0, x):
	if first[i] >= sec[i]:
		if sec[i] * 2 >= first[i]:
			print((sec[i] * 2) ** 2)
		else:
			print(first[i] ** 2)
	if sec[i] > first[i]:
		if first[i] * 2 > sec[i]:
			print((first[i] * 2) ** 2)
		else:
			print(sec[i] ** 2)


def abc():
	(a, b) = sorted(list(map(int, input().split())))
	return max(2 * a, b) ** 2
for _ in range(int(input())):
	print(abc())


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	seleccionado2 = max(a, b)
	seleccionado = min(a * 2, b * 2)
	if seleccionado < seleccionado2:
		print(pow(seleccionado2, 2))
	else:
		print(pow(seleccionado, 2))


t = int(input())
while t:
	(a, b) = map(int, input().split())
	x = min(max(a + a, b), max(b + b, a), a + b)
	print(x * x)
	t = t - 1


t = int(input())
while t > 0:
	(a, b) = map(int, input().split())
	ans = min(max(b, a * 2), max(a, b * 2))
	ans = min(ans, a + b)
	print(pow(ans, 2))
	t -= 1


t = int(input())
for ti in range(t):
	(a, b) = input().split()
	a = int(a)
	b = int(b)
	less = 1000000
	if 2 * a >= b:
		less = 4 * a * a
	else:
		less = b ** 2
	if 2 * b >= a:
		if 4 * b * b < less:
			less = 4 * b * b
	elif a ** 2 < less:
		less = a ** 2
	print(less)


def main():
	t = int(input())
	for i in range(t):
		nums = list(map(int, input().split()))
		(a, b) = (nums[0], nums[1])
		if b > a:
			(a, b) = (b, a)
		b += b
		print(max(a * a, b * b))
main()


import sys
from math import ceil, sqrt, sin, pi, tan
from collections import defaultdict
read = sys.stdin.buffer.readline
import heapq
mi = lambda : map(int, read().split())
li = lambda : list(mi())
cin = lambda : int(read())

def isp(n):
	i = 2
	while i * i <= n:
		if n % i == 0:
			return False
		i += 1
	return True
ps = lambda x: x == pow(int(sqrt(x)), 2)
for _t in range(cin()):
	(a, b) = mi()
	print(min(max(a + a, b), max(b + b, a)) ** 2)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	min_val = min(a, b)
	max_val = max(a, b)
	if 2 * min_val > max_val:
		print((2 * min_val) ** 2)
	else:
		print(max_val ** 2)


def sol(a, b):
	m = min(a, b)
	M = max(a, b)
	if 2 * m > M:
		return (2 * m) ** 2
	else:
		return M ** 2
t = int(input())
for _ in range(t):
	(a, b) = list(map(int, input().split()))
	v = sol(a, b)
	print(v)


t = int(input())
for xy in range(t):
	(x, y) = list(map(int, input().split()))
	print(max(2 * min(x, y), max(x, y)) ** 2)


import math
for t in range(int(input())):
	(a, b) = map(int, input().split())
	l = max(a, b)
	li = min(a, b)
	li *= 2
	ans = max(l, li)
	print(ans * ans)


import os
import sys
from math import *
from collections import *
from bisect import *
from io import BytesIO, IOBase

def vsInput():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def value():
	return tuple(map(int, input().split()))

def array():
	return [int(i) for i in input().split()]

def Int():
	return int(input())

def Str():
	return input()

def arrayS():
	return [i for i in input().split()]
for _ in range(Int()):
	(a, b) = sorted(value())
	l = max(b, 2 * a)
	print(l * l)


n = int(input())
for x in range(n):
	(a, b) = map(int, input().split())
	if a * 2 >= b and a <= b:
		print(a * 2 * a * 2)
	elif b * 2 >= a and a > b:
		print(b * 2 * b * 2)
	elif a >= b:
		print(a * a)
	else:
		print(b * b)


t = int(input())
j = []
for i in range(t):
	(a, b) = [int(a) for a in input().split()]
	if a <= b and a >= b / 2:
		j.append(4 * a * a)
	elif a >= b and b >= a / 2:
		j.append(4 * b * b)
	elif a < b and a < b / 2:
		j.append(b * b)
	elif b < a and b < a / 2:
		j.append(a * a)
for k in range(t):
	print(j[k])


for i in range(int(input())):
	(a, b) = map(int, input().split())
	(a, b) = (max(a, b), min(a, b))
	(rec, ans) = (a * b, (2 * b) ** 2)
	print(ans if ans >= 2 * rec else a ** 2)


t = int(input())
while t > 0:
	(a, b) = list(map(int, input().strip(' ').split()))
	mi = min(a, b)
	ma = max(a, b)
	if 2 * mi >= ma:
		print(2 * mi * (2 * mi))
	else:
		print(ma * ma)
	t = t - 1


for _ in range(int(input())):
	li = list(map(int, input().split()))
	if 2 * min(li) > max(li):
		print((2 * min(li)) ** 2)
	else:
		print(max(li) ** 2)


T = int(input())
for _ in range(T):
	(n, m) = map(int, input().split())
	Min = 1000000000000
	if n + n >= m:
		Min = min(Min, (2 * n) ** 2)
	else:
		Min = min(Min, m ** 2)
	if m + m >= n:
		Min = min(Min, (2 * m) ** 2)
	else:
		Min = min(Min, n ** 2)
	print(Min)


t = int(input())
for i in range(t):
	ab = list(map(int, input().split()))
	ab.sort(reverse=True)
	if 2 * ab[1] <= ab[0]:
		print(ab[0] * ab[0])
	elif 2 * ab[1] > ab[0]:
		print(4 * ab[1] * ab[1])


q = int(input())
while q > 0:
	q -= 1
	(a, b) = map(lambda x: int(x), input().split())
	print(max(min(a, b) * 2, max(a, b)) * max(min(a, b) * 2, max(a, b)))


t = int(input())
for x in range(t):
	[a, b] = list(map(int, input().strip().split(' ')))
	m = min(a, b)
	M = max(a, b)
	if M >= 2 * m:
		print(M * M)
	else:
		print(4 * m * m)


for y in range(int(input())):
	(a, b) = map(int, input().split())
	n = min(a, b)
	m = max(a, b)
	if 2 * n >= m:
		print(4 * n * n)
	else:
		print(m * m)


from sys import stdin, stdout
import math
from collections import Counter, deque
L = lambda : list(map(int, stdin.readline().strip().split()))
M = lambda : map(int, stdin.readline().strip().split())
I = lambda : int(stdin.readline().strip())
IN = lambda : stdin.readline().strip()
C = lambda : stdin.readline().strip().split()
mod = 1000000007

def s(a):
	print(' '.join(list(map(str, a))))
for i in range(I()):
	(a, b) = M()
	print(pow(max(2 * min(a, b), max(a, b)), 2))


n = int(input())
tests = [input() for _ in range(n)]
ans = []
for _ in tests:
	(a, b) = map(int, _.split())
	x = min(a, b) * 2
	y = max(a, b)
	if x >= y:
		ans.append(x ** 2)
	else:
		ans.append(y ** 2)
[print(_) for _ in ans]


t = int(input())
while t > 0:
	(n, m) = input().split(' ')
	n = int(n)
	m = int(m)
	if n <= m:
		if 2 * n >= m:
			print(2 * n * (2 * n))
		else:
			print(m * m)
	elif 2 * m >= n:
		print(2 * m * (2 * m))
	else:
		print(n * n)
	t = t - 1


test = int(input())
while test > 0:
	test = test - 1
	(a, b) = input().split()
	a = int(a)
	b = int(b)
	x = max(a, 2 * b)
	y = max(2 * a, b)
	sq = min(x, y)
	print(sq * sq)


from sys import stdin
import math

def inp():
	return stdin.readline().strip()
t = int(inp())
for _ in range(t):
	(a, b) = [int(x) for x in inp().split()]
	maxi = max(a, b)
	mini = min(a, b) * 2
	if maxi > mini:
		print(maxi ** 2)
	else:
		print(mini ** 2)


for i in range(int(input())):
	(a, b) = [int(num) for num in input().split()]
	if max(a, b) > 2 * min(a, b):
		print(max(a, b) ** 2)
	else:
		print(4 * min(a, b) * min(a, b))


t = int(input())
for i in range(t):
	(l, b) = map(int, input().split())
	if l == b:
		print((2 * l) ** 2)
	else:
		temp1 = min(l, b)
		temp2 = max(l, b)
		if 2 * temp1 >= temp2:
			print((2 * temp1) ** 2)
		else:
			print(temp2 ** 2)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	d = min(a, b)
	e = max(a, b)
	if 2 * d > e:
		print(4 * d * d)
	else:
		print(e * e)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	mx = max(2 * a, b)
	mx1 = max(2 * b, a)
	print(min(mx ** 2, mx1 ** 2))


def solve():
	(a, b) = map(int, input().split())
	temp = min(a, b)
	if temp * 2 < max(a, b):
		temp = max(a, b)
	else:
		temp = min(a, b) * 2
	print(temp * temp)
t = int(input())
while t > 0:
	t -= 1
	solve()


t = int(input())
for u in range(t):
	(a, b) = map(int, input().split())
	x = min(a + b, max(b, 2 * a), max(a, 2 * b))
	print(x ** 2)


import math
t = int(input())
for u in range(t):
	(n, m) = list(map(int, input().split()))
	print(max(min(n, m) * 2, max(n, m)) ** 2)


for q in range(int(input())):
	(a, b) = map(int, input().split())
	A = min(a, b)
	B = max(a, b)
	A *= 2
	print(max(A, B) ** 2)


t = int(input())
for i in range(t):
	ab = list(map(int, input().rstrip().split()))
	a = int(ab[0])
	b = int(ab[1])
	if a > b:
		res1 = 2 * b
		res = a
	else:
		res1 = 2 * a
		res = b
	if res1 >= res:
		print(res1 ** 2)
	else:
		print(res ** 2)


import sys
for _ in range(int(sys.stdin.readline())):
	(a, b) = map(int, sys.stdin.readline().split())
	(a, b) = (min(a, b), max(a, b))
	if 2 * a >= b:
		sys.stdout.write(str((2 * a) ** 2) + '\n')
	else:
		sys.stdout.write(str(b ** 2) + '\n')


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, copy, functools
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
mod2 = 998244353
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return list(map(int, sys.stdin.readline().split()))

def LLI():
	return [list(map(int, l.split())) for l in sys.stdin.readlines()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def pf(s):
	return print(s, flush=True)

def pe(s):
	return print(str(s), file=sys.stderr)

def JA(a, sep):
	return sep.join(map(str, a))

def JAA(a, s, t):
	return s.join((t.join(map(str, b)) for b in a))

def main():
	t = I()
	aa = [sorted(LI()) for _ in range(t)]
	rr = []
	for (a, b) in aa:
		k = max(a * 2, b)
		rr.append(k ** 2)
	return JA(rr, '\n')
print(main())


t = int(input())
while t:
	(a, b) = map(int, input().split())
	minn = min(2 * a, 2 * b, a + b)
	(a, b) = sorted([a, b])
	if minn ** 2 >= b ** 2:
		print(minn ** 2)
	else:
		print(b ** 2)
	t -= 1


for testcase in range(int(input())):
	(a, b) = map(int, input().split())
	if a == min(a, b):
		if 2 * a > b:
			print(pow(2 * a, 2))
		else:
			print(b ** 2)
	elif 2 * b > a:
		print(pow(2 * b, 2))
	else:
		print(a ** 2)


for i in range(int(input())):
	a = list(map(int, input().split()))
	m = min(a)
	x = max(a)
	if m + m > x:
		print((m + m) * (m + m))
	else:
		print(x * x)


test_cases = int(input())
while test_cases:
	test_cases -= 1
	(a, b) = input().split()
	(a, b) = (int(a), int(b))
	val = min(max(2 * a, b), max(2 * b, a), a + b)
	print(val * val)


t = int(input())
res = 0
res_str = ''
for i in range(t):
	(a, b) = input().split(' ')
	a = int(a)
	b = int(b)
	if a > b:
		b *= 2
		if a > b:
			res = a * a
		else:
			res = b * b
	elif a < b:
		a *= 2
		if a < b:
			res = b * b
		else:
			res = a * a
	elif a == b:
		b *= 2
		res = b * b
	res_str += str(res) + '\n'
print(res_str)


t = int(input())
while t:
	(l, b) = list(map(int, input().split()))
	if l > b:
		(l, b) = (b, l)
	print(pow(max(2 * l, b), 2))
	t -= 1


t = int(input())
while t > 0:
	L = input().split(' ')
	if int(L[0]) > int(L[1]):
		b = int(L[0])
		s = int(L[1])
	else:
		s = int(L[0])
		b = int(L[1])
	area = 2 * b * s
	if (2 * s) ** 2 >= area:
		print(4 * s * s)
	else:
		print(b * b)
	t -= 1


t = int(input())
cnt = 0
while cnt < t:
	cnt += 1
	(a, b) = [int(i) for i in input().split()]
	if a < b:
		(a, b) = (b, a)
	print(max(2 * b, a) * max(2 * b, a))


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	v1 = max(b * 2, a)
	v1 = v1 ** 2
	v2 = max(a * 2, b)
	v2 = v2 ** 2
	print(min(v1, v2))


t = int(input())
for i in range(t):
	a = list(map(int, input().split()))
	a1 = sorted(a)
	if 2 * a1[0] >= a1[1]:
		print((2 * a1[0]) ** 2)
	else:
		print(a1[1] ** 2)


from sys import stdin, stdout
for i in range(int(stdin.readline())):
	(a, b) = [int(i) for i in stdin.readline().split()]
	if a > b:
		if a > 2 * b:
			print(a ** 2)
		else:
			print((2 * b) ** 2)
	elif b > 2 * a:
		print(b ** 2)
	else:
		print((2 * a) ** 2)


for t in range(int(input())):
	(a, b) = sorted(map(int, input().split()))
	if 2 * a < b:
		print(b * b)
	else:
		x = min(2 * a, 2 * b)
		print(x * x)


t = int(input())
while t > 0:
	(a, b) = input().split()
	a = float(a)
	b = float(b)
	if a > b:
		if a / b > 2:
			S = a ** 2
			S = int(S)
			print(S)
		else:
			S = (b * 2) ** 2
			S = int(S)
			print(S)
	elif a <= b:
		if b / a > 2:
			S = b ** 2
			S = int(S)
			print(S)
		else:
			S = (a * 2) ** 2
			S = int(S)
			print(S)
	t -= 1


for i in range(int(input())):
	nums = list(map(int, input().split(' ')))
	a = 2 * min(nums)
	while a < max(nums):
		a += 1
	print(a ** 2)


def cin():
	return map(int, sin().split())

def ain():
	return list(map(int, sin().split()))

def sin():
	return input()

def inin():
	return int(input())
for _ in range(inin()):
	(a1, b1) = cin()
	a = min(a1, b1)
	b = max(a1, b1)
	if a == b:
		print(4 * (a * a))
	elif 2 * a >= b:
		print(4 * a * a)
	else:
		print(b * b)


tests_count = int(input())
tests = [input() for _ in range(0, tests_count)]
for test in tests:
	(a, b) = (int(i) for i in test.split(' '))
	print(max(a, b, min(a, b) * 2) ** 2)


t = int(input())
a = 0
b = []
ans = 0
while a < t:
	a += 1
	n = str(input())
	b.append(n)
for x in b:
	x = str(x)
	r = x.find(' ')
	y = x[0:r]
	z = x[r + 1:]
	y = int(y)
	z = int(z)
	if y < z:
		if 2 * y > z:
			ans = (2 * y) ** 2
		else:
			ans = z ** 2
	elif 2 * z > y:
		ans = (2 * z) ** 2
	else:
		ans = y ** 2
	print(ans)


def main(a, b):
	x = 2 * a
	y = b
	if x < y:
		z1 = y * y
	else:
		z1 = x * x
	x = a
	y = 2 * b
	if x < y:
		z2 = y * y
	else:
		z2 = x * x
	if z2 < z1:
		return z2
	else:
		return z1
t = int(input())
for t_itr in range(t):
	ab = list(map(int, input().rstrip().split()))
	a = ab[0]
	b = ab[1]
	res = main(a, b)
	print(res)


a = int(input())
for i in range(a):
	(b, c) = sorted(map(int, input().split()))
	if b + b > c:
		print((b + b) * (b + b))
	else:
		print(c * c)


nb_cases = int(input())
while nb_cases > 0:
	nb_cases -= 1
	(a, b) = [int(x) for x in input().split()]
	if 2 * min(a, b) >= max(a, b):
		print((2 * min(a, b)) ** 2)
	else:
		print(max(a, b) ** 2)


t = int(input())
while t:
	t = t - 1
	(m, n) = list(map(int, input().split()))
	ma = max(max(m, n), 2 * min(m, n))
	print(ma * ma)


import math
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	if a == b:
		print(2 * a * a * 2)
		continue
	if a > b:
		min1 = b
		max1 = a
	else:
		max1 = b
		min1 = a
	min1 = 2 * min1
	diff = abs(min1 - max1)
	if min1 < max1:
		print((min1 + diff) * (min1 + diff))
	else:
		print((max1 + diff) * (max1 + diff))


import math
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	if a < b:
		(a, b) = (b, a)
	if a <= 2 * b:
		print(4 * b * b)
	elif a > 2 * b:
		print(a * a)


t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	mn = min(a, b)
	mx = max(a, b)
	side = 2 * mn
	if side >= mx:
		area = side * side
	else:
		area = mx * mx
	print(area)


testcase = int(input())
for i in range(testcase):
	(n, m) = map(int, input().split())
	val = max(n, m)
	val1 = min(n, m) * 2
	if val1 > val:
		print(val1 ** 2)
	else:
		print(val ** 2)


n = int(input())
for i in range(n):
	a = input().split(' ')
	a = list(map(int, a))
	if a[0] < a[1]:
		if 2 * a[0] > a[1]:
			print(4 * a[0] ** 2)
		else:
			print(a[1] ** 2)
	elif 2 * a[1] > a[0]:
		print(4 * a[1] ** 2)
	else:
		print(a[0] ** 2)


def solve(a, b):
	(a, b) = (max(a, b), min(a, b))
	if b * 2 <= a:
		x = a
	else:
		x = 2 * b
	return x * x

def bruh():
	t = int(input())
	ans = [0] * t
	for i in range(t):
		(a, b) = [int(i) for i in input().split()]
		ans[i] = solve(a, b)
	print('\n'.join(map(str, ans)))
bruh()


def ques1(a, b):
	if a == b:
		x = a * 2
		return x ** 2
	else:
		x = min(a, b)
		y = max(a, b)
		if x * 2 > y:
			k = x * 2
			return k ** 2
		else:
			return y ** 2
t = int(input())
for i in range(t):
	(a, b) = [int(i) for i in input().split()]
	ans = ques1(a, b)
	print(ans)


num_testcases = int(input())
for _ in range(num_testcases):
	(a, b) = input().strip().split()
	a = int(a)
	b = int(b)
	ans = max(2 * min(a, b), max(a, b))
	ans = ans * ans
	print(ans)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	am = max(a, b)
	bm = min(a, b)
	print(max(min(am, bm) * 2, max(am, bm)) ** 2)


test = int(input())
for t in range(test):
	(x, y) = map(int, input().split())
	i = 1
	if min(x, y) * 2 >= max(x, y):
		print((min(x, y) * 2) ** 2)
	else:
		print(max(x, y) ** 2)


T = int(input())
for _ in range(T):
	(a, b) = input().split()
	a = int(a)
	b = int(b)
	if a == b:
		print(4 * a * a)
	else:
		p = min(a, b)
		q = max(a, b)
		if 2 * p >= q:
			print(4 * p * p)
		else:
			print(q * q)


t = int(input())
while t != 0:
	t -= 1
	(a, b) = map(int, input().strip().split())
	k = min(a, b)
	if a == 1 and b == 1:
		print(4)
	elif 2 * k < max(a, b):
		print(max(a, b) ** 2)
	elif 2 * k >= max(a, b):
		print((2 * k) ** 2)


from math import radians
from heapq import heapify, heappush, heappop
import bisect
from math import pi
from collections import deque
from math import factorial
from math import log, ceil
from collections import defaultdict
from math import *
from sys import stdin, stdout
import itertools
import os
import sys
import threading
from collections import deque, Counter, OrderedDict, defaultdict
from heapq import *
from fractions import Fraction
mod = int(pow(10, 9) + 7)

def ii():
	return int(input())

def si():
	return str(input())

def mi():
	return map(int, input().split())

def li1():
	return list(mi())

def fii():
	return int(stdin.readline())

def fsi():
	return str(stdin.readline())

def fmi():
	return map(int, stdin.readline().split())

def fli():
	return list(fmi())
abd = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}

def getKey(item):
	return item[0]

def sort2(l):
	return sorted(l, key=getKey)

def d2(n, m, num):
	return [[num for x in range(m)] for y in range(n)]

def isPowerOfTwo(x):
	return x and (not x & x - 1)

def decimalToBinary(n):
	return bin(n).replace('0b', '')

def ntl(n):
	return [int(i) for i in str(n)]

def powerMod(x, y, p):
	res = 1
	x %= p
	while y > 0:
		if y & 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res
graph = defaultdict(list)
visited = [0] * 1000000
col = [-1] * 1000000

def bfs(d, v):
	q = []
	q.append(v)
	visited[v] = 1
	while len(q) != 0:
		x = q[0]
		q.pop(0)
		for i in d[x]:
			if visited[i] != 1:
				visited[i] = 1
				q.append(i)
		print(x)

def make_graph(e):
	d = {}
	for i in range(e):
		(x, y) = mi()
		if x not in d:
			d[x] = [y]
		else:
			d[x].append(y)
		if y not in d:
			d[y] = [x]
		else:
			d[y].append(x)
	return d

def gr2(n):
	d = defaultdict(list)
	for i in range(n):
		(x, y) = mi()
		d[x].append(y)
	return d

def connected_components(graph):
	seen = set()

	def dfs(v):
		vs = set([v])
		component = []
		while vs:
			v = vs.pop()
			seen.add(v)
			vs |= set(graph[v]) - seen
			component.append(v)
		return component
	ans = []
	for v in graph:
		if v not in seen:
			d = dfs(v)
			ans.append(d)
	return ans

def primeFactors(n):
	s = set()
	while n % 2 == 0:
		s.add(2)
		n = n // 2
	for i in range(3, int(sqrt(n)) + 1, 2):
		while n % i == 0:
			s.add(i)
			n = n // i
	if n > 2:
		s.add(n)
	return s

def find_all(a_str, sub):
	start = 0
	while True:
		start = a_str.find(sub, start)
		if start == -1:
			return
		yield start
		start += len(sub)

def SieveOfEratosthenes(n, isPrime):
	isPrime[0] = isPrime[1] = False
	for i in range(2, n):
		isPrime[i] = True
	p = 2
	while p * p <= n:
		if isPrime[p] == True:
			i = p * p
			while i <= n:
				isPrime[i] = False
				i += p
		p += 1
	return isPrime

def dijkstra(edges, f, t):
	g = defaultdict(list)
	for (l, r, c) in edges:
		g[l].append((c, r))
	(q, seen, mins) = ([(0, f, ())], set(), {f: 0})
	while q:
		(cost, v1, path) = heappop(q)
		if v1 not in seen:
			seen.add(v1)
			path = (v1, path)
			if v1 == t:
				return (cost, path)
			for (c, v2) in g.get(v1, ()):
				if v2 in seen:
					continue
				prev = mins.get(v2, None)
				next = cost + c
				if prev is None or next < prev:
					mins[v2] = next
					heappush(q, (next, v2, path))
	return float('inf')

def binsearch(a, l, r, x):
	while l <= r:
		mid = l + (r - 1) // 2
		if a[mid]:
			return mid
		elif a[mid] > x:
			l = mid - 1
		else:
			r = mid + 1
	return -1

def readTree(n):
	adj = [set() for _ in range(n)]
	for _ in range(n - 1):
		(u, v) = map(int, input().split())
		adj[u - 1].add(v - 1)
		adj[v - 1].add(u - 1)
	return adj

def treeOrderByDepth(n, adj, root=0):
	parent = [-2] + [-1] * (n - 1)
	ordered = []
	q = deque()
	q.append(root)
	depth = [0] * n
	while q:
		c = q.popleft()
		ordered.append(c)
		for a in adj[c]:
			if parent[a] == -1:
				parent[a] = c
				depth[a] = depth[c] + 1
				q.append(a)
	return (ordered, parent, depth)
for _ in range(ii()):
	(a, b) = mi()
	x = min(a, b)
	print(max(a, b, 2 * x) ** 2)


import sys
input = sys.stdin.readline
Q = int(input())
Query = [list(map(int, input().split())) for _ in range(Q)]
for (a, b) in Query:
	n1 = max(2 * a, b)
	n2 = max(2 * b, a)
	ans = min(n1, n2) ** 2
	print(ans)


import sys
import math
import collections
from sys import stdin, stdout, setrecursionlimit
import bisect as bs
setrecursionlimit(2 ** 20)
M = 10 ** 9 + 7
T = int(stdin.readline())
for _ in range(T):
	(a, b) = list(map(int, stdin.readline().split()))
	ans = []
	ans.append(max(2 * a, b))
	ans.append(max(2 * b, a))
	print(min(ans) ** 2)


from collections import Counter
t = int(input())
while t > 0:
	t = t - 1
	(a, b) = map(int, input().split())
	x = min(a, b)
	y = max(a, b)
	ans = max(2 * x, y)
	print(ans * ans)


t = int(input())
for you in range(t):
	l = input().split()
	a = int(l[0])
	b = int(l[1])
	if a < b:
		to = b
		b = a
		a = to
	s = max(2 * b, a)
	print(s * s)


t = int(input())
while t:
	t -= 1
	(a, b) = map(int, input().split())
	v = min(a, b)
	p = max(a, b)
	if 2 * v >= p:
		print(2 * 2 * v * v)
	else:
		print(p * p)


n = int(input())
for i in range(n):
	(a, b) = list(map(int, input().split()))
	mini = min(a, b)
	maxim = a + b - mini
	print(max(maxim, 2 * mini) ** 2)


n = int(input())
for i in range(n):
	(a, b) = map(int, input().split())
	if a > b:
		k = 2 * b
		if a >= k:
			print(a ** 2)
		else:
			print(k ** 2)
	elif b > a:
		k = 2 * a
		if b >= k:
			print(b ** 2)
		else:
			print(k ** 2)
	else:
		print((2 * a) ** 2)


from math import *
from sys import stdin, stdout
input = stdin.buffer.readline
t = int(input())
while t > 0:
	(a, b) = [int(x) for x in input().split()]
	x = min(a, b)
	y = max(a, b)
	l = max(2 * x, y)
	print(l * l)
	t -= 1


import sys
sys.setrecursionlimit(10 ** 7)
stdin = sys.stdin
ni = lambda : int(ns())
na = lambda : list(map(int, stdin.readline().split()))
ns = lambda : stdin.readline().rstrip()
t = ni()
for i in range(t):
	(a, b) = na()
	print(max((2 * min(a, b)) ** 2, max(a, b) ** 2))


def areaSquare(L, B):
	large = max(L, B)
	small = min(L, B)
	if large >= 2 * small:
		return large * large
	else:
		return 2 * small * (2 * small)
test = int(input())
for i in range(0, test):
	(a, b) = map(int, input().split())
	ans = areaSquare(a, b)
	print(ans)


(z, zz) = (input, lambda : list(map(int, z().split())))
zzz = lambda : [int(i) for i in stdin.readline().split()]
(szz, graph, mod, szzz) = (lambda : sorted(zz()), {}, 10 ** 9 + 7, lambda : sorted(zzz()))
from string import *
from re import *
from collections import *
from queue import *
from sys import *
from collections import *
from math import *
from heapq import *
from itertools import *
from bisect import *
from collections import Counter as cc
from math import factorial as f
from bisect import bisect as bs
from bisect import bisect_left as bsl
from itertools import accumulate as ac

def lcd(xnum1, xnum2):
	return xnum1 * xnum2 // gcd(xnum1, xnum2)

def prime(x):
	p = ceil(x ** 0.5) + 1
	for i in range(2, p):
		if x % i == 0 and x != 2 or x == 0:
			return 0
	return 1

def dfs(u, visit, graph):
	visit[u] = True
	for i in graph[u]:
		if not visit[i]:
			dfs(i, visit, graph)
num = int(z())
for _ in range(num):
	(n, m) = zz()
	print(min(max(2 * n, m), max(2 * m, n)) ** 2)


a = int(input())
i = 0
j = []
while i < a:
	(x, y) = input().split()
	i += 1
	if int(x) <= int(y):
		b = 2 * int(x)
		if b >= int(y):
			p = b ** 2
		else:
			p = int(y) ** 2
		j.append(p)
	else:
		b = 2 * int(y)
		if b >= int(x):
			p = b ** 2
		else:
			p = int(x) ** 2
		j.append(p)
for l in j:
	print(l)


import math
t = int(input())
for w in range(t):
	(a, b) = (int(i) for i in input().split())
	k = max(2 * min(a, b), max(a, b))
	print(k * k)


for zx in range(int(input())):
	(a, b) = map(int, input().split())
	f = 2 * min(a, b)
	d = max(f, a, b)
	print(d * d)


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	vverh = max(a, b)
	mini = min(a, b)
	mini *= 2
	print(max(mini, vverh) ** 2)


n = int(input())
for i in range(n):
	co = input().split(' ')
	m = int(co[0])
	n = int(co[1])
	s1 = 0
	s2 = 0
	s1 = min(m, n) * 2
	if s1 >= max(m, n):
		s2 = s1
	else:
		s1 = max(m, n)
		s2 = s1
	print(s1 * s2)


from sys import stdin
inp = stdin.readline
t = int(inp().strip())
while t:
	t -= 1
	(a, b) = [int(k) for k in inp().strip().split()]
	print((min(a, b) * 2 if min(a, b) * 2 >= max(a, b) else max(a, b)) ** 2)


for i in range(int(input())):
	a = list(map(int, input().split()))
	a.sort()
	if a[0] * 2 > a[1]:
		print((a[0] * 2) ** 2)
	else:
		print(a[1] ** 2)


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	one = max(max(a, b), 2 * min(a, b))
	two = max(a + b, max(a, b))
	three = max(max(a, b), 2 * min(a, b))
	four = 2 * max(a, b)
	print(min(one, two, three, four) ** 2)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	k = min(a, b)
	y = max(a, b)
	k = max(k * 2, y)
	print(k * k)


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	if a == b:
		print(4 * a ** 2)
	elif a > b:
		print(max(2 * b, a) ** 2)
	else:
		print(max(2 * a, b) ** 2)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	if a == b:
		print(4 * a * b)
		continue
	c = 2 * min(a, b)
	if c >= max(a, b):
		print(c ** 2)
	else:
		print(max(a, b) ** 2)


from sys import stdin

def readline():
	return stdin.readline()
tests = int(readline())

def solve(a, b):
	minl = 2 * min(a, b)
	maxl = max(a, b)
	if minl >= maxl:
		s = minl * minl
	else:
		s = maxl * maxl
	return s
for t in range(0, tests):
	[a, b] = list(map(int, readline().split(' ')))
	print(solve(a, b))


for t in range(int(input())):
	(a, b) = map(int, input().split())
	area = float('inf')
	if 2 * a >= b:
		area = (2 * a) ** 2
	else:
		area = min(area, b ** 2)
	if 2 * b >= a:
		area = min(area, (2 * b) ** 2)
	else:
		area = min(area, a ** 2)
	print(area)


for i in range(int(input())):
	numero = input().split()
	n1 = int(numero[0])
	n2 = int(numero[1])
	if n1 < n2:
		n1 += n1
		if n1 > n2:
			j = n1 * n1
		else:
			j = n2 * n2
	else:
		n2 += n2
		if n2 > n1:
			j = n2 * n2
		else:
			j = n1 * n1
	print(j)


def solve():
	(a, b) = [int(x) for x in input().split()]
	square_len = max(max(a, b), 2 * min(a, b)) ** 2
	return square_len
t = int(input())
while t:
	print(solve())
	t -= 1


T = int(input())
for i in range(1, T + 1):
	L = [int(x) for x in input().split()]
	mi = min(L)
	ma = max(L)
	print(max(2 * mi, ma) ** 2)