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

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

class C:
    def __init__(self, txt: str):
        self.q: D = None
        self.y: D = None
        self.o: A = None
        self.u: D = None
        self.v: F = None
        self.p: D = None
        self.s: F = None
        self.r: G = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.z: H = None
        self.v: G = None
        self.x: H = None
        self.q: G = None
        self.w: D = None
        self.t: G = None
        self.r: F = None
        self.o: D = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.s: G = None
        self.q: G = None
        self.o: H = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.p: E = None
        self.w: C = None
        self.t: E = None
        self.r: B = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.x: B = None
        self.u: E = None
        self.o: F = None
        self.z: G = None
        self.txt = txt

c = A("c")
k = B("k")
g = C("g")
n = D("n")
a = E("a")
m = F("m")
d = G("d")
j = H("j")
h = C("h")

c.z = a
c.p = a
c.u = j
c.o = k
k.p = a
k.u = c
k.x = h
g.q = n
g.y = n
g.u = n
g.p = n
g.o = c
g.v = m
g.s = m
g.r = d
n.y = d
n.p = c
n.v = h
n.x = m
a.z = j
a.x = j
a.v = d
a.q = d
a.t = d
a.w = n
a.o = n
a.r = m
m.s = d
m.q = d
m.o = j
d.p = a
d.t = a
d.w = h
d.r = k
j.x = k
j.u = a
j.o = m
j.z = d
h.q = n
h.y = n
h.u = n
h.p = n
h.o = c
h.v = m
h.s = m
h.r = d
assert k.p.r.q.r.x.txt == "
class A:
    def __init__(self, txt: str):
        self.z: E = None
        self.u: H = None
        self.o: B = None
        self.p: E = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.q: D = None
        self.y: D = None
        self.o: A = None
        self.u: D = None
        self.v: F = None
        self.p: D = None
        self.s: F = None
        self.r: G = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.z: H = None
        self.v: G = None
        self.x: H = None
        self.q: G = None
        self.w: D = None
        self.t: G = None
        self.r: F = None
        self.o: D = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.s: G = None
        self.q: G = None
        self.o: H = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.p: E = None
        self.w: C = None
        self.t: E = None
        self.r: B = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.x: B = None
        self.u: E = None
        self.o: F = None
        self.z: G = None
        self.txt = txt

c = A("c")
k = B("k")
g = C("g")
n = D("n")
a = E("a")
m = F("m")
d = G("d")
j = H("j")
h = C("h")

c.z = a
c.p = a
c.u = j
c.o = k
k.p = a
k.u = c
k.x = h
g.q = n
g.y = n
g.u = n
g.p = n
g.o = c
g.v = m
g.s = m
g.r = d
n.y = d
n.p = c
n.v = h
n.x = m
a.z = j
a.x = j
a.v = d
a.q = d
a.t = d
a.w = n
a.o = n
a.r = m
m.s = d
m.q = d
m.o = j
d.p = a
d.t = a
d.w = h
d.r = k
j.x = k
j.u = a
j.o = m
j.z = d
h.q = n
h.y = n
h.u = n
h.p = n
h.o = c
h.v = m
h.s = m
h.r = d
assert k.p.r.q.r.x.txt == "h"