def permutationEquation(p):
    # Write your code here
    result = [0] * len(p)
    
    for n in p:
        next_ = p[n - 1]
        next__ = p[next_ - 1]
        result[next__ - 1] = n
        
    return result