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

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

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

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

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

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

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

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

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

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

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

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

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