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

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

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

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

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

i = A("i")
d = B("d")
l = C("l")
m = D("m")
f = E("f")
j = B("j")
n = D("n")
b = A("b")
h = A("h")
a = C("a")

i.z = j
d.x = n
d.r = n
l.q = a
l.u = f
l.r = m
m.r = f
m.t = f
m.v = a
m.w = j
m.p = b
f.z = n
f.t = m
f.u = j
f.y = l
f.p = b
j.x = m
j.r = m
n.r = f
n.t = f
n.v = l
n.w = d
n.p = h
b.z = d
h.z = d
a.q = l
a.u = f
a.r = n
assert b.z.r.r.p.txt == "
class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.txt = txt

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

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

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

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

i = A("i")
d = B("d")
l = C("l")
m = D("m")
f = E("f")
j = B("j")
n = D("n")
b = A("b")
h = A("h")
a = C("a")

i.z = j
d.x = n
d.r = n
l.q = a
l.u = f
l.r = m
m.r = f
m.t = f
m.v = a
m.w = j
m.p = b
f.z = n
f.t = m
f.u = j
f.y = l
f.p = b
j.x = m
j.r = m
n.r = f
n.t = f
n.v = l
n.w = d
n.p = h
b.z = d
h.z = d
a.q = l
a.u = f
a.r = n
assert b.z.r.r.p.txt == "b"