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

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

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

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

class E:
    def __init__(self, txt: str):
        self.x: F = None
        self.t: B = None
        self.o: A = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.p: D = None
        self.w: C = None
        self.u: A = None
        self.x: B = None
        self.r: D = None
        self.txt = txt

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

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.x: F = None
        self.t: B = None
        self.o: A = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.p: D = None
        self.w: C = None
        self.u: A = None
        self.x: B = None
        self.r: D = None
        self.txt = txt

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

e.z = f
g.q = e
g.s = e
g.o = f
g.u = d
f.w = a
d.w = g
d.x = a
n.x = a
n.t = g
n.o = e
a.p = d
a.r = d
a.w = f
a.u = e
a.x = g
assert n.o.z.w.x.u.txt == "d"