class A:
    def __init__(self, txt: str):
        self.w: B = None
        self.u: C = None
        self.z: D = None
        self.v: C = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.w: B = None
        self.r: A = None
        self.p: F = None
        self.v: D = None
        self.s: D = None
        self.q: B = None
        self.txt = txt

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

a = A("a")
f = B("f")
d = C("d")
m = D("m")
c = E("c")
g = F("g")

a.w = f
a.u = d
a.v = d
a.z = m
f.u = c
f.z = c
f.y = m
f.t = d
f.q = g
d.v = c
d.r = f
m.u = c
m.s = a
m.o = d
m.v = f
m.y = f
c.w = f
c.q = f
c.r = a
c.p = g
c.v = m
c.s = m
g.w = m
assert m.s.z.v.u.v.txt == "
class A:
    def __init__(self, txt: str):
        self.w: B = None
        self.u: C = None
        self.z: D = None
        self.v: C = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.w: B = None
        self.r: A = None
        self.p: F = None
        self.v: D = None
        self.s: D = None
        self.q: B = None
        self.txt = txt

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

a = A("a")
f = B("f")
d = C("d")
m = D("m")
c = E("c")
g = F("g")

a.w = f
a.u = d
a.v = d
a.z = m
f.u = c
f.z = c
f.y = m
f.t = d
f.q = g
d.v = c
d.r = f
m.u = c
m.s = a
m.o = d
m.v = f
m.y = f
c.w = f
c.q = f
c.r = a
c.p = g
c.v = m
c.s = m
g.w = m
assert m.s.z.v.u.v.txt == "m"