#include <bits/stdc++.h>
using namespace std;
void solve() {
  int N;
  cin >> N;
  string s1, s2;
  cin >> s1 >> s2;
  int num_different = 0;
  vector<pair<bool, int>> differences;
  int num_s1_has_a = 0;
  int num_s1_has_b = 0;
  for (int i = 0; i < N; ++i) {
    if (s1[i] != s2[i]) {
      bool s1_has_a = (s1[i] == 'a');
      if (s1_has_a) {
        ++num_s1_has_a;
      } else {
        ++num_s1_has_b;
      }
      differences.push_back({s1_has_a, i});
    }
  }
  if ((num_s1_has_a + num_s1_has_b) % 2 != 0) {
    cout << -1 << endl;
    return;
  } else {
    sort(differences.begin(), differences.end());
    int answer = (num_s1_has_a + num_s1_has_b) / 2;
    if (num_s1_has_a % 2 != 0) {
      ++answer;
    }
    cout << answer << endl;
    for (int i = 0; i < differences.size(); i += 2) {
      if (differences[i].first != differences[i + 1].first) {
        cout << differences[i].second + 1 << " " << differences[i].second + 1
             << endl;
      }
      cout << differences[i].second + 1 << " " << differences[i + 1].second + 1
           << endl;
    }
  }
}
int main() { solve(); }
