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

class B:
    def __init__(self, txt: str):
        self.y: A = None
        self.x: E = None
        self.s: D = None
        self.w: D = None
        self.txt = txt

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

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.y: A = None
        self.x: E = None
        self.s: D = None
        self.w: D = None
        self.txt = txt

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

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

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

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

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