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

class B:
    def __init__(self, txt: str):
        self.y: C = None
        self.t: E = None
        self.v: E = None
        self.z: C = None
        self.u: E = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.r: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.o: B = None
        self.u: E = None
        self.y: E = None
        self.txt = txt

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

k = A("k")
h = B("h")
n = C("n")
i = D("i")
m = E("m")
d = A("d")

k.x = d
k.z = d
k.u = d
k.o = m
k.w = i
h.y = n
h.z = n
h.t = m
h.v = m
h.u = m
n.r = i
i.o = h
i.u = m
i.y = m
m.r = i
d.x = k
d.z = k
d.u = k
d.o = m
d.w = i
assert d.x.o.r.u.r.o.txt == "
class A:
    def __init__(self, txt: str):
        self.x: A = None
        self.z: A = None
        self.u: A = None
        self.o: E = None
        self.w: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.y: C = None
        self.t: E = None
        self.v: E = None
        self.z: C = None
        self.u: E = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.r: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.o: B = None
        self.u: E = None
        self.y: E = None
        self.txt = txt

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

k = A("k")
h = B("h")
n = C("n")
i = D("i")
m = E("m")
d = A("d")

k.x = d
k.z = d
k.u = d
k.o = m
k.w = i
h.y = n
h.z = n
h.t = m
h.v = m
h.u = m
n.r = i
i.o = h
i.u = m
i.y = m
m.r = i
d.x = k
d.z = k
d.u = k
d.o = m
d.w = i
assert d.x.o.r.u.r.o.txt == "h"