#include <iostream>
#include <string>
#include <vector>
#include <utility>
using namespace std;
int main(void){
  int n;
  cin >> n;
  string x[n],y[n];
  for(int i=0;i<n;i++)
    cin >> x[i];
  for(int i=0;i<n;i++)
    cin >> y[i];
  for(int i=0;i<n;i++)
    if(x[i]!=y[i]){
      cout << i+1 << "\n" << x[i] << "\n" << y[i] << "\n";
      break;
    }
  return 0;
}