#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  string a, b;
  cin >> n;
  cin >> a >> b;
  vector<int> az, bz;
  for (int i = 0; i < n; ++i) {
    if (a[i] != b[i]) {
      if (a[i] == 'b') {
        bz.push_back(i + 1);
      } else {
        az.push_back(i + 1);
      }
    }
  }
  int sa = az.size(), sb = bz.size();
  if ((sa % 2 == 0 && sb % 2 == 1) || (sa % 2 == 1 && sb % 2 == 0)) {
    cout << "-1";
    return 0;
  }
  if (sa % 2 == 1) {
    cout << sa / 2 + sb / 2 + 2 << endl;
  } else {
    cout << sa / 2 + sb / 2 << endl;
  }
  if (sa == 0 && sb == 0) return 0;
  for (int i = 0; i < sb - 1; i += 2) {
    cout << bz[i] << " " << bz[i + 1] << endl;
  }
  for (int i = 0; i < sa - 1; i += 2) {
    cout << az[i] << " " << az[i + 1] << endl;
  }
  if (sa % 2 == 1) {
    cout << az[sa - 1] << " " << az[sa - 1] << endl;
    cout << bz[sb - 1] << " " << az[sa - 1] << endl;
  }
  return 0;
}
