class A:
    def __init__(self, txt: str):
        self.r: D = None
        self.s: E = None
        self.o: E = None
        self.x: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.z: E = None
        self.u: C = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.w: B = None
        self.z: B = None
        self.q: E = None
        self.v: C = None
        self.u: C = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.z: E = None
        self.u: C = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.w: B = None
        self.z: B = None
        self.q: E = None
        self.v: C = None
        self.u: C = None
        self.txt = txt

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

e.r = m
e.s = n
e.o = n
e.x = a
b.z = h
b.u = a
a.u = e
m.z = n
m.r = n
m.u = e
m.x = h
h.w = b
h.z = b
h.q = n
h.v = a
h.u = a
n.w = b
n.z = b
n.q = h
n.v = a
n.u = a
assert n.z.z.q.q.q.txt == "n"