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

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

class C:
    def __init__(self, txt: str):
        self.p: B = None
        self.u: D = None
        self.s: E = None
        self.t: E = None
        self.q: B = None
        self.txt = txt

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

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

a = A("a")
d = B("d")
k = C("k")
f = D("f")
g = E("g")
i = E("i")
j = B("j")
h = D("h")
c = B("c")

a.q = f
a.p = i
d.u = j
d.w = k
d.t = h
d.q = c
d.p = f
k.p = d
k.u = f
k.s = i
k.t = i
k.q = c
f.y = d
f.w = h
f.r = h
f.x = h
f.u = a
g.u = f
g.t = a
g.p = h
i.u = f
i.p = f
i.t = a
j.u = c
j.q = c
j.w = k
j.t = f
j.p = f
h.y = d
h.w = f
h.r = f
h.x = f
h.u = a
c.u = d
c.q = d
c.w = k
c.t = f
c.p = h
assert f.r.w.x.y.u.q.p.u.p.txt == "
class A:
    def __init__(self, txt: str):
        self.q: D = None
        self.p: E = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.p: B = None
        self.u: D = None
        self.s: E = None
        self.t: E = None
        self.q: B = None
        self.txt = txt

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

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

a = A("a")
d = B("d")
k = C("k")
f = D("f")
g = E("g")
i = E("i")
j = B("j")
h = D("h")
c = B("c")

a.q = f
a.p = i
d.u = j
d.w = k
d.t = h
d.q = c
d.p = f
k.p = d
k.u = f
k.s = i
k.t = i
k.q = c
f.y = d
f.w = h
f.r = h
f.x = h
f.u = a
g.u = f
g.t = a
g.p = h
i.u = f
i.p = f
i.t = a
j.u = c
j.q = c
j.w = k
j.t = f
j.p = f
h.y = d
h.w = f
h.r = f
h.x = f
h.u = a
c.u = d
c.q = d
c.w = k
c.t = f
c.p = h
assert f.r.w.x.y.u.q.p.u.p.txt == "i"