#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  long long n;
  cin >> n;
  string s, t;
  cin >> s >> t;
  long long sa = 0, sb = 0, ta = 0, tb = 0;
  for (long long i = 0; i < n; i++) {
    if (s[i] == 'a')
      sa++;
    else
      sb++;
    if (t[i] == 'a')
      ta++;
    else
      tb++;
  }
  if ((ta + sa) % 2 == 1 || (tb + sb) % 2 == 1) return cout << -1, 0;
  vector<pair<long long, long long> > ans;
  vector<long long> va, vb;
  for (long long i = 0; i < n; i++) {
    if (s[i] != t[i]) {
      if (s[i] == 'a')
        va.push_back(i);
      else
        vb.push_back(i);
    }
  }
  {
    for (long long i = 0;
         i < (long long)va.size() && (long long)va.size() > i + 1; i += 2)
      ans.push_back(make_pair(va[i], va[i + 1]));
    for (long long i = 0;
         i < (long long)vb.size() && (long long)vb.size() > i + 1; i += 2)
      ans.push_back(make_pair(vb[i], vb[i + 1]));
  }
  if ((long long)va.size() % 2 == 1) {
    ans.push_back(
        make_pair(va[(long long)va.size() - 1], va[(long long)va.size() - 1]));
    ans.push_back(
        make_pair(va[(long long)va.size() - 1], vb[(long long)vb.size() - 1]));
  }
  cout << ans.size() << "\n";
  for (long long i = 0; i < (long long)ans.size(); i++)
    cout << ans[i].first + 1 << " " << ans[i].second + 1 << "\n";
  return 0;
}
