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

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

class C:
    def __init__(self, txt: str):
        self.u: E = None
        self.s: B = None
        self.txt = txt

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

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

e = A("e")
a = B("a")
k = C("k")
f = D("f")
m = E("m")
h = B("h")

e.t = h
e.w = m
a.s = m
k.u = m
k.s = h
f.u = e
m.t = a
m.r = f
m.o = h
m.u = k
h.s = m
assert f.u.w.t.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.w: E = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.u: E = None
        self.s: B = None
        self.txt = txt

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

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

e = A("e")
a = B("a")
k = C("k")
f = D("f")
m = E("m")
h = B("h")

e.t = h
e.w = m
a.s = m
k.u = m
k.s = h
f.u = e
m.t = a
m.r = f
m.o = h
m.u = k
h.s = m
assert f.u.w.t.txt == "a"