#include <bits/stdc++.h>
using namespace std;
vector<int> v[3];
int main() {
  int n;
  cin >> n;
  string s1, s2;
  cin >> s1 >> s2;
  int ans1 = 0, ans2 = 0;
  for (int i = 0; i < s1.size(); i++) {
    if (s1[i] == 'a') {
      ans1++;
    }
    if (s2[i] == 'a') {
      ans1++;
    }
    if (s1[i] == 'b') {
      ans2++;
    }
    if (s2[i] == 'b') {
      ans2++;
    }
  }
  if (s1 == s2) {
    cout << 0 << endl;
    return 0;
  }
  if (ans1 % 2 || ans2 % 2) {
    cout << -1 << endl;
    return 0;
  } else {
    s1 = " " + s1;
    s2 = " " + s2;
    for (int i = 1; i <= s1.size(); i++) {
      if (s1[i] == s2[i]) {
        continue;
      }
      if (s1[i] == 'a') {
        v[1].push_back(i);
        continue;
      } else {
        v[2].push_back(i);
      }
    }
    int ans = 0;
    int flag = 0;
    if (v[1].size() % 2) {
      flag = v[1].back();
      v[2].push_back(v[1].back());
      v[1].pop_back();
      ans++;
    }
    ans = ans + v[1].size() / 2 + v[2].size() / 2;
    cout << ans << endl;
    if (flag) cout << flag << " " << flag << endl;
    if (v[1].size() > 0)
      for (int i = 0; i < v[1].size() - 1; i += 2) {
        cout << v[1][i] << " " << v[1][i + 1] << endl;
      }
    if (v[2].size() > 0)
      for (int i = 0; i < v[2].size() - 1; i += 2) {
        cout << v[2][i] << " " << v[2][i + 1] << endl;
      }
  }
  return 0;
}
