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

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

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

class D:
    def __init__(self, txt: str):
        self.z: C = None
        self.txt = txt

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

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

g.w = b
g.z = b
g.t = f
g.p = m
g.x = m
f.w = m
e.x = g
e.w = m
m.z = e
b.t = e
b.s = f
b.w = g
assert m.z.w.z.w.txt == "
class A:
    def __init__(self, txt: str):
        self.w: E = None
        self.t: B = None
        self.p: D = None
        self.z: E = None
        self.x: D = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.z: C = None
        self.txt = txt

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

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

g.w = b
g.z = b
g.t = f
g.p = m
g.x = m
f.w = m
e.x = g
e.w = m
m.z = e
b.t = e
b.s = f
b.w = g
assert m.z.w.z.w.txt == "m"