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

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

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

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

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

n = A("n")
i = B("i")
e = C("e")
g = D("g")
m = E("m")
k = D("k")
b = E("b")

n.u = m
n.v = b
i.z = b
e.r = i
e.u = b
g.u = m
g.x = m
g.z = i
g.q = e
g.r = k
m.q = b
m.v = n
m.s = g
k.u = m
k.x = m
k.z = i
k.q = e
k.r = g
b.q = m
b.v = n
b.s = g
assert e.r.z.v.u.txt == "
class A:
    def __init__(self, txt: str):
        self.u: E = None
        self.v: E = None
        self.txt = txt

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

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

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

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

n = A("n")
i = B("i")
e = C("e")
g = D("g")
m = E("m")
k = D("k")
b = E("b")

n.u = m
n.v = b
i.z = b
e.r = i
e.u = b
g.u = m
g.x = m
g.z = i
g.q = e
g.r = k
m.q = b
m.v = n
m.s = g
k.u = m
k.x = m
k.z = i
k.q = e
k.r = g
b.q = m
b.v = n
b.s = g
assert e.r.z.v.u.txt == "m"