#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0), cout.tie(0);
  int n;
  cin >> n;
  string second;
  string t;
  cin >> second;
  cin >> t;
  int a = 0, b = 0, t1 = 0, t2 = 0;
  for (int i = 0; i < second.length(); i++) {
    if (second[i] == 'a') a++;
    if (t[i] == 'a') a++;
    if (second[i] == 'b') b++;
    if (t[i] == 'b') b++;
    if (second[i] == 'a' && t[i] == 'b') t1++;
    if (second[i] == 'b' && t[i] == 'a') t2++;
  }
  if (a % 2 == 1 || b % 2 == 1)
    cout << -1;
  else {
    cout << t1 / 2 + t1 % 2 + t2 / 2 + t2 % 2 << endl;
    int pos1, pos2, k = 0, m = 0;
    for (int i = 0; i < second.length(); i++) {
      if (second[i] == 'a' && t[i] == 'b' && k == 1) {
        cout << i + 1 << " " << pos1 + 1 << endl;
        k = 0;
      } else if (second[i] == 'a' && t[i] == 'b') {
        pos1 = i;
        k = 1;
      }
      if (second[i] == 'b' && t[i] == 'a' && m == 1) {
        cout << i + 1 << " " << pos2 + 1 << endl;
        m = 0;
      } else if (second[i] == 'b' && t[i] == 'a') {
        pos2 = i;
        m = 1;
      }
    }
    if (k == 1) {
      cout << pos1 + 1 << " " << pos1 + 1 << endl;
      cout << pos1 + 1 << " " << pos2 + 1;
    }
  }
}
