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

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

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

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

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

h = A("h")
l = B("l")
d = C("d")
i = D("i")
a = E("a")

h.s = l
h.u = d
l.x = h
l.s = a
l.w = a
l.y = d
d.s = a
d.q = h
d.u = h
i.r = a
i.u = l
i.w = h
a.w = h
a.y = h
a.z = h
a.s = i
assert h.s.x.u.u.u.txt == "
class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.u: C = None
        self.txt = txt

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

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

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

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

h = A("h")
l = B("l")
d = C("d")
i = D("i")
a = E("a")

h.s = l
h.u = d
l.x = h
l.s = a
l.w = a
l.y = d
d.s = a
d.q = h
d.u = h
i.r = a
i.u = l
i.w = h
a.w = h
a.y = h
a.z = h
a.s = i
assert h.s.x.u.u.u.txt == "d"