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

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

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

f = A("f")
l = B("l")
k = C("k")
i = B("i")
c = B("c")
n = B("n")
b = C("b")
e = C("e")
a = C("a")

f.q = l
f.v = a
l.y = k
l.s = n
k.r = b
i.y = e
i.s = l
c.y = k
c.s = i
n.y = k
n.s = i
b.r = k
e.r = b
a.r = k
assert k.r.r.r.r.r.txt == "
class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.v: C = None
        self.txt = txt

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

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

f = A("f")
l = B("l")
k = C("k")
i = B("i")
c = B("c")
n = B("n")
b = C("b")
e = C("e")
a = C("a")

f.q = l
f.v = a
l.y = k
l.s = n
k.r = b
i.y = e
i.s = l
c.y = k
c.s = i
n.y = k
n.s = i
b.r = k
e.r = b
a.r = k
assert k.r.r.r.r.r.txt == "b"