#include <bits/stdc++.h>
int rd() {
  int k = 0, f = 1;
  char c = getchar();
  while (c > '9' || c < '0') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') k = k * 10 + c - '0', c = getchar();
  return k * f;
}
const int N = 500001;
int n, a, A, z, y, p[N], q[N], ans;
char s[N], t[N];
int main() {
  n = rd(), scanf("%s%s", s + 1, t + 1);
  for (int i = 1; i <= n; ++i) {
    if (s[i] == 'a' && t[i] == 'b') p[++z] = i;
    if (s[i] == 'b' && t[i] == 'a') q[++y] = i;
    a += (s[i] == 'a'), A += (t[i] == 'a');
  }
  if ((a + A) % 2 == 1) {
    puts("-1");
    return 0;
  }
  if (z % 2 == 1)
    ans = (z + y) / 2 + 1;
  else
    ans = (z + y) / 2;
  printf("%d\n", ans);
  if (z % 2 == 1) printf("%d %d\n%d %d\n", p[z], p[z], p[z], q[y]), --z, --y;
  for (int i = 1; i <= z; i += 2) printf("%d %d\n", p[i], p[i + 1]);
  for (int i = 1; i <= y; i += 2) printf("%d %d\n", q[i], q[i + 1]);
  return 0;
}
