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

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

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

i = A("i")
b = B("b")
k = C("k")
h = C("h")

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

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

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

i = A("i")
b = B("b")
k = C("k")
h = C("h")

i.o = k
b.s = k
k.z = i
k.v = i
h.z = i
h.v = i
assert i.o.z.o.txt == "k"