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

class B:
    def __init__(self, txt: str):
        self.p: A = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.z: C = None
        self.w: B = None
        self.q: E = None
        self.o: B = None
        self.y: E = None
        self.txt = txt

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

d.r = g
d.p = g
d.o = l
d.u = b
d.w = b
l.p = d
b.u = m
m.u = i
g.z = b
g.w = l
g.o = l
g.q = a
g.y = a
e.u = i
a.z = b
a.w = l
a.o = l
a.q = g
a.y = g
i.u = e
assert a.o.p.w.u.u.u.u.txt == "
class A:
    def __init__(self, txt: str):
        self.r: E = None
        self.o: B = None
        self.u: C = None
        self.w: C = None
        self.p: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.p: A = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.z: C = None
        self.w: B = None
        self.q: E = None
        self.o: B = None
        self.y: E = None
        self.txt = txt

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

d.r = g
d.p = g
d.o = l
d.u = b
d.w = b
l.p = d
b.u = m
m.u = i
g.z = b
g.w = l
g.o = l
g.q = a
g.y = a
e.u = i
a.z = b
a.w = l
a.o = l
a.q = g
a.y = g
i.u = e
assert a.o.p.w.u.u.u.u.txt == "i"