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

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

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

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

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

a = A("a")
e = B("e")
m = C("m")
k = D("k")
h = E("h")
b = B("b")
g = D("g")
i = E("i")

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

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

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

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

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

a = A("a")
e = B("e")
m = C("m")
k = D("k")
h = E("h")
b = B("b")
g = D("g")
i = E("i")

a.t = h
a.z = k
a.s = k
a.w = m
e.w = b
m.p = h
m.u = g
m.z = a
k.w = a
k.s = a
h.t = m
h.v = a
h.o = b
b.w = e
g.w = a
g.s = a
i.t = m
i.v = a
i.o = b
assert k.s.s.w.txt == "a"