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

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

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

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

b.o = a
b.w = l
m.v = a
m.r = k
m.q = d
d.u = e
d.z = e
d.s = l
a.o = b
a.w = m
e.v = a
e.r = d
e.q = d
l.v = a
l.r = k
l.q = d
k.u = e
k.z = l
k.s = m
assert m.r.s.r.s.txt == "
class A:
    def __init__(self, txt: str):
        self.o: A = None
        self.w: B = None
        self.txt = txt

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

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

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

b.o = a
b.w = l
m.v = a
m.r = k
m.q = d
d.u = e
d.z = e
d.s = l
a.o = b
a.w = m
e.v = a
e.r = d
e.q = d
l.v = a
l.r = k
l.q = d
k.u = e
k.z = l
k.s = m
assert m.r.s.r.s.txt == "m"