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

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

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

c = A("c")
n = B("n")
i = C("i")
l = A("l")
h = C("h")
m = B("m")
b = A("b")
g = A("g")
e = B("e")
d = C("d")

c.t = l
c.z = d
c.p = g
n.z = h
n.s = m
n.v = d
i.p = l
i.z = l
l.t = g
l.p = g
l.z = d
h.p = c
h.z = l
m.z = d
m.s = e
m.v = i
b.t = l
b.p = l
b.z = h
g.t = l
g.p = l
g.z = i
e.z = d
e.s = m
e.v = i
d.p = l
d.z = c
assert m.v.p.z.p.z.txt == "
class A:
    def __init__(self, txt: str):
        self.t: A = None
        self.z: C = None
        self.p: A = None
        self.txt = txt

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

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

c = A("c")
n = B("n")
i = C("i")
l = A("l")
h = C("h")
m = B("m")
b = A("b")
g = A("g")
e = B("e")
d = C("d")

c.t = l
c.z = d
c.p = g
n.z = h
n.s = m
n.v = d
i.p = l
i.z = l
l.t = g
l.p = g
l.z = d
h.p = c
h.z = l
m.z = d
m.s = e
m.v = i
b.t = l
b.p = l
b.z = h
g.t = l
g.p = l
g.z = i
e.z = d
e.s = m
e.v = i
d.p = l
d.z = c
assert m.v.p.z.p.z.txt == "d"