#include <bits/stdc++.h>
using namespace std;
const int mod = 998244353;
const int N = 5e5 + 5;
int n, m;
char s[N], t[N];
vector<pair<int, int> > ans;
vector<int> l1, l2;
int main() {
  scanf("%d", &n);
  scanf("%s%s", s + 1, t + 1);
  int a = 0;
  for (int i = 1; i <= n; i++)
    a ^= (s[i] == 'a' ? 1 : 0), a ^= (t[i] == 'a' ? 1 : 0);
  if (a) return puts("-1"), 0;
  for (int i = 1; i <= n; i++) {
    if (s[i] == t[i]) continue;
    if (s[i] == 'a')
      l1.push_back(i);
    else
      l2.push_back(i);
  }
  int p = 0, q = 0;
  while (p + 1 < l1.size()) ans.push_back({l1[p], l1[p + 1]}), p += 2;
  while (q + 1 < l2.size()) ans.push_back({l2[q], l2[q + 1]}), q += 2;
  if (p < l1.size())
    ans.push_back({l1[p], l1[p]}), ans.push_back({l1[p], l2[q]});
  printf("%d\n", ans.size());
  for (auto t : ans) printf("%d %d\n", t.first, t.second);
  return 0;
}
