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