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

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

e = A("e")
b = B("b")
i = B("i")

e.w = i
b.z = i
b.v = i
i.z = b
i.v = b
assert b.z.v.z.txt == "
class A:
    def __init__(self, txt: str):
        self.w: B = None
        self.txt = txt

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

e = A("e")
b = B("b")
i = B("i")

e.w = i
b.z = i
b.v = i
i.z = b
i.v = b
assert b.z.v.z.txt == "i"