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

class B:
    def __init__(self, txt: str):
        self.s: B = None
        self.y: B = None
        self.q: B = None
        self.txt = txt

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

h = A("h")
k = B("k")
e = C("e")
b = C("b")
n = C("n")
m = C("m")
f = B("f")
c = A("c")
a = C("a")
j = B("j")

h.o = m
k.s = f
k.y = f
k.q = f
e.r = m
e.u = n
b.r = m
b.u = a
n.r = m
n.u = a
m.r = a
m.u = e
f.s = j
f.y = j
f.q = k
c.o = b
a.r = b
a.u = e
j.s = k
j.q = k
j.y = f
assert a.r.r.r.r.r.txt == "
class A:
    def __init__(self, txt: str):
        self.o: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.s: B = None
        self.y: B = None
        self.q: B = None
        self.txt = txt

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

h = A("h")
k = B("k")
e = C("e")
b = C("b")
n = C("n")
m = C("m")
f = B("f")
c = A("c")
a = C("a")
j = B("j")

h.o = m
k.s = f
k.y = f
k.q = f
e.r = m
e.u = n
b.r = m
b.u = a
n.r = m
n.u = a
m.r = a
m.u = e
f.s = j
f.y = j
f.q = k
c.o = b
a.r = b
a.u = e
j.s = k
j.q = k
j.y = f
assert a.r.r.r.r.r.txt == "m"