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

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

d = A("d")
k = B("k")
l = B("l")

d.z = l
k.w = l
k.t = l
l.w = k
l.t = k
assert k.w.w.t.txt == "
class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.txt = txt

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

d = A("d")
k = B("k")
l = B("l")

d.z = l
k.w = l
k.t = l
l.w = k
l.t = k
assert k.w.w.t.txt == "l"