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

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

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

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

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

l.r = g
b.q = n
b.t = g
b.s = k
i.q = g
f.u = a
n.q = b
n.t = k
n.s = g
k.r = g
e.q = l
a.u = f
g.r = l
assert n.t.r.r.r.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.q: B = None
        self.t: A = None
        self.s: A = None
        self.txt = txt

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

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

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

l.r = g
b.q = n
b.t = g
b.s = k
i.q = g
f.u = a
n.q = b
n.t = k
n.s = g
k.r = g
e.q = l
a.u = f
g.r = l
assert n.t.r.r.r.r.r.r.r.r.txt == "l"