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

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

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

j = A("j")
m = B("m")
k = C("k")
i = C("i")
e = A("e")
l = B("l")

j.u = i
m.y = j
m.z = e
k.w = e
k.s = i
k.v = i
i.w = j
i.s = k
i.v = k
e.u = i
l.y = e
l.z = j
assert l.z.u.w.txt == "
class A:
    def __init__(self, txt: str):
        self.u: C = None
        self.txt = txt

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

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

j = A("j")
m = B("m")
k = C("k")
i = C("i")
e = A("e")
l = B("l")

j.u = i
m.y = j
m.z = e
k.w = e
k.s = i
k.v = i
i.w = j
i.s = k
i.v = k
e.u = i
l.y = e
l.z = j
assert l.z.u.w.txt == "j"