#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n;
  cin >> n;
  string a, b;
  cin >> a >> b;
  int prevA = -1, prevB = -1;
  vector<pair<int, int>> ans;
  for (int i = 0; i < n; i++) {
    if (a[i] != b[i]) {
      if (a[i] == 'a') {
        if (prevA == -1) {
          prevA = i + 1;
        } else {
          ans.push_back({prevA, i + 1});
          prevA = -1;
        }
      } else {
        if (prevB == -1) {
          prevB = i + 1;
        } else {
          ans.push_back({prevB, i + 1});
          prevB = -1;
        }
      }
    }
  }
  if (prevA != -1 and prevB != -1) {
    ans.push_back({prevB, prevB});
    ans.push_back({prevB, prevA});
    prevA = -1, prevB = -1;
  }
  if (prevA != -1 or prevB != -1) {
    cout << -1;
  } else {
    cout << ans.size() << '\n';
    for (int i = 0; i < ans.size(); i++) {
      cout << ans[i].first << ' ';
      cout << ans[i].second << '\n';
    }
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  int t = 1;
  while (t--) {
    solve();
    cout << '\n';
  }
  return 0;
}
