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

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

class C:
    def __init__(self, txt: str):
        self.w: A = None
        self.y: E = None
        self.p: B = None
        self.q: D = None
        self.txt = txt

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

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

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

b.w = h
e.w = k
e.x = k
e.u = a
e.z = b
e.s = h
a.w = b
a.y = h
a.p = e
a.q = k
k.u = b
k.z = b
h.p = e
h.z = a
assert e.s.p.u.y.txt == "
class A:
    def __init__(self, txt: str):
        self.w: E = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.w: A = None
        self.y: E = None
        self.p: B = None
        self.q: D = None
        self.txt = txt

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

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

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

b.w = h
e.w = k
e.x = k
e.u = a
e.z = b
e.s = h
a.w = b
a.y = h
a.p = e
a.q = k
k.u = b
k.z = b
h.p = e
h.z = a
assert e.s.p.u.y.txt == "h"