Not accepting even correct solution

hello sir, i was trying these questions from two days, tried every method as it will count in assignment submission and in the end certificate generation. but it always shows wrong or testcases fail. finally after whole day of hard work i look for solution and found out that my answer is giving all the test cases output in correct format . pls look for the problem
my solution :
T=input(“enter number of test cases : “)
l=list()
try:
T = int(T)
if T>0:
for x in range(T):
A=int(input(“enter number”))
if A<=1000:
l.append(A)
for x in l:
for a in range(x+1):
for b in range(x+1):
if (a2)+(b2)==x and a<=b:
print(”(”,a,",",b,")",end=" ")
print()
except ValueError:
print(“Input is not an integer.”)