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

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

class C:
    def __init__(self, txt: str):
        self.o: A = 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.y: A = None
        self.s: C = None
        self.txt = txt

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

a.r = h
a.w = n
m.p = h
m.t = h
m.u = a
m.o = n
m.w = n
h.o = a
l.o = h
n.y = a
n.s = h
assert l.o.o.w.s.o.txt == "
class A:
    def __init__(self, txt: str):
        self.r: C = None
        self.w: E = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.o: A = 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.y: A = None
        self.s: C = None
        self.txt = txt

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

a.r = h
a.w = n
m.p = h
m.t = h
m.u = a
m.o = n
m.w = n
h.o = a
l.o = h
n.y = a
n.s = h
assert l.o.o.w.s.o.txt == "a"