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

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

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

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

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

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

n.w = d
n.q = e
n.r = i
e.o = i
e.u = g
d.q = g
d.v = l
i.s = e
i.t = e
i.w = e
i.v = e
l.s = e
l.o = e
g.w = d
g.q = e
g.r = i
assert e.u.w.q.q.txt == "
class A:
    def __init__(self, txt: str):
        self.w: C = None
        self.q: B = None
        self.r: D = None
        self.txt = txt

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

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

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

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

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

n.w = d
n.q = e
n.r = i
e.o = i
e.u = g
d.q = g
d.v = l
i.s = e
i.t = e
i.w = e
i.v = e
l.s = e
l.o = e
g.w = d
g.q = e
g.r = i
assert e.u.w.q.q.txt == "e"