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.p: E = None
        self.s: C = None
        self.v: B = None
        self.o: E = None
        self.txt = txt

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

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

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

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

k.s = m
k.r = i
i.p = e
i.o = e
i.s = d
i.v = h
m.y = e
m.z = h
g.v = e
g.p = e
g.u = e
g.r = i
g.z = d
e.x = h
h.p = e
h.o = e
h.s = d
h.v = i
d.y = e
d.z = h
assert m.z.o.x.p.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.p: E = None
        self.s: C = None
        self.v: B = None
        self.o: E = None
        self.txt = txt

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

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

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

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

k.s = m
k.r = i
i.p = e
i.o = e
i.s = d
i.v = h
m.y = e
m.z = h
g.v = e
g.p = e
g.u = e
g.r = i
g.z = d
e.x = h
h.p = e
h.o = e
h.s = d
h.v = i
d.y = e
d.z = h
assert m.z.o.x.p.txt == "e"