class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.y: E = None
        self.q: D = None
        self.txt = txt

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

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

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

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

a = A("a")
k = B("k")
i = C("i")
h = D("h")
g = E("g")
d = B("d")

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

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

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

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

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

a = A("a")
k = B("k")
i = C("i")
h = D("h")
g = E("g")
d = B("d")

a.z = d
a.y = g
a.q = h
k.s = g
k.v = g
k.u = g
k.q = h
k.z = a
i.y = h
i.p = h
i.x = h
i.q = g
i.s = k
h.w = a
h.o = a
h.x = g
g.s = h
g.v = h
d.s = g
d.v = g
d.u = g
d.q = h
d.z = a
assert h.x.v.w.y.s.w.txt == "a"