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

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

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

class D:
    def __init__(self, txt: str):
        self.q: B = None
        self.x: A = None
        self.w: C = None
        self.p: C = None
        self.txt = txt

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

e = A("e")
m = B("m")
n = C("n")
i = D("i")
l = E("l")
c = A("c")
g = D("g")

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

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

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

class D:
    def __init__(self, txt: str):
        self.q: B = None
        self.x: A = None
        self.w: C = None
        self.p: C = None
        self.txt = txt

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

e = A("e")
m = B("m")
n = C("n")
i = D("i")
l = E("l")
c = A("c")
g = D("g")

e.w = c
e.s = l
m.y = l
m.w = l
m.t = i
m.s = i
n.u = e
i.q = m
i.x = e
i.w = n
i.p = n
l.x = n
c.w = e
c.s = l
g.q = m
g.x = e
g.w = n
g.p = n
assert e.s.x.u.w.w.w.w.txt == "e"