#!/usr/local/bin/python2 t = ((9,8,7),(4,5,6),(2,1,3)) for z in xrange(100000): l = [j for i in t for j in i] l.sort() print l