io.write((function (f, _, s, t) local a,i = f(s),1 for e in t:gmatch("%w+") do if a[i]~=e then return i,"\n",a[i],"\n",e end i=i+1 end return i end)(function (s) local a = {} for e in s:gmatch("%w+") do table.insert(a,e) end return a end, io.stdin:read("*l"), io.stdin:read("*l"), io.stdin:read("*l")))