#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long t;
  t = 1;
  while (t--) {
    long long n;
    cin >> n;
    string a, b;
    cin >> a >> b;
    vector<long long> v, v1;
    for (int i = 0; i < n; i++) {
      if (a[i] != b[i] && a[i] == 'a') v.push_back(i + 1);
      if (a[i] != b[i] && a[i] == 'b') v1.push_back(i + 1);
    }
    if (v.size() % 2 != v1.size() % 2) {
      cout << -1;
      return 0;
    }
    if (v.size() % 2 == 0) {
      cout << v.size() / 2 + v1.size() / 2 << "\n";
      if (v.size() >= 2) {
        for (int i = 0; i < v.size() - 1; i++) {
          cout << v[i] << " " << v[i + 1] << "\n";
          i++;
        }
      }
      if (v1.size() >= 2) {
        for (int i = 0; i < v1.size() - 1; i++) {
          cout << v1[i] << " " << v1[i + 1] << "\n";
          i++;
        }
      }
    } else {
      cout << v.size() / 2 + v1.size() / 2 + 2 << "\n";
      if (v.size() > 2) {
        for (int i = 0; i < v.size() - 2; i++) {
          cout << v[i] << " " << v[i + 1] << "\n";
          i++;
        }
      }
      if (v1.size() > 2) {
        for (int i = 0; i < v1.size() - 2; i++) {
          cout << v1[i] << " " << v1[i + 1] << "\n";
          i++;
        }
      }
      cout << v[v.size() - 1] << " " << v[v.size() - 1] << "\n";
      cout << v[v.size() - 1] << " " << v1[v1.size() - 1] << "\n";
    }
  }
}
