#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int MOD = 1e9 + 7;
const ll INF = 2e18;
const int maxn = 2e5 + 555;
int n;
string a, b;
int a1, a2, b1, b2;
int32_t main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> a >> b;
  for (auto &i : a) {
    a1 += (i == 'a');
    a2 += (i == 'b');
  }
  for (auto &i : b) {
    b1 += (i == 'a');
    b2 += (i == 'b');
  }
  if ((a1 + b1) % 2 || (a2 + b2) % 2) {
    cout << "-1" << endl;
  } else {
    vector<pair<int, int>> ans;
    vector<int> Va;
    vector<int> Vb;
    for (int i = 0; i < n; i++) {
      if (a[i] == b[i]) continue;
      if (a[i] == 'a') {
        if (!Va.empty()) {
          ans.push_back(make_pair(Va.back(), i));
          Va.pop_back();
        } else {
          Va.push_back(i);
        }
      } else {
        if (!Vb.empty()) {
          ans.push_back(make_pair(Vb.back(), i));
          Vb.pop_back();
        } else {
          Vb.push_back(i);
        }
      }
    }
    for (auto i : Va) {
      assert(!Vb.empty());
      ans.push_back(make_pair(i, i));
      ans.push_back(make_pair(i, Vb.back()));
      Vb.pop_back();
    }
    cout << ans.size() << endl;
    for (auto [a, b] : ans) {
      cout << a + 1 << ' ' << b + 1 << endl;
    }
  }
  return 0;
}
