#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const int maxn = 2e5 + 5;
vector<pair<int, int> > ans;
char s1[maxn], s2[maxn];
vector<int> a, b;
int main() {
  int n;
  cin >> n;
  cin >> s1 >> s2;
  for (int i = 0; i < n; i++) {
    if (s1[i] != s2[i]) {
      if (s1[i] == 'a')
        a.push_back(i + 1);
      else
        b.push_back(i + 1);
    }
  }
  if ((a.size() + b.size()) & 1)
    printf("-1\n");
  else {
    for (int i = 1; i < a.size(); i += 2) {
      int x = a[i - 1], y = a[i];
      ans.push_back(make_pair(y, x));
    }
    for (int i = 1; i < b.size(); i += 2) {
      int x = b[i - 1], y = b[i];
      ans.push_back(make_pair(y, x));
    }
    if (a.size() & 1) {
      int x = a[a.size() - 1], y = b[b.size() - 1];
      ans.push_back(make_pair(y, y));
      ans.push_back(make_pair(y, x));
    }
    printf("%d\n", ans.size());
    for (int i = 0; i < ans.size(); i++) {
      printf("%d %d\n", ans[i].first, ans[i].second);
    }
  }
  return 0;
}
