#include <bits/stdc++.h>
using namespace std;
int n;
char a[440000], b[440000];
int cnta = 0, cntb = 0;
int df[440000] = {0};
int czl[440000], czr[440000];
int zz1 = 0, zz2 = 0;
int ab[440000] = {0}, ba[440000] = {0};
int ans = 0;
int main() {
  cin >> n;
  cin >> a >> b;
  for (int i = 0; i < n; i++) {
    if (a[i] == 'a') {
      cnta++;
      if (a[i] != b[i]) ab[++zz1] = i + 1;
    }
    if (b[i] == 'a') {
      cntb++;
      if (a[i] != b[i]) ba[++zz2] = i + 1;
    }
  }
  if ((zz1 + zz2) % 2 == 1) {
    cout << -1 << endl;
    return 0;
  }
  while (zz1 || zz2) {
    if (zz2 % 2 == 1) {
      zz2++;
      ans++;
      czl[ans] = ab[zz1], czr[ans] = ab[zz1];
      ba[zz2] = ab[zz1];
      zz1--;
    }
    if (zz1) {
      ans++;
      czl[ans] = ab[zz1], czr[ans] = ab[zz1 - 1];
      zz1 -= 2;
    } else {
      ans++;
      czl[ans] = ba[zz2], czr[ans] = ba[zz2 - 1];
      zz2 -= 2;
    }
  }
  cout << ans << endl;
  for (int i = 1; i <= ans; i++) cout << czl[i] << " " << czr[i] << endl;
  return 0;
}
