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

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

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

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

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

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

e.r = n
e.y = m
h.s = m
h.v = e
h.q = g
n.t = e
n.v = g
n.q = m
n.s = m
n.x = i
i.s = m
i.x = h
i.p = k
i.w = k
m.u = i
k.s = m
k.x = h
k.p = i
k.w = i
g.t = e
g.v = n
g.q = m
g.s = m
g.x = k
assert k.x.q.x.s.txt == "
class A:
    def __init__(self, txt: str):
        self.r: C = None
        self.y: E = None
        self.txt = txt

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

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

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

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

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

e.r = n
e.y = m
h.s = m
h.v = e
h.q = g
n.t = e
n.v = g
n.q = m
n.s = m
n.x = i
i.s = m
i.x = h
i.p = k
i.w = k
m.u = i
k.s = m
k.x = h
k.p = i
k.w = i
g.t = e
g.v = n
g.q = m
g.s = m
g.x = k
assert k.x.q.x.s.txt == "m"