def linkspan_init(M, t, k, i, j, w, m):
    """
    Returns the start windows spanned by the m'th link (a (period,day,week) tuple)
    of the chain starting in period (i,j,w)
    """
    window_list = []
    for (p, d, q) in M.link[t, k, i, j, w, m]:
        for (a, b, c) in M.PotentialGlobalStartWindow[p, d, q]:
            if (a, b, c) not in window_list:
                window_list.append((a, b, c))
        if m > 1:
            for (a, b, c) in M.linkspan[t, k, i, j, w, m - 1]:
                if (a, b, c) not in window_list:
                    window_list.append((a, b, c))

    return window_list