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

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

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

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

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

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

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

class H:
    def __init__(self, txt: str):
        self.v: D = None
        self.o: F = None
        self.txt = txt

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

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

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

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

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

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

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

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

class H:
    def __init__(self, txt: str):
        self.v: D = None
        self.o: F = None
        self.txt = txt

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

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