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

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

i = A("i")
m = B("m")
n = B("n")

i.w = n
i.z = m
m.o = i
m.t = i
n.o = i
n.t = i
assert m.o.w.t.txt == "
class A:
    def __init__(self, txt: str):
        self.w: B = None
        self.z: B = None
        self.txt = txt

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

i = A("i")
m = B("m")
n = B("n")

i.w = n
i.z = m
m.o = i
m.t = i
n.o = i
n.t = i
assert m.o.w.t.txt == "i"