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

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

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

class D:
    def __init__(self, txt: str):
        self.o: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.t: C = None
        self.w: C = None
        self.o: C = None
        self.y: D = None
        self.txt = txt

a = A("a")
f = B("f")
h = C("h")
l = D("l")
b = E("b")
n = C("n")

a.w = b
f.w = n
h.s = l
h.o = b
l.o = h
b.t = n
b.w = n
b.o = h
b.y = l
n.s = l
n.o = b
assert a.w.t.s.txt == "
class A:
    def __init__(self, txt: str):
        self.w: E = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.o: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.t: C = None
        self.w: C = None
        self.o: C = None
        self.y: D = None
        self.txt = txt

a = A("a")
f = B("f")
h = C("h")
l = D("l")
b = E("b")
n = C("n")

a.w = b
f.w = n
h.s = l
h.o = b
l.o = h
b.t = n
b.w = n
b.o = h
b.y = l
n.s = l
n.o = b
assert a.w.t.s.txt == "l"