# Finding a sum of two squares that is itself the sum of two squares

I am trying to write something that has a variable d that is the sum of two squares where one of the summands is also the sum of two squares. I tried something like

```
for d in srange(1,100):
for e in srange(1,100):
for f in srange(1,100):
for g in srange(1,100):
for h in srange(1,100):
if d==e^2+f^2 and e==g^2+h^2
print(d,e,f,g,h)
```

But it takes wayyyyyy to long to compute, is there a way to use 'from sage.rings.sum_of_squares import two_squares_pyx' to not brute force this?

If you're looking for

`d = e^2 + f^2`

, do you want`e`

to be a sum of two squares or do you want`e^2`

to be a sum of two squares? Your question asks for the latter (since`e^2`

is one of the summands) but your code looks for the former.