class A:
    def __init__(self, txt: str):
        self.p: C = None
        self.z: D = None
        self.x: D = None
        self.o: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.w: D = None
        self.txt = txt

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

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

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

a = A("a")
b = B("b")
m = C("m")
i = D("i")
f = E("f")
d = C("d")
g = D("g")
h = C("h")

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

class B:
    def __init__(self, txt: str):
        self.w: D = None
        self.txt = txt

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

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

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

a = A("a")
b = B("b")
m = C("m")
i = D("i")
f = E("f")
d = C("d")
g = D("g")
h = C("h")

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