class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.t: B = None
        self.u: A = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.y: B = None
        self.z: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.p: C = None
        self.txt = txt

d = A("d")
h = B("h")
n = C("n")
l = B("l")
j = C("j")
a = A("a")
c = B("c")
m = A("m")
i = B("i")

d.y = n
d.t = h
d.u = a
h.y = l
h.z = j
n.p = j
l.y = c
l.z = n
j.p = n
a.y = n
a.t = h
a.u = m
c.y = l
c.z = j
m.y = n
m.t = c
m.u = a
i.y = l
i.z = n
assert c.z.p.p.p.p.p.p.p.txt == "
class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.t: B = None
        self.u: A = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.y: B = None
        self.z: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.p: C = None
        self.txt = txt

d = A("d")
h = B("h")
n = C("n")
l = B("l")
j = C("j")
a = A("a")
c = B("c")
m = A("m")
i = B("i")

d.y = n
d.t = h
d.u = a
h.y = l
h.z = j
n.p = j
l.y = c
l.z = n
j.p = n
a.y = n
a.t = h
a.u = m
c.y = l
c.z = j
m.y = n
m.t = c
m.u = a
i.y = l
i.z = n
assert c.z.p.p.p.p.p.p.p.txt == "n"