#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1123456;
const int MAXINT = 2147483098;
const long long MAXLL = 9223372036854775258LL;
int cnt[MAXN];
set<int> a[2];
set<int> b[2];
string s, t;
int ka[2];
int kb[2];
vector<pair<int, int> > answer;
void printAnswer() {
  cout << answer.size() << '\n';
  for (int i = 0; i < answer.size(); ++i)
    cout << answer[i].first + 1 << " " << answer[i].second + 1 << '\n';
  exit(0);
}
vector<int> pos[3][3];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n;
  int sa = 0, sb = 0, ta = 0, tb = 0;
  cin >> n;
  cin >> s >> t;
  for (int i = 0; i < n; ++i) {
    cnt[s[i]]++;
  }
  for (int i = 0; i < n; ++i) {
    cnt[t[i]]++;
  }
  if (cnt['a'] % 2 || cnt['b'] % 2) return cout << -1, 0;
  for (int i = 0; i < n; ++i) {
    if (s[i] != t[i]) pos[s[i] - 'a'][t[i] - 'a'].push_back(i);
  }
  while (pos[0][1].size() > 1) {
    int p1 = pos[0][1].back(), p2;
    pos[0][1].pop_back();
    p2 = pos[0][1].back();
    pos[0][1].pop_back();
    answer.push_back({p1, p2});
  }
  while (pos[1][0].size() > 1) {
    int p1 = pos[1][0].back(), p2;
    pos[1][0].pop_back();
    p2 = pos[1][0].back();
    pos[1][0].pop_back();
    answer.push_back({p1, p2});
  }
  while (pos[1][0].size() > 0 && pos[0][1].size() > 0) {
    int p1 = pos[0][1].back();
    int p2 = pos[1][0].back();
    answer.push_back({p1, p1});
    answer.push_back({p1, p2});
    pos[0][1].pop_back();
    pos[1][0].pop_back();
  }
  if (pos[0][1].size() || pos[1][0].size()) return cout << -1, 0;
  printAnswer();
  return 0;
}
