#458 Three Permutations and Queries