#include <bits/stdc++.h>
using namespace std;
int root(int Arr[], int i) {
  while (Arr[i] != i) {
    i = Arr[i];
  }
  return i;
}
int Union(int Arr[], int A, int B) {
  int root_A = root(Arr, A);
  int root_B = root(Arr, B);
  Arr[root_A] = root_B;
}
bool Find(int arr[], int A, int B) {
  if (root(arr, A) == root(arr, B))
    return true;
  else
    return false;
}
int main() {
  int n, l, r;
  cin >> n;
  string s, q;
  cin >> s >> q;
  int a[50];
  int show[n];
  for (int i = 0; i < n; i++) show[i] = 0;
  for (int i = 1; i <= 49; i++) a[i] = i;
  int ans = 0;
  for (int i = 0; i < n; i++) {
    l = s[i] - '0';
    r = int(q[i] - '0');
    l -= 48;
    r -= 48;
    if (!Find(a, l, r)) {
      Union(a, l, r);
      show[i]++;
      ans++;
    }
  }
  cout << ans << "\n";
  for (int i = 0; i < n; i++) {
    if (show[i] != 0) {
      cout << s[i] << " " << q[i];
      cout << "\n";
    }
  }
}
