import java.io.*; import java.util.*; public class Main_yukicoder547 { private static Scanner sc; private static Printer pr; private static void solve() { int n = sc.nextInt(); String[] s = new String[n]; String[] t = new String[n]; for (int i = 0; i < n; i++) { s[i] = sc.next(); } for (int i = 0; i < n; i++) { t[i] = sc.next(); if (!s[i].equals(t[i])) { pr.println(i + 1); pr.println(s[i]); pr.println(t[i]); return; } } } // --------------------------------------------------- public static void main(String[] args) { sc = new Scanner(System.in); pr = new Printer(System.out); solve(); pr.close(); sc.close(); } private static class Printer extends PrintWriter { Printer(PrintStream out) { super(out); } } }