#include <bits/stdc++.h>
using namespace std;
const int maxn = 200500;
int n, m, k, t;
string s1, s2;
vector<int> a;
vector<int> b;
int main() {
  cin >> n;
  cin >> s1 >> s2;
  int sum = 0;
  for (int i = 0; i < n; i++) {
    if (s1[i] != s2[i]) {
      sum++;
      if (s1[i] == 'a')
        a.push_back(i + 1);
      else
        b.push_back(i + 1);
    }
  }
  if (sum % 2) {
    cout << "-1\n";
    return 0;
  }
  cout << a.size() / 2 + b.size() / 2 + a.size() % 2 + b.size() % 2 << endl;
  for (int i = 1; i < a.size(); i += 2) cout << a[i - 1] << " " << a[i] << endl;
  for (int i = 1; i < b.size(); i += 2) cout << b[i - 1] << " " << b[i] << endl;
  if (a.size() % 2)
    cout << a[a.size() - 1] << " " << a[a.size() - 1] << endl
         << a[a.size() - 1] << " " << b[b.size() - 1] << endl;
  return 0;
}
