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

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

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

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

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

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

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

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

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

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

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

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

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