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

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

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

i = A("i")
d = B("d")
h = C("h")
l = B("l")

i.s = h
i.z = h
d.v = h
h.v = i
l.v = h
assert h.v.z.v.s.txt == "
class A:
    def __init__(self, txt: str):
        self.s: C = None
        self.z: C = None
        self.txt = txt

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

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

i = A("i")
d = B("d")
h = C("h")
l = B("l")

i.s = h
i.z = h
d.v = h
h.v = i
l.v = h
assert h.v.z.v.s.txt == "h"