#!/usr/bin/env python

#
# The generator programs can be used to plot the results
# of a run, and spit out the results as a geomview file.
# The results are spit out in state order, but geomview
# expects a regular grid.  This little script sorts the
# output into a grid.
#

import sys

#f = file( "geomview" )
f = sys.stdin

lines = []
for line in f:
    elements = line.split()
    if len(elements) < 7:
        print line,
        continue
    elements = [float(x) for x in elements]
    lines.append( elements )

lines.sort()

for line in lines:
    print " ".join([str(x) for x in line])

f.close()
