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

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

l = A("l")
m = B("m")
k = B("k")
a = B("a")
d = B("d")
i = B("i")
f = A("f")

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

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

l = A("l")
m = B("m")
k = B("k")
a = B("a")
d = B("d")
i = B("i")
f = A("f")

l.w = i
m.v = l
k.v = f
a.v = l
d.v = l
i.v = l
f.w = i
assert k.v.w.v.w.v.txt == "l"