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

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

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

m = A("m")
a = B("a")
f = C("f")
l = B("l")
e = B("e")
b = A("b")

m.u = e
a.s = b
a.v = m
f.v = l
l.s = m
l.v = m
e.s = b
e.v = b
b.u = a
assert l.s.u.s.u.s.u.txt == "
class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.txt = txt

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

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

m = A("m")
a = B("a")
f = C("f")
l = B("l")
e = B("e")
b = A("b")

m.u = e
a.s = b
a.v = m
f.v = l
l.s = m
l.v = m
e.s = b
e.v = b
b.u = a
assert l.s.u.s.u.s.u.txt == "a"