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

class B:
    def __init__(self, txt: str):
        self.z: F = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.y: B = None
        self.o: H = None
        self.p: F = None
        self.z: C = None
        self.w: H = None
        self.x: H = None
        self.r: G = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.q: G = None
        self.txt = txt

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

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

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

j = A("j")
m = B("m")
l = C("l")
d = D("d")
f = E("f")
c = F("c")
e = G("e")
g = H("g")
h = G("h")
b = G("b")

j.t = c
j.p = f
m.z = c
l.w = j
l.y = m
d.y = m
d.o = g
d.w = g
d.x = g
d.p = c
d.z = l
d.r = e
f.q = h
c.x = d
c.w = d
c.u = d
e.r = b
g.v = l
h.r = e
b.r = e
assert f.q.r.r.r.r.r.r.r.r.r.txt == "
class A:
    def __init__(self, txt: str):
        self.t: F = None
        self.p: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.z: F = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.y: B = None
        self.o: H = None
        self.p: F = None
        self.z: C = None
        self.w: H = None
        self.x: H = None
        self.r: G = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.q: G = None
        self.txt = txt

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

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

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

j = A("j")
m = B("m")
l = C("l")
d = D("d")
f = E("f")
c = F("c")
e = G("e")
g = H("g")
h = G("h")
b = G("b")

j.t = c
j.p = f
m.z = c
l.w = j
l.y = m
d.y = m
d.o = g
d.w = g
d.x = g
d.p = c
d.z = l
d.r = e
f.q = h
c.x = d
c.w = d
c.u = d
e.r = b
g.v = l
h.r = e
b.r = e
assert f.q.r.r.r.r.r.r.r.r.r.txt == "e"