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

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

class C:
    def __init__(self, txt: str):
        self.v: B = None
        self.p: C = None
        self.txt = txt

k = A("k")
i = B("i")
l = C("l")
f = B("f")
m = C("m")
d = A("d")
j = A("j")

k.z = d
i.t = f
i.o = f
i.w = d
l.v = f
l.p = m
f.t = i
f.o = i
f.w = j
m.v = i
m.p = l
d.z = j
j.z = d
assert d.z.z.z.z.z.z.txt == "
class A:
    def __init__(self, txt: str):
        self.z: A = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.v: B = None
        self.p: C = None
        self.txt = txt

k = A("k")
i = B("i")
l = C("l")
f = B("f")
m = C("m")
d = A("d")
j = A("j")

k.z = d
i.t = f
i.o = f
i.w = d
l.v = f
l.p = m
f.t = i
f.o = i
f.w = j
m.v = i
m.p = l
d.z = j
j.z = d
assert d.z.z.z.z.z.z.txt == "d"