LearnPy Hub
← Tuples & Sets problems
Hard

Triples That Sum to Zero

Read up to 60 integers. Find every different set of three numbers at different positions that adds up to 0. Store each as a sorted tuple in a set to drop repeats, then print them in sorted order, one per line, or none.

Input

Integers separated by spaces.

Output

Lines.

Sample 1

Input
-1 0 1 2 -1 -4
Output
-1 -1 2
-1 0 1

Sample 2

Input
1 2 3
Output
none
solution.py
Output appears here
Triples That Sum to Zero · Python practice problem · LearnPy Hub