#include <bits/stdc++.h>
using namespace std;
char s[200010];
char t[200010];
int main() {
  int n;
  scanf("%d ", &n);
  fgets(s, 200010, stdin);
  fgets(t, 200010, stdin);
  queue<int> ab;
  queue<int> ba;
  for (int i = 0; i < n; i++) {
    if (s[i] == 'a' && t[i] == 'b') ab.push(i + 1);
    if (s[i] == 'b' && t[i] == 'a') ba.push(i + 1);
  }
  int AB = (int)ab.size();
  int BA = (int)ba.size();
  if (abs(AB - BA) % 2 == 1) {
    printf("-1\n");
    return 0;
  }
  printf("%d\n", AB / 2 + BA / 2 + (2 * (AB % 2)));
  if (AB % 2 == 1 && BA % 2 == 1) {
    printf("%d %d\n", ab.front(), ab.front());
    ba.push(ab.front());
    ab.pop();
  }
  while (!ab.empty()) {
    int cur = ab.front();
    ab.pop();
    printf("%d %d\n", cur, ab.front());
    ab.pop();
  }
  while (!ba.empty()) {
    int cur = ba.front();
    ba.pop();
    printf("%d %d\n", cur, ba.front());
    ba.pop();
  }
  return 0;
}
