Whats the error

cannot get why it is showing wrong answer tried everything to solve this my code is :

import math
N = int(input())
c = N
a = []
for i in range(N):
Z = int(input())
A = int(math.sqrt(Z))
b = []
for m in range(A+1):
for q in range(A+1):
a = []
if m ** 2 + q ** 2 == Z:
a = [m,q]
a.sort()
if a not in b:
b.append(a)
b.pop(0)
for j in range(len(b)):
l = b[j]
a = l[0]
x = l[1]
print("(" + str(a) + “,” + str(x) + “)”, end=" ")

Hey @yashb4569, we have provided you with the solution itself, try hard if you are still unable to solve that take help from the solution. Since this is part of leaderboard challenge, its not ethical to share the solutions with the student directly.

Happy Learning :blush:

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.