#include <bits/stdc++.h>
using namespace std;
const long long N = 2000006, M = 10004, INF = 1e18, MOD = 1e9 + 7;
long long n, m, x, y, z, o, h, a[N], b[N], ans1, ans2, dp1[N], dp2[N];
vector<int> v[N];
pair<int, int> p[N];
string s, t;
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n >> s >> t;
  for (int i = 0; i < n; i++)
    if (s[i] == 'a' && t[i] == 'b')
      a[++x] = i + 1;
    else if (s[i] == 'b' && t[i] == 'a')
      b[++y] = i + 1;
  if ((x + y) % 2) {
    cout << -1;
    return 0;
  }
  cout << x / 2 + y / 2 + (x % 2) * 2 << endl;
  for (int i = 1; i < x; i += 2) cout << a[i] << " " << a[i + 1] << endl;
  for (int i = 1; i < y; i += 2) cout << b[i] << " " << b[i + 1] << endl;
  if (x % 2) cout << a[x] << " " << a[x] << endl << b[y] << " " << a[x] << endl;
  return 0;
}
