N, SX, TX = input(), input().split(' '), input().split(' ') for i, s in enumerate(SX): if s != TX[i]: print(i + 1) print(s) print(TX[i]) break