Understanding the Problem
Most of you might have looked at the tutorial for this problem and are still confused as to why odd values are not included as perfect permutations?
Reason why we don't print permutations for odd values is not because they do not exist (They do exist!) but because of one of the conditions. This condition being Ppi = i or in more understandable terms P[ P[ i ] ] = i.
Example
So if you have the number 3, the possible permutations you can have to satisfy the second condition(Pi != i) are:
A = [ 3 1 2 ] or B = [ 2 3 1 ]
if we try to apply the first condition to any of the sets, we can see that
A[ A[ 2 ] ] = A[ 1 ] != 2
B[ B[ 2 ] ] = B[ 3 ] != 2
A[ A[ 1 ] ] = A[ 3 ] != 1
And as soon as one of these conditions fail, there cannot be a perfect permutation
Hope that helped