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

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

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

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

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

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

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

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

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

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

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

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

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

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

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