Similar Items: Pattern avoidance in compositions and powers of permutations