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