#include <bits/stdc++.h>
const int maxn = 2e5 + 5;
using namespace std;
vector<int> v;
int a[maxn], b[maxn];
int main() {
  int n;
  scanf("%d", &n);
  string s1, s2;
  cin >> s1 >> s2;
  int t1 = 0, t2 = 0;
  int k = 0;
  for (int i = 0; i < n; i++) {
    if (s1[i] == 'a') {
      t1++;
    }
    if (s2[i] == 'a') {
      t2++;
    }
    if (s1[i] != s2[i]) {
      v.push_back(i);
    }
  }
  if ((t1 + t2) & 1) {
    cout << -1 << endl;
    return 0;
  }
  for (int i = 0; i < v.size();) {
    int flag = 0;
    for (int j = 1; j < v.size(); j++) {
      if (s1[v[i]] != s2[v[j]]) {
        a[k] = v[i] + 1;
        b[k] = v[j] + 1;
        k++;
        v.erase(v.begin() + i);
        v.erase(v.begin() + j - 1);
        flag = 1;
        break;
      }
    }
    if (flag == 0) {
      swap(s1[v[i]], s2[v[i]]);
      a[k] = v[i] + 1;
      b[k] = v[i] + 1;
      k++;
    }
  }
  cout << k << endl;
  for (int i = 0; i < k; i++) {
    printf("%d %d\n", a[i], b[i]);
  }
  return 0;
}
