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

class B:
    def __init__(self, txt: str):
        self.r: D = None
        self.x: D = None
        self.u: C = None
        self.o: C = 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: A = None
        self.txt = txt

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

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

g.w = l
g.p = e
n.r = l
n.x = l
n.u = a
n.o = a
a.u = g
l.q = g
d.t = g
d.u = a
d.w = e
e.t = g
e.u = a
e.w = d
i.r = l
i.x = l
i.u = a
i.o = a
assert d.u.u.p.t.p.txt == "
class A:
    def __init__(self, txt: str):
        self.w: D = None
        self.p: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.r: D = None
        self.x: D = None
        self.u: C = None
        self.o: C = 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: A = None
        self.txt = txt

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

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

g.w = l
g.p = e
n.r = l
n.x = l
n.u = a
n.o = a
a.u = g
l.q = g
d.t = g
d.u = a
d.w = e
e.t = g
e.u = a
e.w = d
i.r = l
i.x = l
i.u = a
i.o = a
assert d.u.u.p.t.p.txt == "e"