#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  string s, t;
  cin >> s >> t;
  vector<int> v1, v2;
  for (int i = 0; i < 2 * n; i++) {
    if (i < n) {
      if (s[i] != t[i] && s[i] == 'b') {
        v1.push_back(i);
      }
    } else if (i >= n) {
      if (s[i - n] != t[i - n] && s[i - n] == 'a') {
        v2.push_back(i - n);
      }
    }
  }
  if ((v1.size() + v2.size()) % 2 == 1) {
    cout << "-1" << endl;
  } else {
    if (v1.size() % 2 == 0) {
      cout << (v1.size() + v2.size()) / 2 << endl;
      for (unsigned int i = 0; i < v1.size(); i++) {
        cout << v1[i] + 1 << " " << v1[i + 1] + 1 << endl;
        i++;
      }
      for (unsigned int i = 0; i < v2.size(); i++) {
        cout << v2[i] + 1 << " " << v2[i + 1] + 1 << endl;
        i++;
      }
    } else if (v1.size() % 2 == 1) {
      cout << (v1.size() + v2.size()) / 2 + 1 << endl;
      cout << v1[0] + 1 << " " << v1[0] + 1 << endl;
      cout << v1[0] + 1 << " " << v2[0] + 1 << endl;
      for (unsigned int i = 1; i < v1.size(); i++) {
        cout << v1[i] + 1 << " " << v1[i + 1] + 1 << endl;
        i++;
      }
      for (unsigned int i = 1; i < v2.size(); i++) {
        cout << v2[i] + 1 << " " << v2[i + 1] + 1 << endl;
        i++;
      }
    }
  }
}
