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

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

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

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

e = A("e")
m = B("m")
i = C("i")
j = D("j")
b = C("b")
n = C("n")
a = A("a")

e.s = b
e.q = i
e.t = m
e.z = a
m.q = a
m.s = a
m.w = i
i.u = j
i.r = j
j.q = i
j.x = n
j.z = e
b.u = j
b.r = j
n.u = j
n.r = j
a.s = b
a.q = n
a.t = m
a.z = e
assert j.z.s.u.q.r.z.txt == "
class A:
    def __init__(self, txt: str):
        self.s: C = None
        self.q: C = None
        self.t: B = None
        self.z: A = None
        self.txt = txt

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

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

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

e = A("e")
m = B("m")
i = C("i")
j = D("j")
b = C("b")
n = C("n")
a = A("a")

e.s = b
e.q = i
e.t = m
e.z = a
m.q = a
m.s = a
m.w = i
i.u = j
i.r = j
j.q = i
j.x = n
j.z = e
b.u = j
b.r = j
n.u = j
n.r = j
a.s = b
a.q = n
a.t = m
a.z = e
assert j.z.s.u.q.r.z.txt == "e"