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

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

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

e = A("e")
g = B("g")
l = C("l")
c = A("c")
i = B("i")
k = A("k")
j = A("j")
m = C("m")

e.r = c
g.z = c
g.u = c
g.o = l
l.o = m
l.u = m
c.r = k
i.z = e
i.u = c
i.o = m
k.r = c
j.r = c
m.o = l
m.u = l
assert c.r.r.r.r.r.txt == "
class A:
    def __init__(self, txt: str):
        self.r: A = None
        self.txt = txt

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

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

e = A("e")
g = B("g")
l = C("l")
c = A("c")
i = B("i")
k = A("k")
j = A("j")
m = C("m")

e.r = c
g.z = c
g.u = c
g.o = l
l.o = m
l.u = m
c.r = k
i.z = e
i.u = c
i.o = m
k.r = c
j.r = c
m.o = l
m.u = l
assert c.r.r.r.r.r.txt == "k"