영어 원문입니다. 원문의 수식·표를 글자로 옮겨 모양이 다를 수 있습니다. 정확한 내용은 원문 페이지에서 확인하세요. 원문 페이지 열기 (새 창)
시간 제한 1초 · 메모리 제한 512 MB
Problem
You are given two permutations a and b such that a_i ≠ b_i in every position. Create a third permutation c such that a_i ≠ c_i and b_i ≠ c_i in every position.
Input
The first line has an integer n: the permutation size.
The second line has n integers a_1,a_2,…,a_n.
The third line has n integers b_1,b_2,…,b_n.
Output
Print n integers c_1,c_2,…,c_n. You can print any valid solution. If there are no solutions, print IMPOSSIBLE.
Constraints
- 2 ≤ n ≤ 10^5
예제
예제 1
5 1 3 2 5 4 4 1 3 2 5
3 2 5 4 1