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

class B:
    def __init__(self, txt: str):
        self.s: H = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.r: B = None
        self.q: A = None
        self.z: A = None
        self.v: C = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.r: D = None
        self.y: E = None
        self.v: C = None
        self.p: H = None
        self.q: D = None
        self.s: B = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.x: F = None
        self.o: C = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.x: F = None
        self.q: A = None
        self.txt = txt

h = A("h")
e = B("e")
n = C("n")
i = D("i")
m = E("m")
f = F("f")
l = G("l")
k = H("k")
g = F("g")

h.t = k
h.x = k
h.r = k
h.p = l
e.s = k
n.t = m
n.u = m
n.w = h
n.z = f
n.p = f
n.x = g
n.y = e
i.r = e
i.q = h
i.z = h
i.v = n
m.s = n
m.z = g
f.r = i
f.q = i
f.y = m
f.v = n
f.p = k
f.s = e
l.x = f
l.o = n
k.x = g
k.q = h
g.r = i
g.q = i
g.y = m
g.v = n
g.p = k
g.s = e
assert h.p.o.x.txt == "
class A:
    def __init__(self, txt: str):
        self.t: H = None
        self.x: H = None
        self.p: G = None
        self.r: H = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.s: H = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.r: B = None
        self.q: A = None
        self.z: A = None
        self.v: C = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.r: D = None
        self.y: E = None
        self.v: C = None
        self.p: H = None
        self.q: D = None
        self.s: B = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.x: F = None
        self.o: C = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.x: F = None
        self.q: A = None
        self.txt = txt

h = A("h")
e = B("e")
n = C("n")
i = D("i")
m = E("m")
f = F("f")
l = G("l")
k = H("k")
g = F("g")

h.t = k
h.x = k
h.r = k
h.p = l
e.s = k
n.t = m
n.u = m
n.w = h
n.z = f
n.p = f
n.x = g
n.y = e
i.r = e
i.q = h
i.z = h
i.v = n
m.s = n
m.z = g
f.r = i
f.q = i
f.y = m
f.v = n
f.p = k
f.s = e
l.x = f
l.o = n
k.x = g
k.q = h
g.r = i
g.q = i
g.y = m
g.v = n
g.p = k
g.s = e
assert h.p.o.x.txt == "g"