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

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

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

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

m.t = n
f.r = k
k.q = e
k.o = j
a.r = e
e.q = k
e.o = j
l.r = k
j.t = l
i.r = e
n.r = k
assert e.q.o.t.r.q.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.txt = txt

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

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

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

m.t = n
f.r = k
k.q = e
k.o = j
a.r = e
e.q = k
e.o = j
l.r = k
j.t = l
i.r = e
n.r = k
assert e.q.o.t.r.q.txt == "e"