#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
int n, p, q;
char s[N], t[N];
int x[N], y[N];
int main() {
  scanf("%d\n", &n);
  scanf("%s\n", s + 1);
  scanf("%s", t + 1);
  for (int i = 1; i <= n; i++) {
    if (s[i] == 'a' && t[i] == 'b') x[++p] = i;
    if (s[i] == 'b' && t[i] == 'a') y[++q] = i;
  }
  if ((p + q) % 2 == 1) {
    cout << -1;
  } else {
    if (p % 2 == 0)
      cout << (p + q) / 2 << "\n";
    else
      cout << (p + q) / 2 + 1 << "\n";
    while (p > 1) {
      cout << x[p - 1] << " " << x[p] << "\n";
      p -= 2;
    }
    while (q > 1) {
      cout << y[q - 1] << " " << y[q] << "\n";
      q -= 2;
    }
    if (p == 1) cout << x[1] << " " << x[1] << "\n" << x[1] << " " << y[1];
  }
}
