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

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

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

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

class E:
    def __init__(self, txt: str):
        self.o: H = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.u: C = None
        self.s: A = None
        self.v: C = None
        self.w: B = None
        self.q: B = None
        self.txt = txt

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

class H:
    def __init__(self, txt: str):
        self.w: D = None
        self.s: G = None
        self.t: D = None
        self.txt = txt

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

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.o: H = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.u: C = None
        self.s: A = None
        self.v: C = None
        self.w: B = None
        self.q: B = None
        self.txt = txt

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

class H:
    def __init__(self, txt: str):
        self.w: D = None
        self.s: G = None
        self.t: D = None
        self.txt = txt

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

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