A permutation of size n is a reordering of the first n positive integers. (meaning each integer appears once and exactly once). Permutations can be treated like functions that change the order of a list of items of size n. For example
(4 1 2 3) ["a", "b", "c", "d"] = ["d", "a", "b", "c"]
Thus permutations can be composed like functions.
(4 1 2 3)(2 1 3 4) = (4 2 1 3)
This brings about a lot of interesting properties. Today we are focusing on conjugacy. Permutations y and x (both of size n) are conjugates iff there are permutations g and g-1 (also of size n) such that
x = gyg-1
and gg-1 is equal to the identity permutation (the first n numbers in proper order).
Your task is to take two permutations of the same size via standard input methods and decide whether they are conjugates. You should output one of two consistent values, one if they are conjugates and the other if they are not.
This is code-golf so answers will be scored in bytes with fewer bytes being better.
There are lots of theorems about conjugate permutations that are at your disposal, so good luck and happy golfing.
You may take input as an ordered container of values (either 1-n or 0-n) representing the permutation like above, or as a function that takes a ordered container and performs the permutation. If you choose to take function you should take it as an argument rather than have it at a predefined name.
Test Cases
(1) (1) -> True
(1 2) (2 1) -> False
(2 1) (2 1) -> True
(4 1 3 2) (4 2 1 3) -> True
(3 2 1 4) (4 3 2 1) -> False
(2 1 3 4 5 7 6) (1 3 2 5 4 6 7) -> True