import itertools wires=["red", "green", "blue"] for i in itertools.permutations(wires): print i