#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long n;
  string s, t;
  cin >> n >> s >> t;
  stack<long long> a, b;
  for (long long i = 0; i < n; i++) {
    if (s[i] == 'a' && t[i] == 'b')
      a.push(i + 1);
    else if (s[i] == 'b' && t[i] == 'a')
      b.push(i + 1);
  }
  long long m = a.size() + b.size();
  if (m % 2) {
    cout << -1;
    return;
  }
  cout << m / 2 + a.size() % 2 << endl;
  while (a.size() > 1) {
    cout << a.top() << " ";
    a.pop();
    cout << a.top() << endl;
    a.pop();
  }
  while (b.size() > 1) {
    cout << b.top() << " ";
    b.pop();
    cout << b.top() << endl;
    b.pop();
  }
  if (a.size()) {
    cout << a.top() << " " << a.top() << endl;
    cout << a.top() << " " << b.top() << endl;
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long tt = 1;
  while (tt--) {
    solve();
    cout << endl;
  }
}
