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

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

class C:
    def __init__(self, txt: str):
        self.q: B = None
        self.o: B = None
        self.w: C = None
        self.txt = txt

m = A("m")
e = B("e")
j = C("j")
f = C("f")
n = B("n")
c = C("c")
d = C("d")
b = B("b")

m.s = j
e.z = n
e.p = f
j.q = e
j.o = e
j.w = d
f.q = e
f.o = b
f.w = c
n.z = e
n.p = f
c.q = e
c.o = e
c.w = j
d.q = n
d.o = b
d.w = j
b.z = e
b.p = j
assert b.z.z.z.p.txt == "
class A:
    def __init__(self, txt: str):
        self.s: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.q: B = None
        self.o: B = None
        self.w: C = None
        self.txt = txt

m = A("m")
e = B("e")
j = C("j")
f = C("f")
n = B("n")
c = C("c")
d = C("d")
b = B("b")

m.s = j
e.z = n
e.p = f
j.q = e
j.o = e
j.w = d
f.q = e
f.o = b
f.w = c
n.z = e
n.p = f
c.q = e
c.o = e
c.w = j
d.q = n
d.o = b
d.w = j
b.z = e
b.p = j
assert b.z.z.z.p.txt == "f"