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

class B:
    def __init__(self, txt: str):
        self.o: H = None
        self.p: C = None
        self.z: C = None
        self.r: D = None
        self.q: G = None
        self.u: A = None
        self.txt = txt

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

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

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

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

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

class H:
    def __init__(self, txt: str):
        self.v: F = None
        self.q: C = None
        self.t: B = None
        self.o: C = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.o: H = None
        self.p: C = None
        self.z: C = None
        self.r: D = None
        self.q: G = None
        self.u: A = None
        self.txt = txt

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

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

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

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

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

class H:
    def __init__(self, txt: str):
        self.v: F = None
        self.q: C = None
        self.t: B = None
        self.o: C = None
        self.txt = txt

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

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