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

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

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

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

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

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

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

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

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