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

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

class C:
    def __init__(self, txt: str):
        self.p: B = None
        self.x: A = None
        self.v: E = None
        self.r: E = None
        self.txt = txt

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

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

m = A("m")
g = B("g")
l = C("l")
n = D("n")
f = E("f")

m.t = g
m.s = g
g.v = f
l.p = g
l.x = m
l.v = f
l.r = f
n.w = f
n.u = f
f.x = n
f.y = l
f.z = l
f.w = m
assert g.v.w.t.v.x.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.s: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.p: B = None
        self.x: A = None
        self.v: E = None
        self.r: E = None
        self.txt = txt

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

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

m = A("m")
g = B("g")
l = C("l")
n = D("n")
f = E("f")

m.t = g
m.s = g
g.v = f
l.p = g
l.x = m
l.v = f
l.r = f
n.w = f
n.u = f
f.x = n
f.y = l
f.z = l
f.w = m
assert g.v.w.t.v.x.txt == "n"