def children(triple):
    """Given a pythagorean triple, return its three children triples."""
    # See Berggren's ternary tree, which will produce all infinitely many
    # primitive triples without duplication.
    a, b, c = triple
    a1, b1, c1 = (-a + 2*b + 2*c), (-2*a + b + 2*c), (-2*a + 2*b + 3*c)
    a2, b2, c2 = (+a + 2*b + 2*c), (+2*a + b + 2*c), (+2*a + 2*b + 3*c)
    a3, b3, c3 = (+a - 2*b + 2*c), (+2*a - b + 2*c), (+2*a - 2*b + 3*c)
    return (a1, b1, c1), (a2, b2, c2), (a3, b3, c3)