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

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

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

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

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

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

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

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

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

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

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

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

h.s = a
h.r = k
k.w = d
k.x = n
a.o = e
i.r = h
i.p = h
i.x = h
i.y = e
i.w = a
e.o = h
e.z = k
d.r = h
d.p = h
d.x = h
d.y = e
d.w = a
n.w = d
n.x = l
l.w = i
l.x = n
assert k.x.x.w.y.o.r.x.w.txt == "d"