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

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

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

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

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

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

n.v = e
e.w = k
k.w = e
assert k.w.w.w.txt == "e"