class A:
    def __init__(self, txt: str):
        self.w: E = None
        self.t: B = None
        self.x: 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: A = None
        self.txt = txt

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

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

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

a.w = f
a.t = k
a.x = i
e.w = k
n.p = a
i.t = a
c.r = a
c.o = a
c.s = i
m.t = a
k.w = e
f.r = a
f.o = a
f.s = i
assert k.w.w.w.txt == "
class A:
    def __init__(self, txt: str):
        self.w: E = None
        self.t: B = None
        self.x: 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: A = None
        self.txt = txt

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

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

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

a.w = f
a.t = k
a.x = i
e.w = k
n.p = a
i.t = a
c.r = a
c.o = a
c.s = i
m.t = a
k.w = e
f.r = a
f.o = a
f.s = i
assert k.w.w.w.txt == "e"