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

class B:
    def __init__(self, txt: str):
        self.y: F = None
        self.p: D = None
        self.u: H = None
        self.txt = txt

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.s: A = None
        self.z: A = None
        self.x: A = None
        self.v: F = None
        self.p: C = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.z: E = None
        self.txt = txt

e = A("e")
d = B("d")
g = C("g")
h = D("h")
b = E("b")
l = F("l")
i = G("i")
k = H("k")

e.q = g
d.y = l
d.p = h
d.u = k
g.y = l
g.p = b
h.r = e
h.u = k
b.s = h
l.q = h
i.s = e
i.z = e
i.x = e
i.v = l
i.p = g
k.z = b
assert k.z.s.u.z.s.txt == "
class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.y: F = None
        self.p: D = None
        self.u: H = None
        self.txt = txt

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.s: A = None
        self.z: A = None
        self.x: A = None
        self.v: F = None
        self.p: C = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.z: E = None
        self.txt = txt

e = A("e")
d = B("d")
g = C("g")
h = D("h")
b = E("b")
l = F("l")
i = G("i")
k = H("k")

e.q = g
d.y = l
d.p = h
d.u = k
g.y = l
g.p = b
h.r = e
h.u = k
b.s = h
l.q = h
i.s = e
i.z = e
i.x = e
i.v = l
i.p = g
k.z = b
assert k.z.s.u.z.s.txt == "h"