def get_sequence_of_coords(n, i1, i2):
    """
    given  number  of elements in the ring (n), starting and ending indexes (i1, i2)
    returns a list of element numbers subjected to move

    :param n: number of elements
    :type n: int
    :param i1: starting position
    :type i1: int
    :param i2: ending position
    :type i2: int
    :return: list of elements of ring chain subjected to move
    :rtype: list
    """

    if (n < max(i1, i2)) | (i1 < 0) | (i2 < 0):
        return None
    else:
        if abs(i2-i1) < n - abs(i2-i1):
            if i1<i2: return  list(range(i1, i2+1))
            else: return  list(range(i2, i1+1))
        else:
            if i1<i2: return list(range(i2, n)) + list(range(i1+1))
            else: return list(range(i1, n)) + list(range(i2+1))