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

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

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

a = A("a")
g = B("g")
e = C("e")
k = C("k")
h = A("h")
i = A("i")
c = B("c")
j = C("j")
d = C("d")

a.y = g
g.w = c
g.z = k
e.u = j
e.o = c
k.u = e
k.o = g
h.y = c
i.y = c
c.w = g
c.z = e
j.u = e
j.o = g
d.u = j
d.o = c
assert c.w.w.z.u.txt == "
class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.txt = txt

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

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

a = A("a")
g = B("g")
e = C("e")
k = C("k")
h = A("h")
i = A("i")
c = B("c")
j = C("j")
d = C("d")

a.y = g
g.w = c
g.z = k
e.u = j
e.o = c
k.u = e
k.o = g
h.y = c
i.y = c
c.w = g
c.z = e
j.u = e
j.o = g
d.u = j
d.o = c
assert c.w.w.z.u.txt == "j"