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

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

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

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

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

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

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

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

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

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

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

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

d.p = k
d.q = k
d.w = e
d.r = e
d.z = i
k.w = d
k.u = d
g.o = e
g.r = i
l.w = i
l.t = e
l.u = d
e.q = d
e.s = k
i.w = l
i.t = e
i.u = d
assert d.z.u.r.s.u.z.txt == "i"