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

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

class C:
    def __init__(self, txt: str):
        self.r: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.v: H = None
        self.x: C = None
        self.w: G = None
        self.s: B = None
        self.y: C = None
        self.o: A = None
        self.r: B = None
        self.z: E = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.z: H = None
        self.w: A = None
        self.t: F = None
        self.x: A = None
        self.txt = txt

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.r: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.v: H = None
        self.x: C = None
        self.w: G = None
        self.s: B = None
        self.y: C = None
        self.o: A = None
        self.r: B = None
        self.z: E = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.z: H = None
        self.w: A = None
        self.t: F = None
        self.x: A = None
        self.txt = txt

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

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

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