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

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

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

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

j.v = k
j.w = k
j.z = i
i.o = l
l.w = i
l.z = i
l.y = i
k.v = j
k.w = j
k.z = i
assert j.v.z.o.w.txt == "
class A:
    def __init__(self, txt: str):
        self.v: A = None
        self.w: A = None
        self.z: B = None
        self.txt = txt

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

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

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

j.v = k
j.w = k
j.z = i
i.o = l
l.w = i
l.z = i
l.y = i
k.v = j
k.w = j
k.z = i
assert j.v.z.o.w.txt == "i"