class A:
    def __init__(self, txt: str):
        self.p: F = None
        self.w: B = None
        self.r: D = None
        self.y: D = None
        self.s: A = None
        self.z: B = None
        self.q: C = None
        self.txt = txt

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.v: G = None
        self.z: G = None
        self.p: D = None
        self.s: E = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.p: B = None
        self.r: H = None
        self.t: B = None
        self.txt = txt

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

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

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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.v: G = None
        self.z: G = None
        self.p: D = None
        self.s: E = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.p: B = None
        self.r: H = None
        self.t: B = None
        self.txt = txt

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

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

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