#include <bits/stdc++.h>
using namespace std;
int visit[200001];
queue<int> q1, q2;
int main() {
  int n;
  cin >> n;
  int diff1 = 0, diff2 = 0;
  string a, b;
  cin >> a >> b;
  for (int i = 0; i < n; i++)
    if (a[i] != b[i]) {
      if (a[i] == 'a')
        visit[i] = 1, diff1++, q1.push(i + 1);
      else
        visit[i] = 2, diff2++, q2.push(i + 1);
    }
  int ans = 0;
  ans += diff1 / 2;
  diff1 %= 2;
  ans += diff2 / 2;
  diff2 %= 2;
  if (diff1 == diff2 && diff1 != 0)
    ans += 2;
  else if (diff1 != diff2)
    ans = -1;
  cout << ans << endl;
  if (ans != -1 && diff1 == diff2 && diff1 == 0) {
    while (!q1.empty()) {
      int t1 = q1.front();
      q1.pop();
      int t2 = q1.front();
      q1.pop();
      cout << t1 << ' ' << t2 << endl;
    }
    while (!q2.empty()) {
      int t1 = q2.front();
      q2.pop();
      int t2 = q2.front();
      q2.pop();
      cout << t1 << ' ' << t2 << endl;
    }
  } else if (ans != -1) {
    while (!q1.empty() && q1.size() > 1) {
      int t1 = q1.front();
      q1.pop();
      int t2 = q1.front();
      q1.pop();
      cout << t1 << ' ' << t2 << endl;
    }
    while (!q2.empty() && q2.size() > 1) {
      int t1 = q2.front();
      q2.pop();
      int t2 = q2.front();
      q2.pop();
      cout << t1 << ' ' << t2 << endl;
    }
    int t1 = q1.front();
    int t2 = q2.front();
    cout << t1 << ' ' << t1 << endl;
    cout << t1 << ' ' << t2 << endl;
  }
}
