#include <bits/stdc++.h>
inline int read() {
  int f = 1, x = 0;
  char ch = getchar();
  while (!(ch >= '0' && ch <= '9')) {
    if (ch == '-') f *= -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return f * x;
}
int n, x, last[2], len, ans[200000 + 2][2];
void print() {
  printf("%d\n", len);
  for (int i = 1; i <= len; i++) printf("%d %d\n", ans[i][0], ans[i][1]);
}
char s[2][200000 + 2];
int main() {
  n = read();
  scanf("%s%s", s[0] + 1, s[1] + 1);
  len = 0;
  memset(last, -1, sizeof(last));
  for (int i = 1; i <= n; i++) {
    if (s[0][i] != s[1][i]) {
      x = s[0][i] - 'a';
      if (last[x] == -1)
        last[x] = i;
      else {
        len++;
        ans[len][0] = last[x], ans[len][1] = i;
        last[x] = -1;
      }
    }
  }
  if (last[0] == -1 && last[1] == -1)
    print();
  else if (last[0] != -1 && last[1] != -1) {
    len++, ans[len][0] = ans[len][1] = last[0];
    len++, ans[len][0] = last[0], ans[len][1] = last[1];
    print();
  } else
    printf("-1\n");
}
