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

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

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

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

g.u = e
g.q = e
m.w = l
m.t = f
m.p = g
i.r = c
j.r = i
e.u = g
e.q = g
k.r = c
f.w = l
f.t = m
f.p = e
l.w = m
l.t = m
l.p = e
c.r = k
h.r = k
assert c.r.r.r.r.r.r.r.r.r.txt == "
class A:
    def __init__(self, txt: str):
        self.u: A = None
        self.q: A = None
        self.txt = txt

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

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

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

g.u = e
g.q = e
m.w = l
m.t = f
m.p = g
i.r = c
j.r = i
e.u = g
e.q = g
k.r = c
f.w = l
f.t = m
f.p = e
l.w = m
l.t = m
l.p = e
c.r = k
h.r = k
assert c.r.r.r.r.r.r.r.r.r.txt == "k"