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

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

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

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

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

k = A("k")
i = B("i")
n = C("n")
c = D("c")
a = E("a")
m = E("m")

k.s = n
i.t = m
i.r = m
n.z = c
n.x = k
n.w = k
n.t = a
c.w = k
c.x = a
a.v = c
a.p = n
a.y = n
a.o = k
m.v = c
m.p = n
m.y = n
m.o = k
assert m.o.s.w.s.txt == "
class A:
    def __init__(self, txt: str):
        self.s: C = None
        self.txt = txt

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

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

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

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

k = A("k")
i = B("i")
n = C("n")
c = D("c")
a = E("a")
m = E("m")

k.s = n
i.t = m
i.r = m
n.z = c
n.x = k
n.w = k
n.t = a
c.w = k
c.x = a
a.v = c
a.p = n
a.y = n
a.o = k
m.v = c
m.p = n
m.y = n
m.o = k
assert m.o.s.w.s.txt == "n"