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

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

class C:
    def __init__(self, txt: str):
        self.w: F = None
        self.s: D = None
        self.r: F = None
        self.v: F = None
        self.y: B = None
        self.x: B = None
        self.txt = txt

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

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

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

i = A("i")
d = B("d")
g = C("g")
e = D("e")
f = E("f")
a = F("a")

i.u = g
d.o = e
g.w = a
g.r = a
g.v = a
g.s = e
g.y = d
g.x = d
e.v = i
e.x = g
e.y = a
e.w = a
f.y = a
f.o = a
f.t = g
f.z = g
f.r = d
a.z = d
assert e.w.z.o.txt == "
class A:
    def __init__(self, txt: str):
        self.u: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.w: F = None
        self.s: D = None
        self.r: F = None
        self.v: F = None
        self.y: B = None
        self.x: B = None
        self.txt = txt

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

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

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

i = A("i")
d = B("d")
g = C("g")
e = D("e")
f = E("f")
a = F("a")

i.u = g
d.o = e
g.w = a
g.r = a
g.v = a
g.s = e
g.y = d
g.x = d
e.v = i
e.x = g
e.y = a
e.w = a
f.y = a
f.o = a
f.t = g
f.z = g
f.r = d
a.z = d
assert e.w.z.o.txt == "e"