Pythagoras challange problem

import math

def isPerfectSquare(x):
sr = math.sqrt(x)
return ((sr - math.floor(sr)) == 0)

p=int(input())

for i in range (0,p):
k=int(input())
d=int(math.sqrt(k)/2)
if(k==1):
print(0,1)
elif(k==4):
print(0,2)
else:
for j in range(0,d+2):
l=int(k-j*j)
if(isPerfectSquare(l)==True):
print(j,int(math.sqrt(l)))

whats the problem in this code?

share code via gthub