#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;
const long long LINF = (long long)1e18;
void test() {}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  string s1, s2;
  cin >> s1 >> s2;
  vector<int> wiktor;
  queue<int> firstType, secondType;
  for (int i = 0; i < n; i++) {
    if (s1[i] != s2[i]) {
      wiktor.push_back(i);
      if (s1[i] == 'a') {
        firstType.push(i + 1);
      } else {
        secondType.push(i + 1);
      }
    }
  }
  if (wiktor.size() % 2) {
    cout << -1;
    return 0;
  }
  int moves = 0;
  vector<pair<int, int> > ans;
  while (firstType.size() >= 2) {
    moves++;
    int x = firstType.front();
    firstType.pop();
    int y = firstType.front();
    firstType.pop();
    ans.push_back({x, y});
  }
  while (secondType.size() >= 2) {
    moves++;
    int x = secondType.front();
    secondType.pop();
    int y = secondType.front();
    secondType.pop();
    ans.push_back({x, y});
  }
  while (secondType.size() && firstType.size()) {
    moves += 2;
    int x = firstType.front();
    firstType.pop();
    ans.push_back({x, x});
    int y = secondType.front();
    secondType.pop();
    ans.push_back({x, y});
  }
  cout << moves << "\n";
  for (auto it : ans) cout << it.first << " " << it.second << "\n";
}
