class A:
    def __init__(self, txt: str):
        self.y: A = None
        self.v: A = None
        self.x: A = None
        self.txt = txt

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

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

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

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

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

n.y = e
n.v = e
n.x = e
k.s = g
k.x = n
d.u = k
g.x = n
g.s = f
g.z = e
g.y = m
g.u = k
h.w = d
h.u = f
h.s = g
e.y = n
e.v = n
e.x = n
i.w = d
i.u = f
i.s = f
m.w = d
m.u = f
m.s = f
f.x = e
f.z = e
f.s = g
f.y = h
f.u = k
assert g.z.x.v.y.txt == "
class A:
    def __init__(self, txt: str):
        self.y: A = None
        self.v: A = None
        self.x: A = None
        self.txt = txt

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

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

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

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

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

n.y = e
n.v = e
n.x = e
k.s = g
k.x = n
d.u = k
g.x = n
g.s = f
g.z = e
g.y = m
g.u = k
h.w = d
h.u = f
h.s = g
e.y = n
e.v = n
e.x = n
i.w = d
i.u = f
i.s = f
m.w = d
m.u = f
m.s = f
f.x = e
f.z = e
f.s = g
f.y = h
f.u = k
assert g.z.x.v.y.txt == "n"