#include <bits/stdc++.h>
using namespace std;
int n;
string s, t;
vector<int> ab, ba;
vector<pair<int, int> > op;
int main() {
  cin >> n >> s >> t;
  for (int i = 0; i < n; i++) {
    if (s[i] != t[i]) {
      if (s[i] == 'a' && t[i] == 'b')
        ab.push_back(i);
      else
        ba.push_back(i);
    }
  }
  for (int i = 0; i + 1 < ab.size(); i += 2) {
    op.push_back(make_pair(ab[i], ab[i + 1]));
    swap(s[ab[i]], t[ab[i + 1]]);
  }
  for (int i = 0; i + 1 < ba.size(); i += 2) {
    op.push_back(make_pair(ba[i], ba[i + 1]));
    swap(s[ba[i]], t[ba[i + 1]]);
  }
  if (ab.size() % 2 && ba.size() % 2) {
    op.push_back(make_pair(ab.back(), ab.back()));
    op.push_back(make_pair(ab.back(), ba.back()));
  } else if (ab.size() % 2 || ba.size() % 2) {
    cout << -1;
    return 0;
  }
  cout << op.size() << '\n';
  for (int i = 0; i < op.size(); i++)
    cout << op[i].first + 1 << ' ' << op[i].second + 1 << '\n';
}
