#include <bits/stdc++.h>
using namespace std;
const long long N = 2e5 + 9, M = 2e5 + 9, OO = 0x3f3f3f3f, mod = 1e9 + 7;
long long n, aS, bS, aT, bT;
string s, t;
vector<long long> bMis, aMis;
int main() {
  cin >> n >> s >> t;
  for (auto i : s) {
    aS += (i == 'a');
    bS += (i == 'b');
  }
  for (auto i : t) {
    aT += (i == 'a');
    bT += (i == 'b');
  }
  if ((aS + aT) % 2) return cout << "-1", 0;
  if ((bS + bT) % 2) return cout << "-1", 0;
  for (int i = 0; i < n; ++i) {
    if (s[i] == 'b' and t[i] == 'a') bMis.push_back(i + 1);
    if (s[i] == 'a' and t[i] == 'b') aMis.push_back(i + 1);
  }
  long long nSwap = (bMis.size() / 2) + (aMis.size() / 2);
  if (bMis.size() % 2) nSwap += 2;
  cout << nSwap << "\n";
  for (int i = 0; i < bMis.size(); i += 2) {
    if (i == bMis.size() - 1) break;
    cout << bMis[i] << " " << bMis[i + 1] << "\n";
  }
  for (int i = 0; i < aMis.size(); i += 2) {
    if (i == aMis.size() - 1) break;
    cout << aMis[i] << " " << aMis[i + 1] << "\n";
  }
  if (bMis.size() % 2) {
    cout << aMis.back() << " " << aMis.back() << "\n";
    cout << aMis.back() << " " << bMis.back() << "\n";
  }
}
