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

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

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

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

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

b = A("b")
e = B("e")
j = C("j")
k = D("k")
l = E("l")
g = E("g")
i = D("i")
c = A("c")

b.x = e
b.w = e
b.z = c
b.s = c
e.z = l
e.x = j
e.q = i
j.r = i
j.q = e
j.p = b
j.y = c
k.w = i
k.u = c
k.z = b
l.u = e
l.w = e
l.z = j
l.y = g
l.x = b
g.u = e
g.w = e
g.z = j
g.y = l
g.x = b
i.w = k
i.u = c
i.z = b
c.x = e
c.w = e
c.z = b
c.s = b
assert b.s.x.q.z.z.w.txt == "
class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.z: A = None
        self.w: B = None
        self.s: A = None
        self.txt = txt

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

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

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

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

b = A("b")
e = B("e")
j = C("j")
k = D("k")
l = E("l")
g = E("g")
i = D("i")
c = A("c")

b.x = e
b.w = e
b.z = c
b.s = c
e.z = l
e.x = j
e.q = i
j.r = i
j.q = e
j.p = b
j.y = c
k.w = i
k.u = c
k.z = b
l.u = e
l.w = e
l.z = j
l.y = g
l.x = b
g.u = e
g.w = e
g.z = j
g.y = l
g.x = b
i.w = k
i.u = c
i.z = b
c.x = e
c.w = e
c.z = b
c.s = b
assert b.s.x.q.z.z.w.txt == "e"