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