Pythagorean challenge

import math
n=int(input())
for i in range(n):
x=int(input())
b=int(math.sqrt(x))
a=0
while b>a:

  for a in range(b):
    if a*a+b*b==x:
        print("(%d,%d)"%(a,b),end=' ')
  a=0
  b-=1
print()

Hey @Shivam31, if you are unable to solve the problem, you have to unlock the editorial and than take help from that, since its a leaderboard challenge, it is not ethical to share the solution here.

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.