#include <bits/stdc++.h>
using namespace std;
void solve(string s, string t, int n) {
  vector<int> pos01, pos10;
  int i;
  for (i = 0; i < n; i++) {
    if (s[i] != t[i]) {
      if (s[i] == 'a') {
        pos01.push_back(i);
      } else
        pos10.push_back(i);
    }
  }
  if (pos01.size() % 2 != pos10.size() % 2) {
    cout << -1;
    return;
  }
  vector<pair<int, int>> ans;
  for (i = 0; i + 1 < pos01.size(); i += 2) {
    ans.push_back(make_pair(pos01[i], pos01[i + 1]));
  }
  for (i = 0; i + 1 < pos10.size(); i += 2) {
    ans.push_back(make_pair(pos10[i], pos10[i + 1]));
  }
  if (pos01.size() % 2) {
    int x = pos01.back();
    int y = pos10.back();
    ans.push_back(make_pair(x, x));
    ans.push_back(make_pair(x, y));
  }
  cout << ans.size();
  cout << endl;
  for (i = 0; i < ans.size(); i++) {
    cout << ans[i].first + 1 << ' ' << ans[i].second + 1 << endl;
  }
}
int main() {
  int n;
  string s, t;
  cin >> n;
  cin >> s >> t;
  solve(s, t, n);
}
