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

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

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

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

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

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

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

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

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

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

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

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

n.x = b
h.x = e
h.q = n
e.x = l
e.o = l
e.y = d
e.u = d
l.y = h
l.t = d
l.z = j
l.s = n
j.s = l
j.u = b
j.w = n
j.q = e
b.s = l
b.u = j
b.w = n
b.q = e
d.x = l
d.o = l
d.y = e
d.u = e
assert j.u.w.x.q.txt == "e"