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

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

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

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

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

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

m.x = f
m.s = k
h.o = d
h.q = d
h.s = d
h.t = a
i.v = h
i.o = a
k.v = a
k.z = a
a.r = k
a.y = h
a.v = m
d.v = h
d.o = a
f.x = m
f.s = k
assert k.z.r.v.r.z.v.s.txt == "
class A:
    def __init__(self, txt: str):
        self.x: A = None
        self.s: D = None
        self.txt = txt

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

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

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

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

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

m.x = f
m.s = k
h.o = d
h.q = d
h.s = d
h.t = a
i.v = h
i.o = a
k.v = a
k.z = a
a.r = k
a.y = h
a.v = m
d.v = h
d.o = a
f.x = m
f.s = k
assert k.z.r.v.r.z.v.s.txt == "k"