def correct_intervals(data):
    """
    returns elements of all possible correct intervals, assumes `data` is sorted, small to large
    """
    a = data
    n = len(data)
    a = list(range(0, n))
    b = list(range(0, n))
    c = []
    d = []
    for i in range(0, len(a)):
        b.pop(0)
        a.pop()
        c.extend(a)
        d.extend(b)
    X_i = c
    X_j = d
    return c, d
