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

class B:
    def __init__(self, txt: str):
        self.z: D = None
        self.t: D = None
        self.p: C = None
        self.txt = txt

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

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

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

class F:
    def __init__(self, txt: str):
        self.u: C = None
        self.y: H = None
        self.txt = txt

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.z: D = None
        self.t: D = None
        self.p: C = None
        self.txt = txt

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

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

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

class F:
    def __init__(self, txt: str):
        self.u: C = None
        self.y: H = None
        self.txt = txt

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

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

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

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