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

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

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

class D:
    def __init__(self, txt: str):
        self.o: A = None
        self.y: C = None
        self.u: A = None
        self.w: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.y: A = None
        self.r: C = None
        self.t: A = None
        self.s: A = None
        self.txt = txt

e = A("e")
l = B("l")
d = C("d")
j = D("j")
g = E("g")
h = B("h")

e.q = j
e.x = j
e.u = g
e.z = h
l.p = j
l.x = h
d.q = h
d.p = e
d.s = e
d.u = g
d.z = j
j.o = e
j.u = e
j.y = d
j.w = g
g.y = e
g.t = e
g.s = e
g.r = d
h.p = j
h.x = l
assert d.s.u.y.z.txt == "
class A:
    def __init__(self, txt: str):
        self.q: D = None
        self.u: E = None
        self.x: D = None
        self.z: B = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.o: A = None
        self.y: C = None
        self.u: A = None
        self.w: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.y: A = None
        self.r: C = None
        self.t: A = None
        self.s: A = None
        self.txt = txt

e = A("e")
l = B("l")
d = C("d")
j = D("j")
g = E("g")
h = B("h")

e.q = j
e.x = j
e.u = g
e.z = h
l.p = j
l.x = h
d.q = h
d.p = e
d.s = e
d.u = g
d.z = j
j.o = e
j.u = e
j.y = d
j.w = g
g.y = e
g.t = e
g.s = e
g.r = d
h.p = j
h.x = l
assert d.s.u.y.z.txt == "h"