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

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

class C:
    def __init__(self, txt: str):
        self.w: A = None
        self.s: F = None
        self.o: B = None
        self.p: F = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.s: E = None
        self.p: F = None
        self.r: C = None
        self.z: C = None
        self.x: A = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.x: D = None
        self.txt = txt

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.w: A = None
        self.s: F = None
        self.o: B = None
        self.p: F = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.s: E = None
        self.p: F = None
        self.r: C = None
        self.z: C = None
        self.x: A = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.x: D = None
        self.txt = txt

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

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

a.y = l
g.o = d
f.w = a
f.s = d
f.p = d
f.o = g
n.s = l
n.p = d
n.r = f
n.z = f
n.x = a
l.x = n
d.u = n
d.y = f
assert f.w.y.x.x.y.x.txt == "n"