#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0);
  int n;
  cin >> n;
  string a, b;
  cin >> a >> b;
  int cnta = 0, cntb = 0;
  for (char c : a) {
    if (c == 'a')
      cnta++;
    else
      cntb++;
  }
  int cntta = 0, cnttb = 0;
  for (char c : b) {
    if (c == 'a')
      cntta++;
    else
      cnttb++;
  }
  if ((cnta + cntta) % 2 != 0 || (cntb + cnttb) % 2 != 0) {
    cout << -1 << "\n";
    return 0;
  }
  set<int> aind, bind;
  set<int> rep;
  vector<pair<int, int> > ans;
  for (int i = 0; i < n; i++) {
    if (a[i] != b[i]) {
      rep.insert(i);
      if (a[i] == 'a')
        aind.insert(i);
      else
        bind.insert(i);
    }
  }
  while (cnta != cntta) {
    if (cnta > cntta && aind.size() > 1) {
      int fr = *aind.begin();
      aind.erase(aind.begin());
      int se = *aind.begin();
      aind.erase(aind.begin());
      rep.erase(fr);
      rep.erase(se);
      cnta--;
      cntta++;
      cntb++;
      cnttb--;
      swap(a[fr], b[se]);
      ans.push_back({fr, se});
    } else if (cntb > cnttb && bind.size() > 1) {
      int fr = *bind.begin();
      bind.erase(bind.begin());
      int se = *bind.begin();
      bind.erase(bind.begin());
      rep.erase(fr);
      rep.erase(se);
      cntb--;
      cnttb++;
      cnta++;
      cntta--;
      swap(a[fr], b[se]);
      ans.push_back({fr, se});
    } else
      break;
  }
  while (rep.size()) {
    auto fr = *rep.begin();
    rep.erase(rep.begin());
    if (aind.size() && *aind.begin() == fr) {
      aind.erase(fr);
      if (aind.size()) {
        ans.push_back({fr, *aind.begin()});
        aind.erase(aind.begin());
        continue;
      }
      if (bind.empty()) {
        cout << -1 << "\n";
        return 0;
      }
      ans.push_back({fr, fr});
      ans.push_back({fr, *bind.begin()});
      aind.erase(fr);
      bind.erase(bind.begin());
    } else if (bind.size() && *bind.begin() == fr) {
      bind.erase(fr);
      if (bind.size()) {
        ans.push_back({fr, *bind.begin()});
        bind.erase(bind.begin());
        continue;
      }
      if (aind.empty()) {
        cout << " ["
             << "fr"
                ": "
             << (fr) << "] "
             << "\n";
        cout << -1 << "\n";
        return 0;
      }
      ans.push_back({fr, fr});
      ans.push_back({*aind.begin(), fr});
      aind.erase(aind.begin());
      bind.erase(fr);
    }
  }
  cout << ans.size() << "\n";
  for (auto x : ans) cout << x.first + 1 << " " << x.second + 1 << "\n";
  return 0;
}
