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

class B:
    def __init__(self, txt: str):
        self.p: E = None
        self.txt = txt

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

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

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

c = A("c")
f = B("f")
e = C("e")
d = D("d")
h = E("h")
m = C("m")

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

class B:
    def __init__(self, txt: str):
        self.p: E = None
        self.txt = txt

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

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

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

c = A("c")
f = B("f")
e = C("e")
d = D("d")
h = E("h")
m = C("m")

c.t = d
c.o = d
f.p = h
e.x = f
e.z = c
e.s = h
e.q = h
d.y = c
d.x = m
d.q = f
d.s = f
d.r = h
h.p = c
h.o = m
h.u = f
m.x = f
m.z = c
m.s = h
m.q = h
assert m.x.p.o.s.u.p.txt == "h"