N, SX, TX = input(), input().split(' '), input().split(' ') s, t = (set(SX) - set(TX)).pop(), (set(TX) - set(SX)).pop() print('\n'.join([str(TX.index(t) + 1), s, t]))