#include <bits/stdc++.h>
using namespace std;
int n;
string s, t;
vector<int> p01, p10;
vector<pair<int, int> > res;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  cin >> s >> t;
  for (int i = 0; i < n; i++)
    if (s[i] == 'a' && t[i] == 'b')
      p01.push_back(i);
    else if (s[i] == 'b' && t[i] == 'a')
      p10.push_back(i);
  if ((int(p01.size()) + int(p10.size())) & 1) {
    cout << -1;
    return 0;
  }
  for (int i = 0; i + 1 < int(p01.size()); i += 2)
    res.push_back({p01[i], p01[i + 1]});
  for (int i = 0; i + 1 < int(p10.size()); i += 2)
    res.push_back({p10[i], p10[i + 1]});
  if (int(p10.size()) & 1) {
    res.push_back({p01.back(), p01.back()});
    res.push_back({p10.back(), p01.back()});
  }
  cout << int(res.size()) << '\n';
  for (int i = 0; i < int(res.size()); i++)
    cout << res[i].first + 1 << ' ' << res[i].second + 1 << '\n';
}
