p=RandomPermutation[20]

pl=PermutationList[p]

SetAttributes[Sack, Orderless];
s=Times@@Table[Chain[i,pl[[i]]], {i, Length@pl}]

Reap[s //. {
Chain[a_,mid___,a_] :> (Sow[{a,mid}];1),
Chain[l__,a_]Chain[a_,r__] :> Chain[l,a,r]
}][[2,1]]

{a,b,c} /. b-> Nothing

pl={2,1}

visited=Table[False, {n=Length[pl]}];
Reap[
For[i=1, i≤n, ++i,
If[(!visited[[i]])∧i≠pl[[i]],
Sow[Reap[
j=i; While[i≠(j=pl[[Sow[j]]]), visited[[j]]=True]
][[2,1]]]
]
]
][[2,1]]

visited

dror::usage="dror teaches things"

?dror

?None

None+1

?IdentityPermutation

Context[dror]

Context[Plus]

Contexts[]

$ContextPath

$Context="Horse`"

?dror

cow=7

Context[cow]

$Context="Golbal`"

cow

Horse`cow