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

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

m = A("m")
f = B("f")
k = B("k")
l = B("l")
b = B("b")
j = A("j")
d = A("d")

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

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

m = A("m")
f = B("f")
k = B("k")
l = B("l")
b = B("b")
j = A("j")
d = A("d")

m.w = j
m.v = f
f.v = l
f.u = d
k.v = f
k.u = m
l.v = k
l.u = m
b.v = l
b.u = m
j.w = d
j.v = k
d.w = m
d.v = b
assert j.w.v.u.v.txt == "f"