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

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

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

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

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

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

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

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

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

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

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

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

m.x = h
m.s = b
b.w = j
b.z = j
b.q = m
b.r = a
d.r = g
d.q = n
d.y = m
n.r = h
n.t = g
n.w = g
n.z = g
n.u = a
h.z = d
h.t = b
h.w = b
h.r = a
j.z = d
j.t = b
j.w = b
j.r = m
a.x = e
a.s = b
f.z = d
f.t = b
f.w = b
f.r = a
e.z = d
e.t = b
e.w = b
e.r = m
g.r = e
g.t = n
g.w = n
g.z = n
g.u = m
assert j.z.y.x.w.r.s.q.x.r.x.txt == "e"