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

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

d = A("d")
a = B("a")
l = A("l")
i = B("i")

d.w = a
d.t = i
a.v = i
a.o = l
l.w = i
l.t = i
i.v = a
i.o = l
assert d.t.o.w.txt == "
class A:
    def __init__(self, txt: str):
        self.w: B = None
        self.t: B = None
        self.txt = txt

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

d = A("d")
a = B("a")
l = A("l")
i = B("i")

d.w = a
d.t = i
a.v = i
a.o = l
l.w = i
l.t = i
i.v = a
i.o = l
assert d.t.o.w.txt == "i"