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