class A:
    def __init__(self, txt: str):
        self.q: G = None
        self.y: H = None
        self.r: D = None
        self.x: F = None
        self.s: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.t: F = None
        self.z: F = None
        self.o: B = None
        self.u: A = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.v: H = None
        self.u: A = None
        self.t: B = None
        self.z: E = None
        self.txt = txt

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

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

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

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

d.q = g
d.y = e
d.r = c
d.x = h
d.s = i
j.p = a
i.t = h
i.z = h
i.o = j
i.u = d
c.x = j
f.v = e
f.u = d
f.t = j
f.z = m
h.x = d
h.p = d
h.s = i
h.o = g
h.t = c
a.y = g
e.u = h
g.y = a
m.v = e
m.u = d
m.t = j
m.z = f
assert m.u.y.u.txt == "
class A:
    def __init__(self, txt: str):
        self.q: G = None
        self.y: H = None
        self.r: D = None
        self.x: F = None
        self.s: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.t: F = None
        self.z: F = None
        self.o: B = None
        self.u: A = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.v: H = None
        self.u: A = None
        self.t: B = None
        self.z: E = None
        self.txt = txt

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

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

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

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

d.q = g
d.y = e
d.r = c
d.x = h
d.s = i
j.p = a
i.t = h
i.z = h
i.o = j
i.u = d
c.x = j
f.v = e
f.u = d
f.t = j
f.z = m
h.x = d
h.p = d
h.s = i
h.o = g
h.t = c
a.y = g
e.u = h
g.y = a
m.v = e
m.u = d
m.t = j
m.z = f
assert m.u.y.u.txt == "h"