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

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

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

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

l.y = h
l.x = m
n.s = e
m.s = n
m.p = n
m.t = n
m.o = h
m.u = h
h.o = m
h.s = l
h.z = n
h.u = n
h.w = e
e.x = m
e.p = l
e.s = l
assert n.s.x.p.s.txt == "
class A:
    def __init__(self, txt: str):
        self.y: D = None
        self.x: C = 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.s: B = None
        self.o: D = None
        self.p: B = None
        self.u: D = None
        self.t: B = None
        self.txt = txt

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

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

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

l.y = h
l.x = m
n.s = e
m.s = n
m.p = n
m.t = n
m.o = h
m.u = h
h.o = m
h.s = l
h.z = n
h.u = n
h.w = e
e.x = m
e.p = l
e.s = l
assert n.s.x.p.s.txt == "e"