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

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

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

e = A("e")
n = B("n")
a = C("a")
m = B("m")
d = A("d")
i = B("i")
j = A("j")
l = C("l")

e.v = m
e.s = m
n.o = m
a.r = j
m.o = i
d.v = n
d.s = i
i.o = m
j.v = i
j.s = i
l.r = d
assert a.r.v.o.o.o.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.s: B = None
        self.txt = txt

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

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

e = A("e")
n = B("n")
a = C("a")
m = B("m")
d = A("d")
i = B("i")
j = A("j")
l = C("l")

e.v = m
e.s = m
n.o = m
a.r = j
m.o = i
d.v = n
d.s = i
i.o = m
j.v = i
j.s = i
l.r = d
assert a.r.v.o.o.o.txt == "m"