#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n;
  cin >> n;
  string a, b;
  cin >> a >> b;
  int aa = 0, bb = 0;
  for (auto k : a) (k == 'a' ? aa++ : bb++);
  for (auto k : b) (k == 'a' ? aa++ : bb++);
  if (aa & 1 || bb & 1) {
    cout << "-1";
    return;
  }
  queue<int> AB, BA;
  for (long long int i = 0; i < (long long int)n; i++) {
    if (a[i] != b[i]) {
      if (a[i] == 'a')
        AB.push(i);
      else
        BA.push(i);
    }
  }
  vector<pair<int, int>> ans;
  while (AB.size() > 1) {
    int x = AB.front();
    AB.pop();
    int y = AB.front();
    AB.pop();
    ans.push_back(make_pair(x, y));
  }
  while (BA.size() > 1) {
    int x = BA.front();
    BA.pop();
    int y = BA.front();
    BA.pop();
    ans.push_back(make_pair(x, y));
  }
  if (AB.size() == BA.size() && AB.size() == 1) {
    int x = AB.front();
    AB.pop();
    ans.push_back(make_pair(x, x));
    int y = BA.front();
    BA.pop();
    ans.push_back(make_pair(x, y));
  }
  cout << ans.size();
  cout << "\n";
  for (auto k : ans) cout << k.first + 1 << " " << k.second + 1 << "\n";
  return;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  long long int tests = 1;
  for (long long int test_case = 1; test_case <= tests; test_case++) {
    solve();
  }
  cerr << "Execution Time : " << (float)clock() / CLOCKS_PER_SEC << " secs"
       << endl;
  return 0;
}
