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

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

class C:
    def __init__(self, txt: str):
        self.x: D = None
        self.s: D = None
        self.y: E = None
        self.q: F = None
        self.o: F = None
        self.txt = txt

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

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

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

g = A("g")
d = B("d")
i = C("i")
e = D("e")
m = E("m")
n = F("n")

g.u = m
d.z = g
i.x = e
i.s = e
i.y = m
i.q = n
i.o = n
e.w = i
e.u = g
e.v = g
m.o = i
m.t = n
m.w = d
m.z = d
n.u = m
n.o = i
n.p = e
n.s = e
assert d.z.u.t.txt == "
class A:
    def __init__(self, txt: str):
        self.u: E = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.x: D = None
        self.s: D = None
        self.y: E = None
        self.q: F = None
        self.o: F = None
        self.txt = txt

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

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

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

g = A("g")
d = B("d")
i = C("i")
e = D("e")
m = E("m")
n = F("n")

g.u = m
d.z = g
i.x = e
i.s = e
i.y = m
i.q = n
i.o = n
e.w = i
e.u = g
e.v = g
m.o = i
m.t = n
m.w = d
m.z = d
n.u = m
n.o = i
n.p = e
n.s = e
assert d.z.u.t.txt == "n"