n = gets.to_i a = gets.split b = gets.split ap = a.permutation(n).to_a ap.length ab = ap.zip([b] * n) p ap