#include <bits/stdc++.h>
using namespace std;
const long long LINF = 0x3f3f3f3f3f3f3f3f;
const long long NLINF = 0xf7f7f7f7f7f7f7f7;
const int INF = 0x3f3f3f3f, NINF = 0xf7f7f7f7;
const int MOD1 = 1e9 + 7, MOD2 = 1e9 + 9;
const int N = 2e5 + 10;
vector<int> t1, t2;
char s[N], t[N];
int n;
int main() {
  scanf("%d %s %s", &n, s + 1, t + 1);
  for (int i = 1; i <= n; i++) {
    if (s[i] == 'a' && t[i] == 'b') t1.emplace_back(i);
    if (s[i] == 'b' && t[i] == 'a') t2.emplace_back(i);
  }
  vector<pair<int, int> > ans;
  if ((int)t1.size() % 2 && (int)t2.size() % 2)
    ans.emplace_back(t2.back(), t2.back()), t1.emplace_back(t2.back()),
        t2.pop_back();
  if ((int)t1.size() % 2 or (int) t2.size() % 2) printf("-1\n"), exit(0);
  for (int i = 0; i < (int)t1.size() - 1; i += 2)
    ans.emplace_back(t1[i], t1[i + 1]);
  for (int i = 0; i < (int)t2.size() - 1; i += 2)
    ans.emplace_back(t2[i], t2[i + 1]);
  printf("%d\n", (int)ans.size());
  for (auto &[x, y] : ans) printf("%d %d\n", x, y);
}
