#include <bits/stdc++.h>
using namespace std;
void show_trace() { cout << endl; }
template <typename Start, typename... Rem>
void show_trace(Start S, Rem... R) {
  cout << ' ' << S;
  show_trace(R...);
}
const int INFi = 2139062143;
const long long INF = 1e18;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  string s, t;
  cin >> s >> t;
  int ct1 = count(s.begin(), s.end(), 'a') + count(t.begin(), t.end(), 'a');
  int ct2 = count(s.begin(), s.end(), 'b') + count(t.begin(), t.end(), 'b');
  if (ct1 % 2 != 0 || ct2 % 2 != 0) {
    cout << -1 << '\n';
    return 0;
  }
  vector<int> ab, ba;
  for (int i = 0; i < n; i++) {
    if (s[i] == t[i]) continue;
    if (s[i] == 'a' && t[i] == 'b')
      ab.push_back(i);
    else
      ba.push_back(i);
  }
  int sz1 = ab.size();
  int sz2 = ba.size();
  vector<pair<int, int> > ans;
  for (int i = 1; i < sz1 - (sz1 % 2); i += 2) {
    ans.push_back({ab[i], ab[i - 1]});
  }
  for (int i = 1; i < sz2 - (sz2 % 2); i += 2) {
    ans.push_back({ba[i], ba[i - 1]});
  }
  assert(sz1 % 2 == sz2 % 2);
  if (sz1 % 2) {
    ans.push_back({ab[sz1 - 1], ab[sz1 - 1]});
    ans.push_back({ab[sz1 - 1], ba[sz2 - 1]});
  }
  cout << ans.size() << '\n';
  for (auto [x, y] : ans) cout << x + 1 << ' ' << y + 1 << '\n';
}
