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

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

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

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

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

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

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

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

f.q = e
f.r = e
f.v = m
e.u = m
l.w = f
l.s = m
l.v = m
m.w = f
m.s = l
m.v = l
assert m.s.w.r.u.txt == "m"