#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
signed main() {
  ios ::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int n;
  cin >> n;
  string A, B;
  cin >> A >> B;
  vector<int> ab, ba;
  for (int i = 0; i < n; i++) {
    if (A[i] != B[i]) {
      if (A[i] == 'a')
        ab.push_back(i + 1);
      else
        ba.push_back(i + 1);
    }
  }
  int x = ab.size() % 2, y = ba.size() % 2;
  if (x ^ y) {
    cout << -1 << '\n';
    return 0;
  }
  cout << (ab.size() / 2) + (ba.size() / 2) + ((ab.size() % 2) * 2) << '\n';
  for (int i = 1; i < ab.size(); i += 2) {
    cout << ab[i - 1] << " " << ab[i] << '\n';
  }
  for (int i = 1; i < ba.size(); i += 2) {
    cout << ba[i - 1] << " " << ba[i] << '\n';
  }
  if (ab.size() % 2) {
    cout << ab.back() << " " << ab.back() << '\n';
    cout << ab.back() << " " << ba.back() << '\n';
  }
  return 0;
}
