Code not passing test cases

import math
def pythagoras(A):
num = int(math.sqrt(A))
if A<=1000 and A>0:
for a in range(0,num+1):
for b in range(0,num+1):
if b>=a:
if ((a2)+(b2)==A):
print(f"({a},{b})",end =" “)
elif A==0:
print(”(0,0)")

T = int(input())
for x in range(0,T):
A = int(input("\n"))
if A>=0:
pythagoras(A)