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

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

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

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

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

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

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

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

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

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

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

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

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