#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(LL i = a;i<b; i++)
#define rrep(i,a,b) for(LL i = a;i>b; i--)
#define INF ((1LL<<62)-(1LL<<31))
#define ooki 9,223,372,036,854,775,807
#define tii -9,223,372,036,854,775,808
typedef long long LL;
int main(){
int n;
  cin >> n;
  vector<string> s(n);rep(i,0,n){cin>>s[i];}
  vector<string> t(n);rep(i,0,n){cin>>t[i];}
  rep(i,0,n){
    if(s[i]!=t[i]){
      cout<<i+1<<endl<<s[i]<<endl<<t[i]<<endl;
      return 0;
    }
  }
}