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

class B:
    def __init__(self, txt: str):
        self.p: C = None
        self.z: H = None
        self.y: D = None
        self.x: D = None
        self.u: E = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.t: D = None
        self.x: C = None
        self.p: C = None
        self.y: B = None
        self.w: C = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.p: H = None
        self.o: A = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.t: E = None
        self.u: E = None
        self.q: D = None
        self.z: F = None
        self.x: D = None
        self.s: G = None
        self.txt = txt

e = A("e")
j = B("j")
h = C("h")
g = D("g")
a = E("a")
n = F("n")
c = G("c")
i = H("i")

e.u = j
e.y = h
j.p = h
j.z = i
j.y = g
j.x = g
j.u = a
h.q = e
h.w = j
g.z = n
a.t = g
a.x = h
a.p = h
a.w = h
a.y = j
n.r = j
c.p = i
c.o = e
i.t = a
i.u = a
i.q = g
i.x = g
i.z = n
i.s = c
assert g.z.r.z.s.p.q.txt == "
class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.y: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.p: C = None
        self.z: H = None
        self.y: D = None
        self.x: D = None
        self.u: E = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.t: D = None
        self.x: C = None
        self.p: C = None
        self.y: B = None
        self.w: C = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.p: H = None
        self.o: A = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.t: E = None
        self.u: E = None
        self.q: D = None
        self.z: F = None
        self.x: D = None
        self.s: G = None
        self.txt = txt

e = A("e")
j = B("j")
h = C("h")
g = D("g")
a = E("a")
n = F("n")
c = G("c")
i = H("i")

e.u = j
e.y = h
j.p = h
j.z = i
j.y = g
j.x = g
j.u = a
h.q = e
h.w = j
g.z = n
a.t = g
a.x = h
a.p = h
a.w = h
a.y = j
n.r = j
c.p = i
c.o = e
i.t = a
i.u = a
i.q = g
i.x = g
i.z = n
i.s = c
assert g.z.r.z.s.p.q.txt == "g"