Sir this python code is also not working please help

t=int(input())
while(t):

n = int(input())
ans = n
ans = ans**0.5
a = 0
b = ans
while(a<=b):
    
    if (a*a)+(b*b)==n :
        
        print("(",int(a),",",int(b),")",end=" ")
        a = a+1
        b = b+1
    elif ((a*a)+(b*b)) > n:
        b = b-1
    else:
        a = a+1
t=t-1
print()

just change the print statement by -

print('({},{})'.format(int(a),int(b)),end=" ")

The answer which you are getting is correct only the way it is required to display is different .