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

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

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

class D:
    def __init__(self, txt: str):
        self.s: B = None
        self.r: F = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.p: D = None
        self.z: C = None
        self.w: E = None
        self.o: C = None
        self.txt = txt

m = A("m")
c = B("c")
n = C("n")
i = D("i")
f = E("f")
e = F("e")

m.z = f
c.v = n
c.p = i
c.w = f
n.y = i
n.w = f
i.s = c
i.r = e
f.u = e
f.w = c
f.y = n
e.p = i
e.z = n
e.o = n
e.w = f
assert m.z.y.w.w.p.txt == "
class A:
    def __init__(self, txt: str):
        self.z: E = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.s: B = None
        self.r: F = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.p: D = None
        self.z: C = None
        self.w: E = None
        self.o: C = None
        self.txt = txt

m = A("m")
c = B("c")
n = C("n")
i = D("i")
f = E("f")
e = F("e")

m.z = f
c.v = n
c.p = i
c.w = f
n.y = i
n.w = f
i.s = c
i.r = e
f.u = e
f.w = c
f.y = n
e.p = i
e.z = n
e.o = n
e.w = f
assert m.z.y.w.w.p.txt == "i"