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

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

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

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

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

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

k.w = e
l.t = e
e.t = l
assert l.t.t.t.txt == "e"