#include <bits/stdc++.h>   using namespace std;   using ll = long long;   using ld = long double;   using ull = unsigned long long;   using db = double;   using str = string;   using pi = pair<int, int>;   using pl = pair<ll, ll>;   using pd = pair<db, db>;   using vi = vector<int>;   using vb = vector<bool>;   using vl = vector<ll>;   using vd = vector<db>;   using vs = vector<str>;   using vpi = vector<pi>;   using vpl = vector<pl>;   using vpd = vector<pd>;   template <class T>   using V = vector<T>;   template <class T, size_t SZ>   using AR = array<T, SZ>;   const int MOD = 1e9 + 7;   const ll INF = 1e18;   const ll infl = 1e18 + 5;   const int infi = 1e9 + 5;   const int xd[4] = {1, 0, -1, 0}, yd[4] = {0, 1, 0, -1};   mt19937 rng((uint32_t)chrono::steady_clock::now().time_since_epoch().count());   constexpr int pct(int x) { return __builtin_popcount(x); }   constexpr int bits(int x) { return 31 - __builtin_clz(x); }   ll cdiv(ll a, ll b) { return a / b + ((a ^ b) > 0 && a % b); }   ll fdiv(ll a, ll b) { return a / b - ((a ^ b) < 0 && a % b); }   template <class T>   bool ckmin(T& a, const T& b) {     return b < a ? a = b, 1 : 0;   }   template <class T>   bool ckmax(T& a, const T& b) {     return a < b ? a = b, 1 : 0;   }   template <class T, class U>   T fstTrue(T lo, T hi, U f) {     hi++;     assert(lo <= hi);     while (lo < hi) {       T mid = lo + (hi - lo) / 2;       f(mid) ? hi = mid : lo = mid + 1;     }     return lo;   }   template <class T, class U>   T lstTrue(T lo, T hi, U f) {     lo--;     assert(lo <= hi);     while (lo < hi) {       T mid = lo + (hi - lo + 1) / 2;       f(mid) ? lo = mid : hi = mid - 1;     }     return lo;   }   template <class T>   void remDup(vector<T>& v) {     sort(begin(v), end(v));     v.erase(unique(begin(v), end(v)), end(v));   }   template <class T, class U>   void erase(T& t, const U& u) {     auto it = t.find(u);     assert(it != end(t));     t.erase(u);   }   template <class T>   void re(T& x) {     cin >> x;   }   void re(db& d) {     str t;     re(t);     d = stod(t);   }   void re(ld& d) {     str t;     re(t);     d = stold(t);   }   template <class T, class... U>   void re(T& t, U&... u) {     re(t);     re(u...);   }   template <class T>   void re(complex<T>& c) {     T a, b;     re(a, b);     c = {a, b};   }   template <class T, class U>   void re(pair<T, U>& p) {     re(p.f, p.s);   }   template <class T>   void re(vector<T>& x) {     for (auto& a : x) re(a);   }   template <class T, size_t SZ>   void re(AR<T, SZ>& x) {     for (auto& a : x) re(a);   }   str to_string(char c) { return str(1, c); }   str to_string(const char* s) { return (str)s; }   str to_string(str s) { return s; }   str to_string(bool b) { return to_string((int)b); }   template <class T>   str to_string(complex<T> c) {     stringstream ss;     ss << c;     return ss.str();   }   str to_string(vector<bool> v) {     str res =  { ;     for (int i = (0); i < ((int)(v).size()); ++i) res += char( 0  + v[i]);     res +=  } ;     return res;   }   template <size_t SZ>   str to_string(bitset<SZ> b) {     str res =   ;     for (int i = (0); i < (SZ); ++i) res += char( 0  + b[i]);     return res;   }   template <class T>   str to_string(T v) {     bool fst = 1;     str res =   ;     for (const auto& x : v) {       if (!fst) res +=    ;       fst = 0;       res += to_string(x);     }     return res;   }   template <class T, class U>   str to_string(pair<T, U> p) {     return to_string(p.f) +     + to_string(p.s);   }   template <class T>   void pr(T x) {     cout << to_string(x);   }   template <class T, class... U>   void pr(const T& t, const U&... u) {     pr(t);     pr(u...);   }   void ps() { pr(  n ); }   template <class T, class... U>   void ps(const T& t, const U&... u) {     pr(t);     if (sizeof...(u)) pr(   );     ps(u...);   }   void pdbg(ll t) { cerr << t; }   void pdbg(int t) { cerr << t; }   void pdbg(str t) { cerr << t; }   void pdbg(char t) { cerr << t; }   void pdbg(ld t) { cerr << t; }   void pdbg(db t) { cerr << t; }   void pdbg(ull t) { cerr << t; }   template <class T, class V>   void pdbg(pair<T, V> p) {     cerr <<  { ;     pdbg(p.ff);     cerr <<  , ;     pdbg(p.ss);     cerr <<  } ;   }   template <class T>   void pdbg(vector<T> v) {     cerr <<  [  ;     for (T i : v) {       pdbg(i);       cerr <<    ;     }     cerr <<  ] ;   }   template <class T>   void pdbg(set<T> v) {     cerr <<  [  ;     for (T i : v) {       pdbg(i);       cerr <<    ;     }     cerr <<  ] ;   }   template <class T>   void pdbg(multiset<T> v) {     cerr <<  [  ;     for (T i : v) {       pdbg(i);       cerr <<    ;     }     cerr <<  ] ;   }   template <class T, class V>   void pdbg(map<T, V> v) {     cerr <<  [  ;     for (auto i : v) {       pdbg(i);       cerr <<    ;     }     cerr <<  ] ;   }   void solve() {     ll n;     re(n);     str s;     re(s);     str t;     re(t);     ll a1 = 0, b1 = 0;     ll a2 = 0, b2 = 0;     for (int i = (0); i < (n); ++i) {       if (s[i] ==  a ) {         a1 += 1;       } else {         b1 += 1;       }       if (t[i] ==  a ) {         a2 += 1;       } else {         b2 += 1;       }     }     if ((a1 + a2) % 2 == 0 && (b1 + b2) % 2 == 0) {       ll ans = 0;       ll ab = 0, ba = 0;       vl aa1;       vl aa2;       vl bb1;       vl bb2;       for (int i = (0); i < (n); ++i) {         if (s[i] ==  a  && t[i] ==  b ) {           ab += 1;           aa1.push_back(i + 1);           bb2.push_back(i + 1);         } else if (s[i] ==  b  && t[i] ==  a ) {           ba += 1;           bb1.push_back(i + 1);           aa2.push_back(i + 1);         }       }       ans += ab / 2;       ans += ba / 2;       if (ab % 2 == 1) {         ans += 2;       }       ps(ans);       if (aa1.size() != 0 || aa2.size() != 0) {         while (aa1.size() > 1) {           cout << aa1[aa1.size() - 1] <<     << bb2[aa1.size() - 2] << endl;           aa1.pop_back();           bb2.pop_back();           aa1.pop_back();           bb2.pop_back();         }         while (aa2.size() > 1) {           cout << aa2[aa2.size() - 1] <<     << bb1[aa2.size() - 2] << endl;           aa2.pop_back();           bb1.pop_back();           aa2.pop_back();           bb1.pop_back();         }         if (aa1.size() == 1) {           cout << aa1[0] <<     << bb2[0] << endl;           cout << aa1[0] <<     << bb1[0] << endl;           aa1.pop_back();           bb1.pop_back();           aa2.pop_back();           bb2.pop_back();         }       }     } else {       cout << -1;     }   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     ll T = 1;     for (int i = (0); i < (T); ++i) solve();     return 0;   }