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

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

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

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

class E:
    def __init__(self, txt: str):
        self.u: A = None
        self.v: D = None
        self.w: A = None
        self.z: C = None
        self.txt = txt

d = A("d")
h = B("h")
n = C("n")
j = D("j")
i = E("i")

d.y = h
d.o = h
d.t = n
d.p = j
d.z = i
h.s = j
h.t = d
h.w = i
n.q = j
n.p = d
n.x = d
j.w = h
j.q = d
j.s = d
j.u = d
j.t = i
i.u = d
i.w = d
i.v = j
i.z = n
assert n.x.z.w.p.s.txt == "
class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.t: C = None
        self.p: D = None
        self.o: B = None
        self.z: E = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.u: A = None
        self.v: D = None
        self.w: A = None
        self.z: C = None
        self.txt = txt

d = A("d")
h = B("h")
n = C("n")
j = D("j")
i = E("i")

d.y = h
d.o = h
d.t = n
d.p = j
d.z = i
h.s = j
h.t = d
h.w = i
n.q = j
n.p = d
n.x = d
j.w = h
j.q = d
j.s = d
j.u = d
j.t = i
i.u = d
i.w = d
i.v = j
i.z = n
assert n.x.z.w.p.s.txt == "d"