#include <bits/stdc++.h>
using namespace std;
int n;
vector<int> ab, ba;
vector<pair<int, int> > ans;
string s, t;
int32_t main() {
  cin >> n;
  s.resize(n);
  t.resize(n);
  char r;
  scanf("%c", &r);
  for (int i = 0; i < n; i++) scanf("%c", &s[i]);
  scanf("%c", &r);
  for (int i = 0; i < n; i++) scanf("%c", &t[i]);
  for (int i = 0; i < n; i++) {
    if (s[i] == 'a' && t[i] == 'b') ab.push_back(i);
    if (s[i] == 'b' && t[i] == 'a') ba.push_back(i);
  }
  if ((int)(ab.size() + ba.size()) % 2 == 1) return cout << -1 << endl, 0;
  while (ab.size() > 1) {
    ans.push_back({ab.back() + 1, ab[ab.size() - 2] + 1});
    ab.pop_back();
    ab.pop_back();
  }
  while (ba.size() > 1) {
    ans.push_back({ba.back() + 1, ba[ba.size() - 2] + 1});
    ba.pop_back();
    ba.pop_back();
  }
  if (ab.size()) {
    ans.push_back({ab.back() + 1, ab.back() + 1});
    ans.push_back({ab.back() + 1, ba.back() + 1});
  }
  cout << ans.size() << endl;
  for (auto p : ans) printf("%d %d\n", p.first, p.second);
  return 0;
}
