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

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

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

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

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

d = A("d")
j = B("j")
h = C("h")
b = D("b")
n = E("n")
a = B("a")
k = E("k")
c = A("c")

d.z = j
d.w = k
j.q = a
j.z = n
h.r = j
h.u = n
b.s = a
n.t = b
n.z = d
n.s = a
a.q = j
a.z = k
k.t = b
k.z = d
k.s = a
c.z = a
c.w = n
assert a.z.s.q.z.txt == "
class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.w: E = None
        self.txt = txt

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

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

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

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

d = A("d")
j = B("j")
h = C("h")
b = D("b")
n = E("n")
a = B("a")
k = E("k")
c = A("c")

d.z = j
d.w = k
j.q = a
j.z = n
h.r = j
h.u = n
b.s = a
n.t = b
n.z = d
n.s = a
a.q = j
a.z = k
k.t = b
k.z = d
k.s = a
c.z = a
c.w = n
assert a.z.s.q.z.txt == "n"