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

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

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

class D:
    def __init__(self, txt: str):
        self.q: C = None
        self.x: A = None
        self.r: B = None
        self.p: D = None
        self.s: C = None
        self.txt = txt

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

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.q: C = None
        self.x: A = None
        self.r: B = None
        self.p: D = None
        self.s: C = None
        self.txt = txt

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

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

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