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

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

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

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

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

n = A("n")
h = B("h")
g = C("g")
j = D("j")
m = E("m")
k = D("k")

n.v = h
n.r = m
h.s = m
h.y = m
h.r = g
g.z = n
g.s = k
g.x = m
g.t = h
j.s = m
j.r = g
j.x = h
m.z = g
k.s = m
k.r = g
k.x = h
assert m.z.t.r.x.z.z.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.r: E = None
        self.txt = txt

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

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

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

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

n = A("n")
h = B("h")
g = C("g")
j = D("j")
m = E("m")
k = D("k")

n.v = h
n.r = m
h.s = m
h.y = m
h.r = g
g.z = n
g.s = k
g.x = m
g.t = h
j.s = m
j.r = g
j.x = h
m.z = g
k.s = m
k.r = g
k.x = h
assert m.z.t.r.x.z.z.txt == "n"