def pairs(N):
    """
    Returns the ordered set of pairs of elements in {0, ..., N-1} for iterating.
    """

    pind=[]

    for i in range(N):
        for j in range(i+1,N): pind.append((i,j))

    return pind