def all_inversions(perm):
    """
    Generate all inversions of permutation

    :param perm: Permutation in one-line notation
    :type perm: list

    :return: Returns list with all inversions
    :rtype: list
    """
    inversions = []
    for i in range(len(perm)):
        for j in range(i + 1, len(perm)):
            if perm[i] > perm[j]:
                inversions.append([perm[i], perm[j]])

    return inversions