n = gets a = gets.split b = gets.split p a.permutation(n).to_a