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

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

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

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

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

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

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

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

c.z = l
c.p = l
c.o = i
b.s = n
n.r = e
n.q = b
n.p = c
h.r = e
h.q = b
h.p = c
e.r = h
e.q = l
e.p = c
i.r = d
i.q = l
i.p = c
l.s = e
m.s = e
d.r = n
d.q = b
d.p = c
assert b.s.r.q.s.p.p.txt == "l"