#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using pll = pair<ll, ll>;
using vll = vector<ll>;
using vpll = vector<pll>;
using gr = vector<vll>;
using wgr = vector<vpll>;
struct d_ {
  template <typename T>
  d_& operator,(const T& x) {
    cerr << ' ' << x;
    return *this;
  }
  template <typename T>
  d_& operator,(const vector<T>& x) {
    for (auto x : x) cerr << ' ' << x;
    return *this;
  }
} d_t;
int main(void) {
  ios_base::sync_with_stdio(false);
  ll n;
  cin >> n;
  string s, t;
  cin >> s >> t;
  vll first, second;
  for (ll i(0); i < n; i++)
    if (s[i] != t[i]) {
      if (s[i] == 'a')
        first.push_back(i);
      else
        second.push_back(i);
    }
  ll a = first.size(), b = second.size();
  if ((a + b) % 2 != 0) {
    cout << -1 << endl;
  } else {
    cout << a / 2 + b / 2 + 2 * (a % 2) << endl;
    for (ll i(0); i < a / 2; i++)
      cout << first[2 * i] + 1 << ' ' << first[2 * i + 1] + 1 << endl;
    for (ll i(0); i < b / 2; i++)
      cout << second[2 * i] + 1 << ' ' << second[2 * i + 1] + 1 << endl;
    if (a % 2) {
      cout << first[a - 1] + 1 << ' ' << first[a - 1] + 1 << endl;
      cout << first[a - 1] + 1 << ' ' << second[b - 1] + 1 << endl;
    }
  }
  return 0;
}
