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

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

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

class D:
    def __init__(self, txt: str):
        self.z: A = None
        self.w: B = None
        self.p: B = None
        self.o: C = None
        self.v: C = None
        self.txt = txt

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

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

l = A("l")
g = B("g")
h = C("h")
i = D("i")
d = E("d")
f = F("f")

l.z = i
g.s = i
h.x = l
h.o = d
h.w = d
h.y = g
h.s = i
i.z = l
i.w = g
i.p = g
i.o = h
i.v = h
d.s = h
d.x = g
f.s = g
assert i.p.s.w.s.z.z.txt == "
class A:
    def __init__(self, txt: str):
        self.z: D = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.z: A = None
        self.w: B = None
        self.p: B = None
        self.o: C = None
        self.v: C = None
        self.txt = txt

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

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

l = A("l")
g = B("g")
h = C("h")
i = D("i")
d = E("d")
f = F("f")

l.z = i
g.s = i
h.x = l
h.o = d
h.w = d
h.y = g
h.s = i
i.z = l
i.w = g
i.p = g
i.o = h
i.v = h
d.s = h
d.x = g
f.s = g
assert i.p.s.w.s.z.z.txt == "i"