N = int(input()) S_list = input().split() T_list = input().split() for i in range(N): if S_list[i] != T_list[i]: print(i+1) print(S_list[i]) print(T_list[i]) break