# test whether list of integer vectors in standard input is isometric

import sys

vex = [tuple([int(s) for s in line.split()])
       for line in sys.stdin if line.strip()]

def ham(v,w):
    return sum([abs(v[i]-w[i]) for i in range(max(len(v),len(w)))])

nbr = dict([(v,[w for w in vex if ham(v,w)==1]) for v in vex])

for v in vex:
    for w in vex:
        if v != w:
            closer = [u for u in nbr[v] if ham(u,w) < ham(v,w)]
            if not closer:
                print "No path from",v,"to",w,"!"
                raise

print "The input is isometric."

if not [v for v in vex if len(nbr[v])!=3]:
    print "The input is cubic."
