#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, ab = -1, ba = -1;
  string s1;
  string s2;
  vector<pair<long long, long long>> res;
  cin >> n;
  cin >> s1;
  cin >> s2;
  for (long long i = 0; i < n; i++) {
    if (s1[i] != s2[i]) {
      if (s1[i] == 'a') {
        if (ab != -1) {
          res.push_back(make_pair(ab, i + 1));
          ab = -1;
        } else {
          ab = i + 1;
        }
      } else {
        if (ba != -1) {
          res.push_back(make_pair(ba, i + 1));
          ba = -1;
        } else {
          ba = i + 1;
        }
      }
    }
  }
  if (ab != -1 && ba == -1) {
    cout << -1 << endl;
  } else {
    if (ab == -1 && ba != -1) {
      cout << -1 << endl;
    } else {
      if (ab > -1 && ba > -1) {
        res.push_back(make_pair(ba, ba));
        res.push_back(make_pair(ab, ba));
      }
      cout << res.size() << endl;
      for (long long i = 0; i < res.size(); i++) {
        cout << res[i].first << " " << res[i].second << endl;
      }
    }
  }
  return 0;
}
