#include <iostream>
#include <string>
#include <iomanip>

using namespace std;
void seq_map(char* s1, char* s2, int n, int* r, int* rn);
int swap_count(int* r, int n);

int main(){
    int n;
    do{
        cin>>n;
    }while((n<1)||(n>20000));
    char t[n];char s[n];
    cin>>t;
    cin>>s;
    string out[n];int swp = 0; int rn;
    int smap[n];
    seq_map(t,s,n,smap,&rn);
    for(int i=0;i<n;i++)
        for(int j=0;j<n;j++)
            if((smap[i] != 0)&&(smap[j] != 0))
                if((smap[i] == smap[j])&&(i != j)){
                        out[swp] = to_string(i+1)+" "+to_string(j+1);
                        swp++;
                        smap[i] = 0;smap[j] = 0;
                        rn--;
                        break;
                    }
        if(rn%2 != 0){
            cout<<"-1";
            return 0;
        }
        else if((rn != 0)&&(rn%2 ==0))
            for(int i=0;i<n;i++)
                for(int j=0;j<n;j++)
                    if((smap[i] != 0)&&(smap[j] != 0)&&(smap[i] != smap[j])){
                        out[swp] = to_string(i+1)+" "+to_string(i+1);
                        swp++;
                        out[swp] = to_string(i+1)+" "+to_string(j+1);
                        swp++;
                            smap[i] = 0;smap[j] = 0;
                        break;
                    }

    cout<<swp<<endl;
    for(int i=0;i<swp;i++)
        cout<<out[i]<<endl;
    return 0;
}

int swap_count(int* r, int n){
    int c = 0;
    for(int i=0;i<n;i++)
        if(r[i] == 0)
            c++;
    return (n-c);
}

void seq_map(char* s1, char* s2, int n, int* r, int* rn){
    *rn =0;
    for(int i=0;i<n;i++){
        if(s1[i] == s2[i]){
            r[i] = 0;
            continue;
        }

        if((s1[i] == 'a')&& (s2[i] == 'b')){
            r[i] = 1;
            *rn+=1;
            continue;
        }
        if((s1[i] == 'b')&& (s2[i] == 'a')){
            r[i] = 2;
            *rn+=1;
            continue;
        }
    }
}


#include <iostream>
#include <string>
#include <iomanip>

using namespace std;
void seq_map(char* s1, char* s2, int n, int* r, int* rn);
int swap_count(int* r, int n);

int main(){
    int n;
    do{
        cin>>n;
    }while((n<1)||(n>20000));
    char t[n];char s[n];
    cin>>t;
    cin>>s;
    string out[n];int swp = 0; int rn;
    int smap[n];
    seq_map(t,s,n,smap,&rn);
    for(int i=0;i<n;i++)
        for(int j=0;j<n;j++)
            if((smap[i] != 0)&&(smap[j] != 0))
                if((smap[i] == smap[j])&&(i != j)){
                        out[swp] = to_string(i+1)+" "+to_string(j+1);
                        swp++;
                        smap[i] = 0;smap[j] = 0;
                        rn-=2;
                        break;
                    }
        if(rn%2 != 0){
            cout<<"-1";
            return 0;
        }
        else if((rn == 2))
            for(int i=0;i<n;i++)
                for(int j=0;j<n;j++)
                    if((smap[i] != 0)&&(smap[j] != 0)&&(smap[i] != smap[j])){
                        out[swp] = to_string(i+1)+" "+to_string(i+1);
                        swp++;
                        out[swp] = to_string(i+1)+" "+to_string(j+1);
                        swp++;
                        smap[i] = 0;smap[j] = 0;

                        break;
                    }

    cout<<swp<<endl;
    for(int i=0;i<swp;i++)
        cout<<out[i]<<endl;
    return 0;
}

int swap_count(int* r, int n){
    int c = 0;
    for(int i=0;i<n;i++)
        if(r[i] == 0)
            c++;
    return (n-c);
}

void seq_map(char* s1, char* s2, int n, int* r, int* rn){
    *rn =0;
    for(int i=0;i<n;i++){
        if(s1[i] == s2[i]){
            r[i] = 0;
            continue;
        }

        if((s1[i] == 'a')&& (s2[i] == 'b')){
            r[i] = 1;
            *rn+=1;
            continue;
        }
        if((s1[i] == 'b')&& (s2[i] == 'a')){
            r[i] = 2;
            *rn+=1;
            continue;
        }
    }
}


#include <bits/stdc++.h>

using namespace std;

void parse(const string s, const int n, int* p_r, int* p_l, int* diff);
bool monocarp(int* p_r, int* p_l, int* diff);
bool binocarp(int* p_r, int* p_l, int* diff);

int main(){
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n,i=0;
    string s;
    cin>>n;
    cin>>s;

    int p_r = 0, p_l = 0, diff = 0;
    parse(s, n, &p_r, &p_l, &diff);

    //int p_r = 3, p_l = 1, diff = 9;
    bool mono_wins = monocarp(&p_r, &p_l, &diff);
    cout<<(mono_wins?"Monocarp":"Bicarp");
    return 0;
}

void parse(string s, int n, int* p_r, int* p_l, int* diff){
    for(int i=0;i<n;i++){
        if(i<(n/2)){
            if(s[i] == '?') (*p_l)++;
            else if((s[i] < 58)&&(s[i] > 47)) *diff+=s[i]-48;
        }
        else{
            if(s[i] == '?') (*p_r)++;
            else if((s[i] < 58)&&(s[i] > 47)) *diff-=s[i]-48;
        }
    }
}
bool monocarp(int* p_r, int* p_l, int* diff){
    if((*diff != 0) && (*p_r == 0) && (*p_l == 0))
        return true;
    else if((*diff == 0) && (*p_r == *p_l))
        return false;
    else {
        if((*p_l < *p_r) && (*p_l != 0) && (*p_r != 0)){
            (*p_l)--;
            if(*diff > 0)*diff+=9;
        }
        else if((*p_l > *p_r) && (*p_l != 0) && (*p_r != 0)){
            (*p_r)--;
            if(*diff<0)*diff-=9;
        }
        else if(*p_r == 0){
            (*p_l)--;
            if(*diff>0)*diff+=9;
        }
        else if(*p_l == 0){
            (*p_r)--;
            if(*diff<0)*diff-=9;
        }
    }
    return binocarp(p_r, p_l, diff);
}

bool binocarp(int* p_r, int* p_l, int* diff){
    if((*diff > 0) && (*diff < 10)){
        if(*p_r != 0){
            (*p_r)--;
            *diff = 0;
        }
        else
            return true;
    }
    else if (diff == 0){
        if(*p_l < *p_r) *p_r--;
        else (*p_l)--;
    }
    else if((*diff < 0) && (*diff > - 10)){
        if(*p_l != 0){
            (*p_l)--;
            *diff = 0;
        }
        else
            return true;
    }
    else if(*diff > 9){
        if(*p_r != 0){
            (*p_r)--;
            *diff -= 9;
        }
        else
            return true;
    }
    else{
        if(*p_l != 0){
            (*p_l)--;
            *diff += 9;
        }
        else
            return true;
    }
    return monocarp(p_r, p_l, diff);
}


#include <iostream>
#include <string>
#include <iomanip>

using namespace std;
bool check_seq(char* seq1, char* seq2, int n);
void seq_map(char* s1, char* s2, int n, int* r);
int swap_count(int* r, int n);

int main(){
    int n;
    do{
        cin>>n;
    }while((n<1)||(n>20000));
    char t[n];char s[n];
    cin>>t;
    cin>>s;
        string out[n];int swp = 0;
        int smap[n];
        seq_map(t,s,n,smap);
        for(int i=0;i<n;i++)
            for(int j=0;j<n;j++)
                if((smap[i] != 0)&&(smap[j] != 0))
                    if((smap[i] == smap[j])&&(i != j)){
                            out[swp] = to_string(i+1)+" "+to_string(j+1);
                            swp++;
                            smap[i] = 0;smap[j] = 0;
                            break;
                    }
        int tmp = (swap_count(smap,n);
        if(tmp%2 != 0){
            cout<<"-1";
            return 0;
        }
        if(tmp != 0)&&(tmp%2 ==0))
            for(int i=0;i<n;i++)
                for(int j=0;j<n;j++)
                    if((smap[i] != 0)&&(smap[j] != 0)&&(smap[i] != smap[j])){
                        out[swp] = to_string(i+1)+" "+to_string(i+1);
                        swp++;
                        out[swp] = to_string(i+1)+" "+to_string(j+1);
                        swp++;
                            smap[i] = 0;smap[j] = 0;
                    }

        cout<<swp<<endl;
        for(int i=0;i<swp;i++)
            cout<<out[i]<<endl;

    return 0;
}

bool check_seq(char* seq1, char* seq2, int n){
    int a = 0;
    int b = 0;
    for(int i=0;i<n;i++){
        if(seq1[i] == 'a')
            a++;
        if(seq1[i] == 'b')
            b++;
        if(seq1[i] == 'a')
            a++;
        if(seq2[i] == 'b')
            b++;
    }
    return ((a%2 == 0)&&(b%2 == 0));
}

int swap_count(int* r, int n){
    int c = 0;
    for(int i=0;i<n;i++)
        if(r[i] == 0)
            c++;
    return (n-c);
}

void seq_map(char* s1, char* s2, int n, int* r){
    for(int i=0;i<n;i++){
        if(s1[i] == s2[i])
            r[i] = 0;
        if((s1[i] == 'a')&& (s2[i] == 'b'))
            r[i] = 1;
        if((s1[i] == 'b')&& (s2[i] == 'a'))
            r[i] = 2;
    }
}


#include <iostream>
#include <string>

using namespace std;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n,i;
    cin>>n;
    string s,t;
    cin>>t;
    cin>>s;
    bool swp;

    int ab[n];
    int _ab = 0;
    int ba[n];
    int _ba = 0;

    for(i=0;i<n;i++){
        if((s[i] == 'a') && (t[i] == 'b'))
            ab[_ab++] = i+1;
        else if((s[i] == 'b') && (t[i] == 'a'))
            ba[_ba++] = i+1;
    }
    if((_ab + _ba)%2 != 0){
        cout<<"-1";
        return 0;
    }
    if((_ab%2 == 0)&&(_ba%2 == 0)){cout<<(_ab+_ba)/2<<endl;}
    else {cout<<((_ab+_ba)/2)+1<<endl;}
    i = 0;
    if(_ab%2 == 0) {
        swp = false;
        while(i<_ab){
            cout<<ab[i]<<" "<<ab[i+1]<<endl;
            i+=2;
        }
    }
    else {
        swp = true;
        while(i<_ab-1){
            cout<<ab[i]<<" "<<ab[i+1]<<endl;
            i+=2;
        }
    }
    i = 0;
    if(_ba%2 == 0) {
        while(i<_ba){
            cout<<ba[i]<<" "<<ba[i+1]<<endl;
            i+=2;
        }
    }
    else {
        while(i<_ba-1){
            cout<<ba[i]<<" "<<ba[i+1]<<endl;
            i+=2;
        }
    }
    if(swp){
        cout<<ba[_ba-1]<<" "<<ba[_ba-1]<<endl;
        cout<<ab[_ab-1]<<" "<<ba[_ba-1]<<endl;
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;
void seq_map(char* s1, char* s2, int n, int* r, int* rn);
int swap_count(int* r, int n);

int main(){

    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n;
    cin>>n;
    string s,t;
    cin>>t;
    cin>>s;
    string out[n];int swp = 0; int rn;
    int smap[n];
    seq_map(t,s,n,smap,&rn);
    for(int i=0;i<n;i++)
        for(int j=0;j<n;j++)
            if((smap[i] != 0)&&(smap[j] != 0))
                if((smap[i] == smap[j])&&(i != j)){
                        out[swp] = to_string(i+1)+" "+to_string(j+1);
                        swp++;
                        smap[i] = 0;smap[j] = 0;
                        rn-=2;
                        break;
                    }
        if(rn%2 != 0){
            cout<<"-1";
            return 0;
        }
        else if((rn == 2))
            for(int i=0;i<n;i++)
                for(int j=0;j<n;j++)
                    if((smap[i] != 0)&&(smap[j] != 0)&&(smap[i] != smap[j])){
                        out[swp] = to_string(i+1)+" "+to_string(i+1);
                        swp++;
                        out[swp] = to_string(i+1)+" "+to_string(j+1);
                        swp++;
                        smap[i] = 0;smap[j] = 0;

                        break;
                    }

    cout<<swp<<endl;
    for(int i=0;i<swp;i++)
        cout<<out[i]<<endl;
    return 0;
}

int swap_count(int* r, int n){
    int c = 0;
    for(int i=0;i<n;i++)
        if(r[i] == 0)
            c++;
    return (n-c);
}

void seq_map(char* s1, char* s2, int n, int* r, int* rn){
    *rn =0;
    for(int i=0;i<n;i++){
        if(s1[i] == s2[i]){
            r[i] = 0;
            continue;
        }

        if((s1[i] == 'a')&& (s2[i] == 'b')){
            r[i] = 1;
            *rn+=1;
            continue;
        }
        if((s1[i] == 'b')&& (s2[i] == 'a')){
            r[i] = 2;
            *rn+=1;
            continue;
        }
    }
}


#include <iostream>
#include <string>

using namespace std;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n,i;
    cin>>n;
    string s,t;
    cin>>t;
    cin>>s;
    bool swp;

    int ab[n];
    int _ab = 0;
    int ba[n];
    int _ba = 0;

    for(i=0;i<n;i++){
        if((s[i] == 'a') && (t[i] == 'b'))
            ab[_ab++] = i+1;
        else if((s[i] == 'b') && (t[i] == 'a'))
            ba[_ba++] = i+1;
    }
    if(_ab != _ba){
        cout<<"-1";
        return 0;
    }
    if(_ab%2 == 0){cout<<_ab<<endl;}
    else {cout<<_ab+1<<endl;}
    i = 0;
    if(_ab%2 == 0) {
        swp = false;
        while(i<_ab){
            cout<<ab[i]<<" "<<ab[i+1]<<endl;
            i+=2;
        }
    }
    else {
        swp = true;
        while(i<_ab-1){
            cout<<ab[i]<<" "<<ab[i+1]<<endl;
            i+=2;
        }
    }
    i = 0;
    if(_ba%2 == 0) {
        while(i<_ba){
            cout<<ba[i]<<" "<<ba[i+1]<<endl;
            i+=2;
        }
    }
    else {
        while(i<_ba-1){
            cout<<ba[i]<<" "<<ba[i+1]<<endl;
            i+=2;
        }
    }
    if(swp){
        cout<<ba[_ba-1]<<" "<<ba[_ba-1]<<endl;
        cout<<ab[_ab-1]<<" "<<ba[_ba-1]<<endl;
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define pb push_back
#define mp make_pair

#define f first
#define s second

typedef long long int ll;
typedef long double ld;

const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f;

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);

	int n; cin >> n;

	int a = 0, b = 0;

	vector<int> va, vb;
	vector<pair<int,int>> v;
	string s, z;
	cin >> s >> z;

	for (int i = 0; i < n; i++)
	{
		if(s[i] == 'a')a++;
		else b++;

		if(z[i] == 'a')a++;
		else b++;

		if(s[i] != z[i]){
			if(s[i] == 'a')
				va.pb(i+1);
			else
				vb.pb(i+1);
		}
	}

	if(a%2 == 0 and b%2 == 0){
		if(va.size() == 1){
			v.pb(mp(va[0], va[0]));
			v.pb(mp(va[0], vb[0]));

			for (int i = 2; i < int(vb.size()); i+=2)
			{
				v.pb(mp(vb[i-1], vb[i]));
			}
		}else{
			for (int i = 1; i < int(va.size()); i+=2)
			{
				v.pb(mp(va[i-1], va[i]));
			}

			for (int i = 1; i < int(vb.size()); i+=2)
			{
				v.pb(mp(vb[i-1], vb[i]));
			}
		}
	}else{
		cout << -1 << endl;
	}

	if(int(v.size())>0){
		cout << (int)v.size() << "\n";
		for (int i = 0; i < int(v.size()); i++)
		{
			cout << v[i].f << " " << v[i].s << endl;
		}
	}

}


#include <bits/stdc++.h>
using namespace std;

#define pb push_back
#define mp make_pair

#define f first
#define s second

typedef long long int ll;
typedef long double ld;

const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f;

int main(){
	int n;
	scanf("%d", &n);

	int a = 0, b = 0;

	vector<int> va, vb;
	vector<pair<int,int>> v;
	char s[n], z[n];
	scanf("%s", s);
	scanf("%s", z);
	for (int i = 0; i < n; i++)
	{
		if(s[i] == 'a')a++;
		else b++;

		if(z[i] == 'a')a++;
		else b++;

		if(s[i] != z[i]){
			if(s[i] == 'a')
				va.pb(i+1);
			else
				vb.pb(i+1);
		}
	}

	int k = 0;

	if(a%2 == 0 and b%2 == 0){
		for (int i = 1; i < int(va.size()); i+=2)
		{
			v.pb(mp(va[i-1], va[i]));
		}

		for (int i = 1; i < int(vb.size()); i+=2)
		{
			v.pb(mp(vb[i-1], vb[i]));
		}

		if(int(va.size())%2){
			int x = va.back();
			int y = vb.back();
			v.pb(mp(x,x));
			v.pb(mp(x,y));
		}
	}else{
		k = -1;
	}

	if(k == 0){
		k = (int) v.size();
		printf("%d\n", k);
		for (int i = 0; i < int(v.size()); i++)
		{
			printf("%d %d\n", v[i].f, v[i].s);
		}
	}else{
		printf("%d\n", k);
	}
}


#include <bits/stdc++.h>
using namespace std;

#define pb push_back
#define mp make_pair

#define f first
#define s second

typedef long long int ll;
typedef long double ld;

const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f;

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);

	int n; cin >> n;

	int a = 0, b = 0;

	vector<int> va, vb;
	vector<pair<int,int>> v;
	string s, z;
	cin >> s >> z;

	for (int i = 0; i < n; i++)
	{
		if(s[i] == 'a')a++;
		else b++;

		if(z[i] == 'a')a++;
		else b++;

		if(s[i] != z[i]){
			if(s[i] == 'a')
				va.pb(i+1);
			else
				vb.pb(i+1);
		}
	}

	int k = 0;

	if(a%2 == 0 and b%2 == 0){
		if(va.size() == 1){
			v.pb(mp(va[0], va[0]));
			v.pb(mp(va[0], vb[0]));

			for (int i = 2; i < int(vb.size()); i+=2)
			{
				v.pb(mp(vb[i-1], vb[i]));
			}
		}else{
			for (int i = 1; i < int(va.size()); i+=2)
			{
				v.pb(mp(va[i-1], va[i]));
			}

			for (int i = 1; i < int(vb.size()); i+=2)
			{
				v.pb(mp(vb[i-1], vb[i]));
			}
		}
	}else{
		k = -1;
		cout << k << endl;
	}

	if(k == 0){
		k = (int) v.size();
		cout << k << endl;
		for (int i = 0; i < int(v.size()); i++)
		{
			cout << v[i].f << " " << v[i].s << endl;
		}
	}

}


#include <bits/stdc++.h>
using namespace std;

#define pb push_back
#define mp make_pair

#define f first
#define s second

typedef long long int ll;
typedef long double ld;

const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f;

int main(){
	int n;
	scanf("%d", &n);

	int a = 0, b = 0;

	vector<int> va, vb;
	vector<pair<int,int>> v;
	char s[n], z[n];
	scanf("%s", s);
	scanf("%s", z);
	for (int i = 0; i < n; i++)
	{
		if(s[i] == 'a')a++;
		else b++;

		if(z[i] == 'a')a++;
		else b++;

		if(s[i] != z[i]){
			if(s[i] == 'a')
				va.pb(i+1);
			else
				vb.pb(i+1);
		}
	}

	int k = 0;

	if(a%2 == 0 and b%2 == 0){
		for (int i = 0; i + 1 < int(va.size()); i+=2)
		{
			v.pb(mp(va[i-1], va[i]));
		}

		for (int i = 0; i + 1 < int(vb.size()); i+=2)
		{
			v.pb(mp(vb[i-1], vb[i]));
		}

		if(int(va.size())%2){
			int x = va.back();
			int y = vb.back();
			v.pb(mp(x,x));
			v.pb(mp(x,y));
		}
	}else{
		k = -1;
	}

	if(k == 0){
		k = (int) v.size();
		printf("%d\n", k);
		for (int i = 0; i < int(v.size()); i++)
		{
			printf("%d %d\n", v[i].f, v[i].s);
		}
	}else{
		printf("%d\n", k);
	}
}


/*
 *	date: 11/04/20
 * 	exercise: https://codeforces.com/contest/1215/problem/C?mobile=true
 */

#include <bits/stdc++.h>
using namespace std;

#define pb push_back
#define mp make_pair

#define f first
#define s second

typedef long long int ll;
typedef long double ld;

const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f;

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);

	vector<int> va;
	vector<int> vb;

	int n; cin >> n;

	int as = 0, bs = 0, az = 0, bz = 0;

	string s, z;
	cin >> s >> z;

	for (int i = 0; i < n; i++)
	{
		if(s[i] == 'a')as++;
		else bs++;

		if(z[i] == 'a')az++;
		else bz++;

		if(s[i] != z[i]){
			if(s[i] == 'a')
				va.pb(i+1);
			else
				vb.pb(i+1);
		}
	}

	if((bs + bz == as + az) and (as + az)%2 == 0)
	{
		if (va.size() > 2 or vb.size() > 2)
		{
			cout << int(va.size())/2 + int(vb.size())/2 << "\n";

			for (int i = 0; i < int(va.size()); i+=2)
			{
				cout << va[i] << " " << va[i+1] << "\n";
			}

			for (int i = 0; i < int(vb.size()); i+=2)
			{
				cout << vb[i] << " " << vb[i+1] << "\n";
			}

		}else if (va.size() == 1 or vb.size() == 1){
			cout << 2 << "\n";
			cout << va[0] << " " << va[0] << "\n";
			cout << va[0] << " " << vb[0] << "\n";
		}else{
			cout << 1 << "\n";
			cout << 1 << " " << 2 << "\n";
		}
	}
	else
	{
		cout << -1 << "\n";
	}
}


#include <bits/stdc++.h>
using namespace std;

#define pb push_back
#define mp make_pair

#define f first
#define s second

typedef long long int ll;
typedef long double ld;

const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f;

int main(){
	int n;
	scanf("%d", &n);

	int a = 0, b = 0;

	vector<int> va, vb;
	vector<pair<int,int>> v;
	char s[n], z[n];
	scanf("%s", s);
	scanf("%s", z);
	for (int i = 0; i < n; i++)
	{
		if(s[i] == 'a')a++;
		else b++;

		if(z[i] == 'a')a++;
		else b++;

		if(s[i] != z[i]){
			if(s[i] == 'a')
				va.pb(i+1);
			else
				vb.pb(i+1);
		}
	}

	int k = 0;

	if(a%2 == 0 and b%2 == 0){
		if(va.size()%2){
			v.pb(mp(va[0], va[0]));
			v.pb(mp(va[0], vb[0]));

			for (int i = 2; i < int(va.size()); i+=2)
			{
				v.pb(mp(va[i-1], va[i]));
			}

			for (int i = 2; i < int(vb.size()); i+=2)
			{
				v.pb(mp(vb[i-1], vb[i]));
			}
		}else{
			for (int i = 1; i < int(va.size()); i+=2)
			{
				v.pb(mp(va[i-1], va[i]));
			}

			for (int i = 1; i < int(vb.size()); i+=2)
			{
				v.pb(mp(vb[i-1], vb[i]));
			}
		}
	}else{
		k = -1;
	}

	if(k == 0){
		k = (int) v.size();
		printf("%d\n", k);
		for (int i = 0; i < int(v.size()); i++)
		{
			printf("%d %d\n", v[i].f, v[i].s);
		}
	}else{
		printf("%d\n", k);
	}
}


/*
 *	date: 11/04/20
 * 	exercise: https://codeforces.com/contest/1215/problem/C?mobile=true
 */

#include <bits/stdc++.h>
using namespace std;

#define pb push_back
#define mp make_pair

#define f first
#define s second

typedef long long int ll;
typedef long double ld;

const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f;

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);

	vector<int> va;
	vector<int> vb;

	int n; cin >> n;

	int as = 0, bs = 0, az = 0, bz = 0;

	string s, z;
	cin >> s >> z;

	for (int i = 0; i < n; i++)
	{
		if(s[i] == 'a')as++;
		else bs++;

		if(z[i] == 'a')az++;
		else bz++;

		if(s[i] != z[i]){
			if(s[i] == 'a')
				va.pb(i+1);
			else
				vb.pb(i+1);
		}
	}

	if((bs + bz == as + az) and (as + az)%2 == 0)
	{
		if (va.size() > 2 or vb.size() > 2)
		{
			cout << int(va.size())/2 + int(vb.size())/2 << "\n";

			for (int i = 0; i < int(va.size()); i+=2)
			{
				cout << va[i] << " " << va[i+1] << "\n";
			}

			for (int i = 0; i < int(vb.size()); i+=2)
			{
				cout << vb[i] << " " << vb[i+1] << "\n";
			}

		}else if (va.size() == 1 or vb.size() == 1){
			cout << 2 << "\n";
			cout << va[0] << " " << va[0] << "\n";
			cout << va[0] << " " << vb[0] << "\n";
		}else{
			cout << 1 << "\n";
			cout << 1 << " " << 2 << "\n";
		}
	}
	else if(s == z)
	{
		cout << 0 << "\n";
	}else{
		cout << -1 << "\n";
	}
}


#include <bits/stdc++.h>
using namespace std;

#define pb push_back
#define mp make_pair

#define f first
#define s second

typedef long long int ll;
typedef long double ld;

const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f;

int main(){
	int n;
	scanf("%d", &n);

	int a = 0, b = 0;

	vector<int> va, vb;
	vector<pair<int,int>> v;
	char s[n], z[n];
	scanf("%s", s);
	scanf("%s", z);
	for (int i = 0; i < n; i++)
	{
		if(s[i] == 'a')a++;
		else b++;

		if(z[i] == 'a')a++;
		else b++;

		if(s[i] != z[i]){
			if(s[i] == 'a')
				va.pb(i+1);
			else
				vb.pb(i+1);
		}
	}

	int k = 0;

	if(a%2 == 0 and b%2 == 0){
		if(va.size() == 1){
			v.pb(mp(va[0], va[0]));
			v.pb(mp(va[0], vb[0]));

			for (int i = 2; i < int(vb.size()); i+=2)
			{
				v.pb(mp(vb[i-1], vb[i]));
			}
		}else{
			for (int i = 1; i < int(va.size()); i+=2)
			{
				v.pb(mp(va[i-1], va[i]));
			}

			for (int i = 1; i < int(vb.size()); i+=2)
			{
				v.pb(mp(vb[i-1], vb[i]));
			}
		}
	}else{
		k = -1;
	}

	if(k == 0){
		k = (int) v.size();
		printf("%d\n", k);
		for (int i = 0; i < int(v.size()); i++)
		{
			printf("%d %d\n", v[i].f, v[i].s);
		}
	}else{
		printf("%d\n", k);
	}
}


#include <bits/stdc++.h>
using namespace std;

#define pb push_back
#define mp make_pair

#define f first
#define s second

typedef long long int ll;
typedef long double ld;

const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f;

int main(){
	int n; cin >> n;

	string s, z;
	cin >> s >> z;

	int a, b;
	vector<int> ap, bp;

	for (int i = 0; i < n; i++)
	{
		if(s[i] == 'a')a++;
		else b++;

		if(z[i] == 'a')a++;
		else b++;

		if(s[i] != z[i]){
			if(s[i] == 'a')
				ap.pb(i+1);
			else
				bp.pb(i+1);
		}
	}

	vector<pair<int,int>> ans;

	if((a%2 == b%2) and (b%2 == 0)){
		int sa = ap.size(), sb = bp.size();

		for (int i = 0; i + 1 < sa; i+=2)
		{
			ans.pb(mp(ap[i], ap[i+1]));
		}

		for (int i = 0; i + 1 < sb; i+=2)
		{
			ans.pb(mp(bp[i], bp[i+1]));
		}

		if(ap.size()%2){
			int l = ap[sa-1];
			int r = bp[sb-1];

			ans.pb(mp(l, l));
			ans.pb(mp(l, r));
		}

		int k = ans.size();
		cout << k << endl;

		for (int i = 0; i < k; i++)
		{
			cout << ans[i].f << " " << ans[i].s << endl;
		}

	} else {
		cout << -1 << endl;
	}
}


#include <bits/stdc++.h>
using namespace std;

#define pb push_back
#define mp make_pair

#define f first
#define s second

typedef long long int ll;
typedef long double ld;

const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f;

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);

	int n; cin >> n;

	int a = 0, b = 0;

	vector<int> va, vb;
	vector<pair<int,int>> v;
	string s, z;
	cin >> s >> z;

	for (int i = 0; i < n; i++)
	{
		if(s[i] == 'a')a++;
		else b++;

		if(z[i] == 'a')a++;
		else b++;

		if(s[i] != z[i]){
			if(s[i] == 'a')
				va.pb(i+1);
			else
				vb.pb(i+1);
		}
	}

	int k = 0;

	if(a%2 == 0 and b%2 == 0){
		if(va.size() == 1){
			k += 2;
			v.pb(mp(va[0], va[0]));
			v.pb(mp(va[0], vb[0]));

			for (int i = 2; i < int(vb.size()); i+=2)
			{
				k++;
				v.pb(mp(vb[i-1], vb[i]));
			}
		}else{
			for (int i = 1; i < int(va.size()); i+=2)
			{
				k++;
				v.pb(mp(va[i-1], va[i]));
			}

			for (int i = 1; i < int(vb.size()); i+=2)
			{
				k++;
				v.pb(mp(vb[i-1], vb[i]));
			}
		}
	}else{
		k = -1;
	}

	cout << k << endl;
	if(k>0){
		for (int i = 0; i < int(v.size()); i++)
		{
			cout << v[i].f << " " << v[i].s << endl;
		}
	}

}


#include <bits/stdc++.h>
using namespace std;

#define pb push_back
#define mp make_pair

#define f first
#define s second

typedef long long int ll;
typedef long double ld;

const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f;

int main(){
	int n; cin >> n;

	char s[n], z[n];
	cin >> s >> z;

	int a, b;
	vector<int> ap, bp;

	for (int i = 0; i < n; i++)
	{
		if(s[i] == 'a')a++;
		else b++;

		if(z[i] == 'a')a++;
		else b++;

		if(s[i] != z[i]){
			if(s[i] == 'a')
				ap.pb(i+1);
			else
				bp.pb(i+1);
		}
	}

	vector<pair<int,int>> ans;

	if((a%2 == b%2) and (b%2 == 0)){
		int sa = ap.size(), sb = bp.size();

		for (int i = 0; i + 1 < sa; i+=2)
		{
			ans.pb(mp(ap[i], ap[i+1]));
		}

		for (int i = 0; i + 1 < sb; i+=2)
		{
			ans.pb(mp(bp[i], bp[i+1]));
		}

		if(ap.size()%2){
			int l = ap[sa-1];
			int r = bp[sb-1];

			ans.pb(mp(l, l));
			ans.pb(mp(l, r));
		}

		int k = ans.size();
		cout << k << endl;

		for (int i = 0; i < k; i++)
		{
			cout << ans[i].f << " " << ans[i].s << endl;
		}

	} else {
		cout << -1 << endl;
	}
}


#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#include <string>
#include <unordered_map>
#define endl "\n"
#define all(v) v.begin(),v.end()
#define allr(s) s.rbegin(),s.rend()
#define RT(s) return cout<<s,0
#define watch(x) cout<<(#x)<<" = "<<x<<endl
#define sz(s)	(int)(s.size())
#define PI acos(-1)
#define EPS 1e-8
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
int dy[] = { 1, -1, 0, 0, -1, 1, 1, -1 };
int dx[] = { 0, 0, 1, -1, 1, -1, 1, -1 };
void file() {
#ifndef ONLINE_JUDGE
	freopen("in.txt", "r", stdin);
	//freopen("out.txt", "w", stdout);
#else
	//freopen("street.in", "r", stdin);
	//freopen("out.txt", "w", stdout);
#endif
}
void fast() {
	std::ios_base::sync_with_stdio(0);
	cin.tie(NULL);
}
int n;
string s, t;
vii show;

int main() {
	file();
	fast();
	cin >> n;
	cin >> s >> t;
	queue<int> tba, tbb, taa, tab;
	queue<int> sba, sbb, saa, sab;
	int a = 0, b = 0;
	for (int i = 0; i < n; i++) {
		if (s[i] == 'a') {
			a++;
			if (t[i] == 'b')
				sab.push(i);
			else
				saa.push(i);
		}
		else {
			b++;
			if (t[i] == 'a')
				sba.push(i);
			else
				sbb.push(i);
		}
	}
	for (int i = 0; i < n; i++) {
		if (t[i] == 'a') {
			a++;
			if (s[i] == 'b')
				tab.push(i);
			else
				taa.push(i);
		}
		else {
			b++;
			if (s[i] == 'a')
				tba.push(i);
			else
				tbb.push(i);
		}
	}
	if (a & 1 || b & 1)
		RT(-1 << endl);
	for (int i = 0; i < n; i++) {
		if (s[i] == t[i])
			continue;
		// for ubove
		if (s[i] == 'a') {
			while (sz(sab) && (t[sab.front()] == 'a' || sab.front() <= i))
				sab.pop();
			if (sz(sab)) {
				show.push_back({ i,sab.front() });
				s[i] = 'b';
				t[sab.front()] = 'a';
				sab.pop();
				continue;
			}
		}
		else {
			while (sz(sba) && (t[sba.front()] == 'b' || sba.front() <= i))
				sba.pop();
			if (sz(sba)) {
				show.push_back({ i, sba.front() });
				s[i] = 'a';
				t[sba.front()] = 'b';
				sba.pop();
				continue;
			}
		}
		// for down
		if (t[i] == 'a') {
			while (sz(tab) && (s[tab.front()] == 'a' || tab.front() <= i))
				tab.pop();
			if (sz(tab)) {
				show.push_back({ tab.front(), i });
				t[i] = 'b';
				s[tab.front()] = 'a';
				tab.pop();
				continue;
			}
		}
		else if (t[i] == 'b') {
			while (sz(tba) && (s[tba.front()] == 'b' || tba.front() <= i))
				tba.pop();
			if (sz(tba)) {
				show.push_back({ tba.front(), i });
				t[i] = 'a';
				s[tba.front()] = 'b';
				tba.pop();
				continue;
			}
		}

		// for ubove
		if (s[i] == 'a') {
			while (sz(sbb) && (t[sbb.front()] == 'a' || sbb.front() <= i))
				sbb.pop();
			if (sz(sbb)) {
				show.push_back({ i, sbb.front() });
				s[i] = 'b';
				t[sbb.front()] = 'a';
				sbb.pop();
				continue;
			}
		}
		else {
			while (sz(saa) && (t[saa.front()] == 'b' || saa.front() <= i))
				saa.pop();
			if (sz(saa)) {
				show.push_back({ i, saa.front() });
				s[i] = 'a';
				t[saa.front()] = 'b';
				saa.pop();
				continue;
			}
		}
		// for down
		if (t[i] == 'a') {
			while (sz(tbb) && (s[tbb.front()] == 'a' || tbb.front() <= i))
				tbb.pop();
			if (sz(tbb)) {
				show.push_back({ tbb.front(), i });
				t[i] = 'b';
				s[tbb.front()] = 'a';
				tbb.pop();
				continue;
			}
		}
		else {
			while (sz(taa) && (s[taa.front()] == 'b' || taa.front() <= i))
				taa.pop();
			if (sz(taa)) {
				show.push_back({ taa.front(), i });
				t[i] = 'a';
				s[taa.front()] = 'b';
				taa.pop();
				continue;
			}
		}
		RT(-1 << endl);
	}
	cout << sz(show) << endl;
	for (auto it : show)
		cout << it.first + 1 << ' ' << it.second + 1 << endl;
	return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#include <string>
#include <unordered_map>
#define endl "\n"
#define all(v) v.begin(),v.end()
#define allr(s) s.rbegin(),s.rend()
#define RT(s) return cout<<s,0
#define watch(x) cout<<(#x)<<" = "<<x<<endl
#define sz(s)	(int)(s.size())
#define PI acos(-1)
#define EPS 1e-8
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
int dy[] = { 1, -1, 0, 0, -1, 1, 1, -1 };
int dx[] = { 0, 0, 1, -1, 1, -1, 1, -1 };
void file() {
#ifndef ONLINE_JUDGE
	freopen("in.txt", "r", stdin);
	//freopen("out.txt", "w", stdout);
#else
	//freopen("street.in", "r", stdin);
	//freopen("out.txt", "w", stdout);
#endif
}
void fast() {
	std::ios_base::sync_with_stdio(0);
	cin.tie(NULL);
}
int n;
string s, t;
vii show;

int main() {
	file();
	fast();
	cin >> n;
	cin >> s >> t;
	queue<int> tba, tbb, taa, tab;
	queue<int> sba, sbb, saa, sab;
	int a = 0, b = 0;
	for (int i = 0; i < n; i++) {
		if (s[i] == 'a') {
			a++;
			if (t[i] == 'b')
				sab.push(i);
			else
				saa.push(i);
		}
		else {
			b++;
			if (t[i] == 'a')
				sba.push(i);
			else
				sbb.push(i);
		}
	}
	for (int i = 0; i < n; i++) {
		if (t[i] == 'a') {
			a++;
			if (s[i] == 'b')
				tab.push(i);
			else
				taa.push(i);
		}
		else {
			b++;
			if (s[i] == 'a')
				tba.push(i);
			else
				tbb.push(i);
		}
	}
	if (a & 1 || b & 1)
		RT(-1 << endl);
	for (int i = 0; i < n; i++) {
		if (s[i] == t[i])
			continue;
		// for ubove
		if (s[i] == 'a') {
			while (sz(sab) && (t[sab.front()] == 'a' || sab.front() <= i))
				sab.pop();
			if (sz(sab)) {
				show.push_back({ i,sab.front() });
				s[i] = 'b';
				t[sab.front()] = 'a';
				sab.pop();
				continue;
			}
		}
		else {
			while (sz(sba) && (t[sba.front()] == 'b' || sba.front() <= i))
				sba.pop();
			if (sz(sba)) {
				show.push_back({ i, sba.front() });
				s[i] = 'a';
				t[sba.front()] = 'b';
				sba.pop();
				continue;
			}
		}
		// for down
		if (t[i] == 'a') {
			while (sz(tab) && (s[tab.front()] == 'a' || tab.front() <= i))
				tab.pop();
			if (sz(tab)) {
				show.push_back({ tab.front(), i });
				t[i] = 'b';
				s[tab.front()] = 'a';
				tab.pop();
				continue;
			}
		}
		else if (t[i] == 'b') {
			while (sz(tba) && (s[tba.front()] == 'b' || tba.front() <= i))
				tba.pop();
			if (sz(tba)) {
				show.push_back({tba.front(), i});
				t[i] = 'a';
				s[tba.front()] = 'b';
				tba.pop();
				continue;
			}
		}

		// for ubove
		if (s[i] == 'a') {
			while (sz(sbb) && (t[sbb.front()] == 'a' || sbb.front() <= i))
				sbb.pop();
			if (sz(sbb)) {
				show.push_back({ i, sbb.front() });
				s[i] = 'b';
				t[sbb.front()] = 'a';
				sbb.pop();
				continue;
			}
		}
		else {
			while (sz(saa) && (t[saa.front()] == 'b' || saa.front() <= i))
				saa.pop();
			if (sz(saa)) {
				show.push_back({ i, saa.front() });
				s[i] = 'a';
				t[saa.front()] = 'b';
				saa.pop();
				continue;
			}
		}
		// for down
		if (t[i] == 'a') {
			while (sz(tbb) && (s[tbb.front()] == 'a' || tbb.front() <= i))
				tbb.pop();
			if (sz(tbb)) {
				show.push_back({ tbb.front(), i });
				t[i] = 'b';
				s[tbb.front()] = 'a';
				tbb.pop();
				continue;
			}
		}
		else {
			while (sz(taa) && (s[taa.front()] == 'b' || taa.front() <= i))
				taa.pop();
			if (sz(taa)) {
				show.push_back({ taa.front(), i });

				t[i] = 'a';
				s[taa.front()] = 'a';
				taa.pop();
			}
		}
	}
	cout << sz(show) << endl;
	for (auto it : show)
		cout << it.first + 1 << ' ' << it.second + 1 << endl;
	return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#include <string>
#include <unordered_map>
#define endl "\n"
#define all(v) v.begin(),v.end()
#define allr(s) s.rbegin(),s.rend()
#define RT(s) return cout<<s,0
#define watch(x) cout<<(#x)<<" = "<<x<<endl
#define sz(s)	(int)(s.size())
#define PI acos(-1)
#define EPS 1e-8
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
int dy[] = { 1, -1, 0, 0, -1, 1, 1, -1 };
int dx[] = { 0, 0, 1, -1, 1, -1, 1, -1 };
void file() {
#ifndef ONLINE_JUDGE
	freopen("in.txt", "r", stdin);
	//freopen("out.txt", "w", stdout);
#else
	//freopen("street.in", "r", stdin);
	//freopen("out.txt", "w", stdout);
#endif
}
void fast() {
	std::ios_base::sync_with_stdio(0);
	cin.tie(NULL);
}
int n;
string s, t;
vii show;

int main() {
	file();
	fast();
	cin >> n;
	cin >> s >> t;
	queue<int> tba, tbb, taa, tab;
	queue<int> sba, sbb, saa, sab;
	int a = 0, b = 0;
	for (int i = 0; i < n; i++) {
		if (s[i] == 'a') {
			a++;
			if (t[i] == 'b')
				sab.push(i);
			else
				saa.push(i);
		}
		else {
			b++;
			if (t[i] == 'a')
				sba.push(i);
			else
				sbb.push(i);
		}
	}
	for (int i = 0; i < n; i++) {
		if (t[i] == 'a') {
			a++;
			if (s[i] == 'b')
				tab.push(i);
			else
				taa.push(i);
		}
		else {
			b++;
			if (s[i] == 'a')
				tba.push(i);
			else
				tbb.push(i);
		}
	}
	if (a & 1 || b & 1)
		RT(-1 << endl);
	for (int i = 0; i < n; i++) {
		if (s[i] == t[i])
			continue;
		// for ubove
		if (s[i] == 'a') {
			while (sz(sab) && (t[sab.front()] == 'a' || sab.front() <= i))
				sab.pop();
			if (sz(sab)) {
				show.push_back({ i,sab.front() });
				s[i] = 'b';
				t[sab.front()] = 'a';
				sab.pop();
				continue;
			}
		}
		else {
			while (sz(sba) && (t[sba.front()] == 'b' || sba.front() <= i))
				sba.pop();
			if (sz(sba)) {
				show.push_back({ i, sba.front() });
				s[i] = 'a';
				t[sba.front()] = 'b';
				sba.pop();
				continue;
			}
		}
		// for down
		if (t[i] == 'a') {
			while (sz(tab) && (s[tab.front()] == 'a' || tab.front() <= i))
				tab.pop();
			if (sz(tab)) {
				show.push_back({ tab.front(), i });
				t[i] = 'b';
				s[tab.front()] = 'a';
				tab.pop();
				continue;
			}
		}
		else if (t[i] == 'b') {
			while (sz(tba) && (s[tba.front()] == 'b' || tba.front() <= i))
				tba.pop();
			if (sz(tba)) {
				show.push_back({tba.front(), i});
				t[i] = 'a';
				s[tba.front()] = 'b';
				tba.pop();
				continue;
			}
		}

		// for ubove
		if (s[i] == 'a') {
			while (sz(sbb) && (t[sbb.front()] == 'a' || sbb.front() <= i))
				sbb.pop();
			if (sz(sbb)) {
				show.push_back({ i, sbb.front() });
				s[i] = 'b';
				t[sbb.front()] = 'a';
				sbb.pop();
				continue;
			}
		}
		else {
			while (sz(saa) && (t[saa.front()] == 'b' || saa.front() <= i))
				saa.pop();
			if (sz(saa)) {
				show.push_back({ i, saa.front() });
				s[i] = 'a';
				t[saa.front()] = 'b';
				saa.pop();
				continue;
			}
		}
		// for down
		if (t[i] == 'a') {
			while (sz(tbb) && (s[tbb.front()] == 'a' || tbb.front() <= i))
				tbb.pop();
			if (sz(tbb)) {
				show.push_back({ tbb.front(), i });
				t[i] = 'b';
				s[tbb.front()] = 'a';
				tbb.pop();
				continue;
			}
		}
		else {
			while (sz(taa) && (s[taa.front()] == 'b' || taa.front() <= i))
				taa.pop();
			if (sz(taa)) {
				show.push_back({ taa.front(), i });
				t[i] = 'a';
				s[taa.front()] = 'a';
				taa.pop();
				continue;
			}
		}
		RT(-1 << endl);
	}
	cout << sz(show) << endl;
	for (auto it : show)
		cout << it.first + 1 << ' ' << it.second + 1 << endl;
	return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#include <string>
#include <unordered_map>
#define endl "\n"
#define all(v) v.begin(),v.end()
#define allr(s) s.rbegin(),s.rend()
#define RT(s) return cout<<s,0
#define watch(x) cout<<(#x)<<" = "<<x<<endl
#define sz(s)	(int)(s.size())
#define PI acos(-1)
#define EPS 1e-8
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
int dy[] = { 1, -1, 0, 0, -1, 1, 1, -1 };
int dx[] = { 0, 0, 1, -1, 1, -1, 1, -1 };
void file() {
#ifndef ONLINE_JUDGE
	freopen("in.txt", "r", stdin);
	//freopen("out.txt", "w", stdout);
#else
	//freopen("street.in", "r", stdin);
	//freopen("out.txt", "w", stdout);
#endif
}
void fast() {
	std::ios_base::sync_with_stdio(0);
	cin.tie(NULL);
}
int n;
string s, t;
vii show;

int main() {
	file();
	fast();
	cin >> n;
	vector<int> vis(n + 9);
	cin >> s >> t;
	queue<int> tba, tbb, taa, tab;
	queue<int> sba, sbb, saa, sab;
	int a = 0, b = 0;
	for (int i = 0; i < n; i++) {
		if (s[i] == 'a') {
			a++;
			if (t[i] == 'b')
				sab.push(i);
			else
				saa.push(i);
		}
		else {
			b++;
			if (t[i] == 'a')
				sba.push(i);
			else
				sbb.push(i);
		}
	}
	for (int i = 0; i < n; i++) {
		if (t[i] == 'a') {
			a++;
			if (s[i] == 'b')
				tab.push(i);
			else
				taa.push(i);
		}
		else {
			b++;
			if (s[i] == 'a')
				tba.push(i);
			else
				tbb.push(i);
		}
	}
	if (a & 1 || b & 1)
		RT(-1 << endl);
	for (int i = 0; i < n; i++) {
		vis[i]++;
		if (s[i] == t[i])
			continue;
		// for ubove
		if (s[i] == 'a') {
			while (sz(sab) && (t[sab.front()] == 'a' || sab.front() <= i))
				sab.pop();
			if (sz(sab)) {
				show.push_back({ i,sab.front() });
				s[i] = 'b';
				t[sab.front()] = 'a';
				sab.pop();
				continue;
			}
		}
		else {
			while (sz(sba) && (t[sba.front()] == 'b' || sba.front() <= i))
				sba.pop();
			if (sz(sba)) {
				show.push_back({ i, sba.front() });
				s[i] = 'a';
				t[sba.front()] = 'b';
				sba.pop();
				continue;
			}
		}
		// for down
		if (t[i] == 'a') {
			while (sz(tab) && (s[tab.front()] == 'a' || tab.front() <= i))
				tab.pop();
			if (sz(tab)) {
				show.push_back({ tab.front(), i });
				t[i] = 'b';
				s[tab.front()] = 'a';
				tab.pop();
				continue;
			}
		}
		else if (t[i] == 'b') {
			while (sz(tba) && (s[tba.front()] == 'b' || tba.front() <= i))
				tba.pop();
			if (sz(tba)) {
				show.push_back({ tba.front(), i });
				t[i] = 'a';
				s[tba.front()] = 'b';
				tba.pop();
				continue;
			}
		}

		if (vis[i] > 3)
			RT(-1 << endl);
		show.push_back({ i, i });
		swap(s[i], t[i]);
		i--;
	}
	cout << sz(show) << endl;
	for (auto it : show)
		cout << it.first + 1 << ' ' << it.second + 1 << endl;
	return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#include <string>
#include <unordered_map>
#define endl "\n"
#define all(v) v.begin(),v.end()
#define allr(s) s.rbegin(),s.rend()
#define RT(s) return cout<<s,0
#define watch(x) cout<<(#x)<<" = "<<x<<endl
#define sz(s)	(int)(s.size())
#define PI acos(-1)
#define EPS 1e-8
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
int dy[] = { 1, -1, 0, 0, -1, 1, 1, -1 };
int dx[] = { 0, 0, 1, -1, 1, -1, 1, -1 };
void file() {
#ifndef ONLINE_JUDGE
	freopen("in.txt", "r", stdin);
	//freopen("out.txt", "w", stdout);
#else
	//freopen("street.in", "r", stdin);
	//freopen("out.txt", "w", stdout);
#endif
}
void fast() {
	std::ios_base::sync_with_stdio(0);
	cin.tie(NULL);
}
int n;
string s, t;
vii show;

int main() {
	file();
	fast();
	cin >> n;
	cin >> s >> t;
	queue<int> tba, tbb, taa, tab;
	queue<int> sba, sbb, saa, sab;
	int a = 0, b = 0;
	for (int i = 0; i < n; i++) {
		if (s[i] == 'a') {
			a++;
			if (t[i] == 'b')
				sab.push(i);
			else
				saa.push(i);
		}
		else {
			b++;
			if (t[i] == 'a')
				sba.push(i);
			else
				sbb.push(i);
		}
	}
	for (int i = 0; i < n; i++) {
		if (t[i] == 'a') {
			a++;
			if (s[i] == 'b')
				tab.push(i);
			else
				taa.push(i);
		}
		else {
			b++;
			if (s[i] == 'a')
				tba.push(i);
			else
				tbb.push(i);
		}
	}
	if (a & 1 || b & 1)
		RT(-1 << endl);
	for (int i = 0; i < n; i++) {
		if (s[i] == t[i])
			continue;
		// for ubove
		if (s[i] == 'a') {
			while (sz(sab) && (t[sab.front()] == 'a' || sab.front() <= i))
				sab.pop();
			if (sz(sab)) {
				show.push_back({ i,sab.front() });
				s[i] = 'b';
				t[sab.front()] = 'a';
				sab.pop();
				continue;
			}
		}
		else {
			while (sz(sba) && (t[sba.front()] == 'b' || sba.front() <= i))
				sba.pop();
			if (sz(sba)) {
				show.push_back({ i, sba.front() });
				s[i] = 'a';
				t[sba.front()] = 'b';
				sba.pop();
				continue;
			}
		}
		// for down
		if (t[i] == 'a') {
			while (sz(tab) && (s[tab.front()] == 'a' || tab.front() <= i))
				tab.pop();
			if (sz(tab)) {
				show.push_back({ tab.front(), i });
				t[i] = 'b';
				s[tab.front()] = 'a';
				tab.pop();
				continue;
			}
		}
		else if (t[i] == 'b') {
			while (sz(tba) && (s[tba.front()] == 'b' || tba.front() <= i))
				tba.pop();
			if (sz(tba)) {
				show.push_back({tba.front(), i});
				t[i] = 'a';
				s[tba.front()] = 'b';
				tba.pop();
				continue;
			}
		}

		// for ubove
		if (s[i] == 'a') {
			while (sz(sbb) && (t[sbb.front()] == 'a' || sbb.front() <= i))
				sbb.pop();
			if (sz(sbb)) {
				show.push_back({ i, sbb.front() });
				s[i] = 'b';
				t[sbb.front()] = 'a';
				sbb.pop();
				continue;
			}
		}
		else {
			while (sz(saa) && (t[saa.front()] == 'b' || saa.front() <= i))
				saa.pop();
			if (sz(saa)) {
				show.push_back({ i, saa.front() });
				s[i] = 'a';
				t[saa.front()] = 'b';
				saa.pop();
				continue;
			}
		}
		// for down
		if (t[i] == 'a') {
			while (sz(tbb) && (s[tbb.front()] == 'a' || tbb.front() <= i))
				tbb.pop();
			if (sz(tbb)) {
				show.push_back({ tbb.front(), i });
				t[i] = 'b';
				s[tbb.front()] = 'a';
				tbb.pop();
				continue;
			}
		}
		else {
			while (sz(taa) && (s[taa.front()] == 'b' || taa.front() <= i))
				taa.pop();
			if (sz(taa)) {
				show.push_back({ taa.front(), i });
				t[i] = 'a';
				s[taa.front()] = 'b';
				taa.pop();
				continue;
			}
		}
		RT(-1 << endl);
	}
	cout << sz(show) << endl;
	for (auto it : show)
		cout << it.first + 1 << ' ' << it.second + 1 << endl;
	return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#include <string>
#include <unordered_map>
#define endl "\n"
#define all(v) v.begin(),v.end()
#define allr(s) s.rbegin(),s.rend()
#define RT(s) return cout<<s,0
#define watch(x) cout<<(#x)<<" = "<<x<<endl
#define sz(s)	(int)(s.size())
#define PI acos(-1)
#define EPS 1e-8
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
int dy[] = { 1, -1, 0, 0, -1, 1, 1, -1 };
int dx[] = { 0, 0, 1, -1, 1, -1, 1, -1 };
void file() {
#ifndef ONLINE_JUDGE
	freopen("in.txt", "r", stdin);
	//freopen("out.txt", "w", stdout);
#else
	//freopen("street.in", "r", stdin);
	//freopen("out.txt", "w", stdout);
#endif
}
void fast() {
	std::ios_base::sync_with_stdio(0);
	cin.tie(NULL);
}
int n;
string s, t;
vii show;

int main() {
	file();
	fast();
	cin >> n;
	vector<int> vis(n + 9);
	cin >> s >> t;
	queue<int> tba, tbb, taa, tab;
	queue<int> sba, sbb, saa, sab;
	int a = 0, b = 0;
	for (int i = 0; i < n; i++) {
		if (s[i] == 'a') {
			a++;
			if (t[i] == 'b')
				sab.push(i);
			else
				saa.push(i);
		}
		else {
			b++;
			if (t[i] == 'a')
				sba.push(i);
			else
				sbb.push(i);
		}
	}
	for (int i = 0; i < n; i++) {
		if (t[i] == 'a') {
			a++;
			if (s[i] == 'b')
				tab.push(i);
			else
				taa.push(i);
		}
		else {
			b++;
			if (s[i] == 'a')
				tba.push(i);
			else
				tbb.push(i);
		}
	}
	if (a & 1 || b & 1)
		RT(-1 << endl);
	for (int i = 0; i < n; i++) {
		vis[i]++;
		if (s[i] == t[i])
			continue;
		// for ubove
		if (s[i] == 'a') {
			while (sz(sab) && (t[sab.front()] == 'a' || sab.front() <= i))
				sab.pop();
			if (sz(sab)) {
				show.push_back({ i,sab.front() });
				s[i] = 'b';
				t[sab.front()] = 'a';
				sab.pop();
				continue;
			}
		}
		else {
			while (sz(sba) && (t[sba.front()] == 'b' || sba.front() <= i))
				sba.pop();
			if (sz(sba)) {
				show.push_back({ i, sba.front() });
				s[i] = 'a';
				t[sba.front()] = 'b';
				sba.pop();
				continue;
			}
		}

		if (vis[i] > 3)
			RT(-1 << endl);
		show.push_back({ i, i });
		swap(s[i], t[i]);
		i--;
	}
	cout << sz(show) << endl;
	for (auto it : show)
		cout << it.first + 1 << ' ' << it.second + 1 << endl;
	return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#include <string>
#include <unordered_map>
#define endl "\n"
#define all(v) v.begin(),v.end()
#define allr(s) s.rbegin(),s.rend()
#define RT(s) return cout<<s,0
#define watch(x) cout<<(#x)<<" = "<<x<<endl
#define sz(s)	(int)(s.size())
#define PI acos(-1)
#define EPS 1e-8
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
int dy[] = { 1, -1, 0, 0, -1, 1, 1, -1 };
int dx[] = { 0, 0, 1, -1, 1, -1, 1, -1 };
void file() {
#ifndef ONLINE_JUDGE
	freopen("in.txt", "r", stdin);
	//freopen("out.txt", "w", stdout);
#else
	//freopen("street.in", "r", stdin);
	//freopen("out.txt", "w", stdout);
#endif
}
void fast() {
	std::ios_base::sync_with_stdio(0);
	cin.tie(NULL);
}
int n;
string s, t;
vii show;

int main() {
	file();
	fast();
	cin >> n;
	vector<int> vis(n + 9);
	cin >> s >> t;
	queue<int> tba, tbb, taa, tab;
	queue<int> sba, sbb, saa, sab;
	int a = 0, b = 0;
	for (int i = 0; i < n; i++) {
		if (s[i] == 'a') {
			a++;
			if (t[i] == 'b')
				sab.push(i);
			else
				saa.push(i);
		}
		else {
			b++;
			if (t[i] == 'a')
				sba.push(i);
			else
				sbb.push(i);
		}
	}
	for (int i = 0; i < n; i++) {
		if (t[i] == 'a') {
			a++;
			if (s[i] == 'b')
				tab.push(i);
			else
				taa.push(i);
		}
		else {
			b++;
			if (s[i] == 'a')
				tba.push(i);
			else
				tbb.push(i);
		}
	}
	if (a & 1 || b & 1)
		RT(-1 << endl);
	for (int i = 0; i < n; i++) {
		vis[i]++;
		if (s[i] == t[i])
			continue;
		// for ubove
		if (s[i] == 'a') {
			while (sz(sab) && (t[sab.front()] == 'a' || sab.front() <= i))
				sab.pop();
			if (sz(sab)) {
				show.push_back({ i,sab.front() });
				s[i] = 'b';
				t[sab.front()] = 'a';
				sab.pop();
				continue;
			}
		}
		else {
			while (sz(sba) && (t[sba.front()] == 'b' || sba.front() <= i))
				sba.pop();
			if (sz(sba)) {
				show.push_back({ i, sba.front() });
				s[i] = 'a';
				t[sba.front()] = 'b';
				sba.pop();
				continue;
			}
		}
		// for down
		if (t[i] == 'a') {
			while (sz(tab) && (s[tab.front()] == 'a' || tab.front() <= i))
				tab.pop();
			if (sz(tab)) {
				show.push_back({ tab.front(), i });
				t[i] = 'b';
				s[tab.front()] = 'a';
				tab.pop();
				continue;
			}
		}
		else if (t[i] == 'b') {
			while (sz(tba) && (s[tba.front()] == 'b' || tba.front() <= i))
				tba.pop();
			if (sz(tba)) {
				show.push_back({ tba.front(), i });
				t[i] = 'a';
				s[tba.front()] = 'b';
				tba.pop();
				continue;
			}
		}

		// for ubove
		if (s[i] == 'a') {
			while (sz(sbb) && (t[sbb.front()] == 'a' || sbb.front() <= i))
				sbb.pop();
			if (sz(sbb)) {
				show.push_back({ i, sbb.front() });
				s[i] = 'b';
				t[sbb.front()] = 'a';
				sbb.pop();
				continue;
			}
		}
		else {
			while (sz(saa) && (t[saa.front()] == 'b' || saa.front() <= i))
				saa.pop();
			if (sz(saa)) {
				show.push_back({ i, saa.front() });
				s[i] = 'a';
				t[saa.front()] = 'b';
				saa.pop();
				continue;
			}
		}
		// for down
		if (t[i] == 'a') {
			while (sz(tbb) && (s[tbb.front()] == 'a' || tbb.front() <= i))
				tbb.pop();
			if (sz(tbb)) {
				show.push_back({ tbb.front(), i });
				t[i] = 'b';
				s[tbb.front()] = 'a';
				tbb.pop();
				continue;
			}
		}
		else {
			while (sz(taa) && (s[taa.front()] == 'b' || taa.front() <= i))
				taa.pop();
			if (sz(taa)) {
				show.push_back({ taa.front(), i });
				t[i] = 'a';
				s[taa.front()] = 'b';
				taa.pop();
				continue;
			}
		}
		if (vis[i] > 3)
			RT(-1 << endl);
		show.push_back({ i, i });
		swap(s[i], t[i]);
		i--;
	}
	cout << sz(show) << endl;
	for (auto it : show)
		cout << it.first + 1 << ' ' << it.second + 1 << endl;
	return 0;
}


#include <bits/stdc++.h>
#define ll long long
using namespace std;

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t = 1;
    //cin >> t;
    for(int T = 0; T < t ; T++){
        int n;
        cin >> n;
        string s, t;
        cin >> s >> t;
        vector<int> sa, sb;
        for(int i = 0; i < n; i++){
            if(s[i] == 'a' && t[i] == 'b'){
                sa.push_back(i);
            }
            else if(s[i] == 'b' && t[i] == 'a'){
                sb.push_back(i);
            }
        }
        if(sa.size()%2 != sb.size()%2)
            cout << -1 << endl;
        else{
            cout << sa.size()/2 + sb.size()/2 + (sa.size()%2) << endl;
            for(int i = 0; i < sa.size() - 1; i+=2){
                cout << sa[i] + 1 << " " << sa[i + 1] + 1 << " \n";
            }
             for(int i = 0; i < sb.size() - 1; i+=2){
                cout << sb[i] + 1 << " " << sb[i + 1] + 1 << " \n";
            }
            if(sa.size() % 2){
                cout << sa.back() + 1 << " " << sa.back() + 1 << endl;
                cout << sa.back() + 1 << " " << sb.back() + 1 << endl;
            }
        }
    }
    return 0;
}


#include <bits/stdc++.h>
#define ll long long
using namespace std;

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t = 1;
    //cin >> t;
    for(int T = 0; T < t ; T++){
        int n;
        cin >> n;
        string s, t;
        cin >> s >> t;
        vector<int> sa, sb;
        for(int i = 0; i < n; i++){
            if(s[i] == 'a' && t[i] == 'b'){
                sa.push_back(i);
            }
            else if(s[i] == 'b' && t[i] == 'a'){
                sb.push_back(i);
            }
        }
        if(s == t)
            cout << 0 << endl;
        else if(sa.size()%2 != sb.size()%2)
            cout << -1 << endl;
        else{
            cout << sa.size()/2 + sb.size()/2 + 2*(sa.size()%2) << endl;
            for(int i = 0; i < sa.size() - 1; i+=2){
                cout << sa[i] + 1 << " " << sa[i + 1] + 1 << " \n";
            }
             for(int i = 0; i < sb.size() - 1; i+=2){
                cout << sb[i] + 1 << " " << sb[i + 1] + 1 << " \n";
            }
            if(sa.size() % 2){
                cout << sa.back() + 1 << " " << sa.back() + 1 << endl;
                cout << sa.back() + 1 << " " << sb.back() + 1 << endl;
            }
        }
    }
    return 0;
}


#include <bits/stdc++.h>
#define ll long long
using namespace std;

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t = 1;
    //cin >> t;
    for(int T = 0; T < t ; T++){
        int n;
        cin >> n;
        string s, t;
        cin >> s >> t;
        vector<int> sa, sb;
        for(int i = 0; i < n; i++){
            if(s[i] == 'a' && t[i] == 'b'){
                sa.push_back(i);
            }
            else if(s[i] == 'b' && t[i] == 'a'){
                sb.push_back(i);
            }
        }
        if(sa.size()%2 != sb.size()%2)
            cout << -1 << endl;
        else{
            cout << sa.size() + 2*(sa.size()%2) << endl;
            for(int i = 0; i < sa.size() - (sa.size() % 2); i+=2){
                cout << sa[i] + 1 << " " << sa[i] + 1 << " \n";
            }
            cout << sa.back() + 1 << " " << sa.back() + 1 << endl;
            cout << sa.back() + 1 << " " << sb.back() + 1 << endl;
        }
    }
    return 0;
}


#include <bits/stdc++.h>
#define ll long long
using namespace std;

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t = 1;
    //cin >> t;
    for(int T = 0; T < t ; T++){
        int n;
        cin >> n;
        string s, t;
        cin >> s >> t;
        vector<int> sa, sb;
        for(int i = 0; i < n; i++){
            if(s[i] == 'a' && t[i] == 'b'){
                sa.push_back(i);
            }
            else if(s[i] == 'b' && t[i] == 'a'){
                sb.push_back(i);
            }
        }
        if(s == t)
            cout << 0 << endl;
        else if(sa.size()%2 != sb.size()%2)
            cout << -1 << endl;
        else{
            cout << sa.size()/2 + sb.size()/2 + 2*(sa.size()%2) << endl;
            for(int i = 0; i < (int)sa.size() - 1; i+=2){
                cout << sa[i] + 1 << " " << sa[i + 1] + 1 << " \n";
            }
            cout << "ho "<<endl;
             for(int i = 0; i < (int)sb.size() - 1; i+=2){
                cout << sb[i] + 1 << " " << sb[i + 1] + 1 << " \n";
            }
            if(sa.size() % 2){
                cout << sa.back() + 1 << " " << sa.back() + 1 << endl;
                cout << sa.back() + 1 << " " << sb.back() + 1 << endl;
            }
        }
    }
    return 0;
}


#include <bits/stdc++.h>
#define ll long long
using namespace std;

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t = 1;
    //cin >> t;
    for(int T = 0; T < t ; T++){
        int n;
        cin >> n;
        string s, t;
        cin >> s >> t;
        vector<int> sa, sb;
        for(int i = 0; i < n; i++){
            if(s[i] == 'a' && t[i] == 'b'){
                sa.push_back(i);
            }
            else if(s[i] == 'b' && t[i] == 'a'){
                sb.push_back(i);
            }
        }
        if(s == t)
            cout << 0 << endl;
        else if(sa.size()%2 != sb.size()%2)
            cout << -1 << endl;
        else{
            cout << sa.size()/2 + sb.size()/2 + 2*(sa.size()%2) << endl;
            for(int i = 0; i < (int)sa.size() - 1; i+=2){
                cout << sa[i] + 1 << " " << sa[i + 1] + 1 << " \n";
            }
             for(int i = 0; i < (int)sb.size() - 1; i+=2){
                cout << sb[i] + 1 << " " << sb[i + 1] + 1 << " \n";
            }
            if(sa.size() % 2){
                cout << sa.back() + 1 << " " << sa.back() + 1 << endl;
                cout << sa.back() + 1 << " " << sb.back() + 1 << endl;
            }
        }
    }
    return 0;
}


#include <bits/stdc++.h>
#define ll long long
using namespace std;

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t = 1;
    //cin >> t;
    for(int T = 0; T < t ; T++){
        int n;
        cin >> n;
        string s, t;
        cin >> s >> t;
        vector<int> sa, sb;
        for(int i = 0; i < n; i++){
            if(s[i] == 'a' && t[i] == 'b'){
                sa.push_back(i);
            }
            else if(s[i] == 'b' && t[i] == 'a'){
                sb.push_back(i);
            }
        }
        if(sa.size()%2 != sb.size()%2)
            cout << -1 << endl;
        else{
            cout << sa.size()/2 + sb.size()/2 + 2*(sa.size()%2) << endl;
            for(int i = 0; i < sa.size() - 1; i+=2){
                cout << sa[i] + 1 << " " << sa[i + 1] + 1 << " \n";
            }
             for(int i = 0; i < sb.size() - 1; i+=2){
                cout << sb[i] + 1 << " " << sb[i + 1] + 1 << " \n";
            }
            if(sa.size() % 2){
                cout << sa.back() + 1 << " " << sa.back() + 1 << endl;
                cout << sa.back() + 1 << " " << sb.back() + 1 << endl;
            }
        }
    }
    return 0;
}


#include <bits/stdc++.h>
#define ll long long
using namespace std;

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t = 1;
    //cin >> t;
    for(int T = 0; T < t ; T++){
        int n;
        cin >> n;
        string s, t;
        cin >> s >> t;
        vector<int> sa, sb;
        for(int i = 0; i < n; i++){
            if(s[i] == 'a' && t[i] == 'b'){
                sa.push_back(i);
            }
            else if(s[i] == 'b' && t[i] == 'a'){
                sb.push_back(i);
            }
        }
        if(sa.size()%2 != sb.size()%2)
            cout << -1 << endl;
        else{
            cout << sa.size() + (sa.size()%2) << endl;
            for(int i = 0; i < sa.size() - (sa.size() % 2); i+=2){
                cout << sa[i] + 1 << " " << sa[i] + 1 << " \n";
            }
            cout << sa.back() + 1 << " " << sa.back() + 1 << endl;
            cout << sa.back() + 1 << " " << sb.back() + 1 << endl;
        }
    }
    return 0;
}


#include<bits/stdc++.h>

using namespace std;

#pragma GCC optimize("Ofast,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#define FastIO      ios_base::sync_with_stdio(false); cin.tie(0);

/// Typedef
typedef long long ll;

#define sc1(a) scanf("%lld",&a)
#define sc2(a,b) scanf("%lld %lld",&a,&b)

#define pf1(a) printf("%lld\n",a)
#define pf2(a,b) printf("%lld %lld\n",a,b)

#define vpnt(ans) for(ll i = 0; i < ans.size(); i++) cout << ans[i] << (i + 1 < ans.size() ? ' ' : '\n');
#define apnt(arr, num) for(ll i = 0; i < num; i++) cout << arr[i] << (i + 1 < num ? ' ' : '\n');

#define mx 100007
#define mod 100000007
#define PI acos(-1.0)
#define size1 200005

#define no cout << "NO" << endl
#define yes cout << "YES" << endl
#define clr(x,a)    memset(x,a,sizeof(x))

#define pb push_back
#define ff first
#define ss second
#define mp make_pair
#define case cout << "Case " << t++ << ": ";

typedef vector <ll> vll;
typedef map <ll, ll> mll;
typedef pair <ll, ll> pll;
typedef vector <pair <ll, ll> > vpll;

ll m, n, tc, num, t = 1;

vll ab, ba;
vpll vp;

int main()
{
    FastIO;
#ifndef ONLINE_JUDGE
    //freopen("/opt/Coding/clion code/input.txt", "r", stdin);
    //freopen("/opt/Coding/clion code/output.txt", "w", stdout);
#endif

    sc1(num);

    string first, second;
    cin >> first >> second;

    for (ll i = 0; i < num; ++i) {
        if(first[i] == 'a' && second[i] == 'b')
            ab.push_back(i);
        if(first[i] == 'b' && second[i] == 'a')
            ba.push_back(i);
    }

    if(ab.size() + ba.size() & 1)
        return cout << "-1" << endl,0;

    for (ll i = 0; i + 1 < ab.size(); i += 2) {
        vp.pb(mp(ab[i], ab[i + 1]));
    }
    for (ll i = 0; i + 1 < ba.size(); i += 2) {
        vp.pb(mp(ba[i], ba[i + 1]));
    }

    if(ab.size() & 1){
        ll u = ab.back();
        ll v = ba.back();
        vp.pb(mp(u, u));
        vp.pb(mp(u, v));
    }

    pf1(vp.size());
    for (ll i = 0; i < vp.size(); ++i) {
        cout << vp[i].ff << " " << vp[i].ss << endl;
    }
}


#include<bits/stdc++.h>

using namespace std;

#pragma GCC optimize("Ofast,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#define FastIO      ios_base::sync_with_stdio(false); cin.tie(0);

/// Typedef
typedef long long ll;

#define sc1(a) scanf("%lld",&a)
#define sc2(a,b) scanf("%lld %lld",&a,&b)

#define pf1(a) printf("%lld\n",a)
#define pf2(a,b) printf("%lld %lld\n",a,b)

#define vpnt(ans) for(ll i = 0; i < ans.size(); i++) cout << ans[i] << (i + 1 < ans.size() ? ' ' : '\n');
#define apnt(arr, num) for(ll i = 0; i < num; i++) cout << arr[i] << (i + 1 < num ? ' ' : '\n');

#define mx 100007
#define mod 100000007
#define PI acos(-1.0)
#define size1 200005

#define no cout << "NO" << endl
#define yes cout << "YES" << endl
#define clr(x,a)    memset(x,a,sizeof(x))

#define pb push_back
#define ff first
#define ss second
#define mp make_pair
#define case cout << "Case " << t++ << ": ";

typedef vector <ll> vll;
typedef map <ll, ll> mll;
typedef pair <ll, ll> pll;
typedef vector <pair <ll, ll> > vpll;

ll m, n, tc, num, t = 1;

vll ab, ba;
vpll vp;

int main()
{
    FastIO;
#ifndef ONLINE_JUDGE
    //freopen("/opt/Coding/clion code/input.txt", "r", stdin);
    //freopen("/opt/Coding/clion code/output.txt", "w", stdout);
#endif

    sc1(num);

    string s1, s2;
    cin >> s1 >> s2;

    for (ll i = 0; i < num; ++i) {
        if(s1[i] == 'a' && s2[i] == 'b')
            ab.push_back(i);
        else if(s1[i] == 'b' && s2[i] == 'a')
            ba.push_back(i);
    }

    if((ab.size() + ba.size()) & 1)
        return cout << "-1" << endl,0;

    for (ll i = 0; i + 1 < ab.size(); i += 2) {
        vp.pb({ab[i], ab[i + 1]});
    }
    for (ll i = 0; i + 1 < ba.size(); i += 2) {
        vp.pb({ba[i], ba[i + 1]});
    }

    if(ab.size() & 1){
        ll u = ab.back();
        ll v = ba.back();
        vp.pb({u, u});
        vp.pb({u, v});
    }

    cout << vp.size() << endl;
    for (ll i = 0; i < vp.size(); ++i) {
        cout << vp[i].ff + 1 << " " << vp[i].ss + 1 << endl;
    }
}


#include<bits/stdc++.h>

using namespace std;

#pragma GCC optimize("Ofast,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#define FastIO      ios_base::sync_with_stdio(false); cin.tie(0);

/// Typedef
typedef long long ll;

#define sc1(a) scanf("%lld",&a)
#define sc2(a,b) scanf("%lld %lld",&a,&b)

#define pf1(a) printf("%lld\n",a)
#define pf2(a,b) printf("%lld %lld\n",a,b)

#define vpnt(ans) for(ll i = 0; i < ans.size(); i++) cout << ans[i] << (i + 1 < ans.size() ? ' ' : '\n');
#define apnt(arr, num) for(ll i = 0; i < num; i++) cout << arr[i] << (i + 1 < num ? ' ' : '\n');

#define mx 100007
#define mod 100000007
#define PI acos(-1.0)
#define size1 200005

#define no cout << "NO" << endl
#define yes cout << "YES" << endl
#define clr(x,a)    memset(x,a,sizeof(x))

#define pb push_back
#define ff first
#define ss second
#define mp make_pair
#define case cout << "Case " << t++ << ": ";

typedef vector <ll> vll;
typedef map <ll, ll> mll;
typedef pair <ll, ll> pll;
typedef vector <pair <ll, ll> > vpll;

ll m, n, tc, num, t = 1;

vll ab, ba;
vpll vp;

int main()
{
    FastIO;
#ifndef ONLINE_JUDGE
    //freopen("/opt/Coding/clion code/input.txt", "r", stdin);
    //freopen("/opt/Coding/clion code/output.txt", "w", stdout);
#endif

    sc1(num);

    string s1, s2;
    cin >> s1 >> s2;

    for (ll i = 0; i < num; ++i) {
        if(s1[i] == 'a' && s2[i] == 'b')
            ab.push_back(i);
        if(s1[i] == 'b' && s2[i] == 'a')
            ba.push_back(i);
    }

    if(ab.size() + ba.size() & 1)
        return cout << "-1" << endl,0;

    for (ll i = 0; i + 1 < ab.size(); i += 2) {
        vp.pb(mp(ab[i], ab[i + 1]));
    }
    for (ll i = 0; i + 1 < ba.size(); i += 2) {
        vp.pb(mp(ba[i], ba[i + 1]));
    }

    if(ab.size() & 1){
        ll u = ab.back();
        ll v = ba.back();
        vp.pb(mp(u, u));
        vp.pb(mp(u, v));
    }

    pf1(vp.size());
    for (ll i = 0; i < vp.size(); ++i) {
        cout << vp[i].ff << " " << vp[i].ss << endl;
    }
}


#include<bits/stdc++.h>

using namespace std;

#pragma GCC optimize("Ofast,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#define FastIO      ios_base::sync_with_stdio(false); cin.tie(0);

/// Typedef
typedef long long ll;

#define sc1(a) scanf("%lld",&a)
#define sc2(a,b) scanf("%lld %lld",&a,&b)

#define pf1(a) printf("%lld\n",a)
#define pf2(a,b) printf("%lld %lld\n",a,b)

#define vpnt(ans) for(ll i = 0; i < ans.size(); i++) cout << ans[i] << (i + 1 < ans.size() ? ' ' : '\n');
#define apnt(arr, num) for(ll i = 0; i < num; i++) cout << arr[i] << (i + 1 < num ? ' ' : '\n');

#define mx 100007
#define mod 100000007
#define PI acos(-1.0)
#define size1 200005

#define no cout << "NO" << endl
#define yes cout << "YES" << endl
#define clr(x,a)    memset(x,a,sizeof(x))

#define pb push_back
#define ff first
#define ss second
#define mp make_pair
#define case cout << "Case " << t++ << ": ";

typedef vector <ll> vll;
typedef map <ll, ll> mll;
typedef pair <ll, ll> pll;
typedef vector <pair <ll, ll> > vpll;

ll m, n, tc, num, t = 1;

vll ab, ba;
vpll vp;

int main()
{
    FastIO;
#ifndef ONLINE_JUDGE
    //freopen("/opt/Coding/clion code/input.txt", "r", stdin);
    //freopen("/opt/Coding/clion code/output.txt", "w", stdout);
#endif

    sc1(num);

    string s1, s2;
    cin >> s1 >> s2;

    for (ll i = 0; i < num; ++i) {
        if(s1[i] == 'a' && s2[i] == 'b')
            ab.push_back(i);
        if(s1[i] == 'b' && s2[i] == 'a')
            ba.push_back(i);
    }

    if((ab.size() + ba.size()) & 1)
        return cout << "-1" << endl,0;

    for (ll i = 0; i + 1 < ab.size(); i += 2) {
        vp.pb({ab[i], ab[i + 1]});
    }
    for (ll i = 0; i + 1 < ba.size(); i += 2) {
        vp.pb({ba[i], ba[i + 1]});
    }

    if(ab.size() & 1){
        ll u = ab.back();
        ll v = ba.back();
        vp.pb({u, u});
        vp.pb({u, v});
    }

    pf1(vp.size());
    for (ll i = 0; i < vp.size(); ++i) {
        cout << vp[i].ff << " " << vp[i].ss << endl;
    }
}


#include<bits/stdc++.h>

using namespace std;

#pragma GCC optimize("Ofast,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#define FastIO      ios_base::sync_with_stdio(false); cin.tie(0);

/// Typedef
typedef long long ll;

#define sc1(a) scanf("%lld",&a)
#define sc2(a,b) scanf("%lld %lld",&a,&b)

#define pf1(a) printf("%lld\n",a)
#define pf2(a,b) printf("%lld %lld\n",a,b)

#define vpnt(ans) for(ll i = 0; i < ans.size(); i++) cout << ans[i] << (i + 1 < ans.size() ? ' ' : '\n');
#define apnt(arr, num) for(ll i = 0; i < num; i++) cout << arr[i] << (i + 1 < num ? ' ' : '\n');

#define mx 100007
#define mod 100000007
#define PI acos(-1.0)
#define size1 200005

#define no cout << "NO" << endl
#define yes cout << "YES" << endl
#define clr(x,a)    memset(x,a,sizeof(x))

#define pb push_back
#define ff first
#define ss second
#define mp make_pair
#define case cout << "Case " << t++ << ": ";

typedef vector <ll> vll;
typedef map <ll, ll> mll;
typedef pair <ll, ll> pll;
typedef vector <pair <ll, ll> > vpll;

ll m, n, tc, num, t = 1;

vll ab, ba;
vpll vp;

int main()
{
    FastIO;
#ifndef ONLINE_JUDGE
    //freopen("/opt/Coding/clion code/input.txt", "r", stdin);
    //freopen("/opt/Coding/clion code/output.txt", "w", stdout);
#endif

    sc1(num);

    string aa, bb;
    cin >> aa >> bb;

    for (ll i = 0; i < num; ++i) {
        if(aa[i] == 'a' && bb[i] == 'b')
            ab.push_back(i);
        if(aa[i] == 'b' && bb[i] == 'a')
            ba.push_back(i);
    }

    if(ab.size() + ba.size() & 1)
        return cout << "-1" << endl,0;

    for (ll i = 0; i + 1 < ab.size(); i += 2) {
        vp.pb(mp(ab[i], ab[i + 1]));
    }
    for (ll i = 0; i + 1 < ba.size(); i += 2) {
        vp.pb(mp(ba[i], ba[i + 1]));
    }

    if(ab.size() & 1){
        ll u = ab.back();
        ll v = ba.back();
        vp.pb(mp(u, u));
        vp.pb(mp(u, v));
    }

    pf1(vp.size());
    for (ll i = 0; i < vp.size(); ++i) {
        cout << vp[i].ff << " " << vp[i].ss << endl;
    }
}


#include<bits/stdc++.h>

using namespace std;

#pragma GCC optimize("Ofast,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#define FastIO      ios_base::sync_with_stdio(false); cin.tie(0);

/// Typedef
typedef long long ll;

#define sc1(a) scanf("%lld",&a)
#define sc2(a,b) scanf("%lld %lld",&a,&b)

#define pf1(a) printf("%lld\n",a)
#define pf2(a,b) printf("%lld %lld\n",a,b)

#define vpnt(ans) for(ll i = 0; i < ans.size(); i++) cout << ans[i] << (i + 1 < ans.size() ? ' ' : '\n');
#define apnt(arr, num) for(ll i = 0; i < num; i++) cout << arr[i] << (i + 1 < num ? ' ' : '\n');

#define mx 100007
#define mod 100000007
#define PI acos(-1.0)
#define size1 200005

#define no cout << "NO" << endl
#define yes cout << "YES" << endl
#define clr(x,a)    memset(x,a,sizeof(x))

#define pb push_back
#define ff first
#define ss second
#define mp make_pair
#define case cout << "Case " << t++ << ": ";

typedef vector <ll> vll;
typedef map <ll, ll> mll;
typedef pair <ll, ll> pll;
typedef vector <pair <ll, ll> > vpll;

ll m, n, tc, num, t = 1;

vll ab, ba;
vpll vp;

int main()
{
    FastIO;
#ifndef ONLINE_JUDGE
    //freopen("/opt/Coding/clion code/input.txt", "r", stdin);
    //freopen("/opt/Coding/clion code/output.txt", "w", stdout);
#endif

    sc1(num);

    string aa, bb;
    cin >> aa >> bb;

    for (ll i = 0; i < num; ++i) {
        if(aa[i] == 'a' && bb[i] == 'b')
            ab.push_back(i);
        if(aa[i] == 'b' && bb[i] == 'a')
            ba.push_back(i);
    }

    if(ab.size() + ba.size() & 1)
        return cout << "-1" << endl,0;

    for (ll i = 0; i < ab.size(); i += 2) {
        vp.pb(mp(ab[i], ab[i + 1]));
    }
    for (ll i = 0; i < ba.size(); i += 2) {
        vp.pb(mp(ba[i], ba[i + 1]));
    }

    if(ab.size() & 1){
        ll u = ab.back();
        ll v = ba.back();
        vp.pb(mp(u, u));
        vp.pb(mp(u, v));
    }

    pf1(vp.size());
    for (ll i = 0; i < vp.size(); ++i) {
        cout << vp[i].ff << " " << vp[i].ss << endl;
    }
}


#include<bits/stdc++.h>

using namespace std;

#pragma GCC optimize("Ofast,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#define FastIO      ios_base::sync_with_stdio(false); cin.tie(0);

/// Typedef
typedef long long ll;

#define sc1(a) scanf("%lld",&a)
#define sc2(a,b) scanf("%lld %lld",&a,&b)

#define pf1(a) printf("%lld\n",a)
#define pf2(a,b) printf("%lld %lld\n",a,b)

#define vpnt(ans) for(ll i = 0; i < ans.size(); i++) cout << ans[i] << (i + 1 < ans.size() ? ' ' : '\n');
#define apnt(arr, num) for(ll i = 0; i < num; i++) cout << arr[i] << (i + 1 < num ? ' ' : '\n');

#define mx 100007
#define mod 100000007
#define PI acos(-1.0)
#define size1 200005

#define no cout << "NO" << endl
#define yes cout << "YES" << endl
#define clr(x,a)    memset(x,a,sizeof(x))

#define pb push_back
#define ff first
#define ss second
#define mp make_pair
#define case cout << "Case " << t++ << ": ";

typedef vector <ll> vll;
typedef map <ll, ll> mll;
typedef pair <ll, ll> pll;
typedef vector <pair <ll, ll> > vpll;

ll m, n, tc, num, t = 1;

vll ab, ba;
vpll vp;

int main()
{
    FastIO;
#ifndef ONLINE_JUDGE
    //freopen("/opt/Coding/clion code/input.txt", "r", stdin);
    //freopen("/opt/Coding/clion code/output.txt", "w", stdout);
#endif

    sc1(num);

    string ss, tt;
    cin >> ss >> tt;

    for (ll i = 0; i < num; ++i) {
        if(ss[i] == 'a' && tt[i] == 'b')
            ab.push_back(i);
        if(ss[i] == 'b' && tt[i] == 'a')
            ba.push_back(i);
    }

    if(ab.size() + ba.size() & 1)
        return cout << "-1" << endl,0;

    for (ll i = 0; i + 1 < ab.size(); i += 2) {
        vp.pb(mp(ab[i], ab[i + 1]));
    }
    for (ll i = 0; i + 1 < ba.size(); i += 2) {
        vp.pb(mp(ba[i], ba[i + 1]));
    }

    if(ab.size() & 1){
        ll u = ab.back();
        ll v = ba.back();
        vp.pb(mp(u, u));
        vp.pb(mp(u, v));
    }

    pf1(vp.size());
    for (ll i = 0; i < vp.size(); ++i) {
        cout << vp[i].ff << " " << vp[i].ss << endl;
    }
}


#include<bits/stdc++.h>

using namespace std;

#pragma GCC optimize("Ofast,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#define FastIO      ios_base::sync_with_stdio(false); cin.tie(0);

/// Typedef
typedef long long ll;

#define sc1(a) scanf("%lld",&a)
#define sc2(a,b) scanf("%lld %lld",&a,&b)

#define pf1(a) printf("%lld\n",a)
#define pf2(a,b) printf("%lld %lld\n",a,b)

#define vpnt(ans) for(ll i = 0; i < ans.size(); i++) cout << ans[i] << (i + 1 < ans.size() ? ' ' : '\n');
#define apnt(arr, num) for(ll i = 0; i < num; i++) cout << arr[i] << (i + 1 < num ? ' ' : '\n');

#define mx 100007
#define mod 100000007
#define PI acos(-1.0)
#define size1 200005

#define no cout << "NO" << endl
#define yes cout << "YES" << endl
#define clr(x,a)    memset(x,a,sizeof(x))

#define pb push_back
#define ff first
#define ss second
#define mp make_pair
#define case cout << "Case " << t++ << ": ";

typedef vector <ll> vll;
typedef map <ll, ll> mll;
typedef pair <ll, ll> pll;
typedef vector <pair <ll, ll> > vpll;

ll m, n, tc, num, t = 1;

vll ab, ba;
vpll vp;

int main()
{
    FastIO;
#ifndef ONLINE_JUDGE
    //freopen("/opt/Coding/clion code/input.txt", "r", stdin);
    //freopen("/opt/Coding/clion code/output.txt", "w", stdout);
#endif

    sc1(num);

    string first, second;
    cin >> first >> second;

    for (ll i = 0; i < num; ++i) {
        if(first[i] == 'a' && second[i] == 'b')
            ab.push_back(i);
        if(first[i] == 'b' && second[i] == 'a')
            ba.push_back(i);
    }

    if(ab.size() + ba.size() & 1)
        return cout << "-1" << endl,0;

    for (ll i = 0; i + 1 < ab.size(); i += 2) {
        vp.pb(mp(ab[i], ab[i + 1]));
    }
    for (ll i = 0; i + 1 < ba.size(); i += 2) {
        vp.pb(mp(ba[i], ba[i + 1]));
    }

    if(ab.size() & 1){
        ll u = ab.back();
        ll v = ba.back();
        vp.pb(mp(u, u));
        vp.pb(mp(u, v));
    }

    pf1(vp.size());
    for (ll i = 0; i < vp.size(); ++i) {
        cout << vp[i].ff + 1 << " " << vp[i].ss + 1<< endl;
    }
}


#include<bits/stdc++.h>

using namespace std;

/// Typedef
typedef long long ll;

#define sc1(a) scanf("%lld",&a)
#define sc2(a,b) scanf("%lld %lld",&a,&b)

#define pf1(a) printf("%lld\n",a)
#define pf2(a,b) printf("%lld %lld\n",a,b)

#define vpnt(ans) for(ll i = 0; i < ans.size(); i++) cout << ans[i] << (i + 1 < ans.size() ? ' ' : '\n');
#define apnt(arr, num) for(ll i = 0; i < num; i++) cout << arr[i] << (i + 1 < num ? ' ' : '\n');

#define mx 100007
#define mod 100000007
#define PI acos(-1.0)
#define size1 200005

#define no cout << "NO" << endl
#define yes cout << "YES" << endl
#define clr(x,a)    memset(x,a,sizeof(x))

#define pb push_back
#define ff first
#define ss second
#define mp make_pair
#define case cout << "Case " << t++ << ": ";

typedef vector <ll> vll;
typedef map <ll, ll> mll;
typedef pair <ll, ll> pll;
typedef vector <pair <ll, ll> > vpll;

ll m, n, tc, num, t = 1;

vll ab, ba;
vpll vp;

int main()
{
    sc1(num);

    string s1, s2;
    cin >> s1 >> s2;

    for (ll i = 0; i < num; ++i) {
        if(s1[i] == 'a' && s2[i] == 'b')
            ab.push_back(i);
        else if(s1[i] == 'b' && s2[i] == 'a')
            ba.push_back(i);
    }

    if((ab.size() + ba.size()) & 1)
        return cout << "-1" << endl,0;

    for (ll i = 0; i + 1 < ab.size(); i += 2) {
        vp.pb({ab[i], ab[i + 1]});
    }
    for (ll i = 0; i + 1 < ba.size(); i += 2) {
        vp.pb({ba[i], ba[i + 1]});
    }

    if(ab.size() & 1){
        ll u = ab.back();
        ll v = ba.back();
        vp.pb({u, u});
        vp.pb({u, v});
    }

    cout << vp.size() << endl;
    for (ll i = 0; i < vp.size(); ++i) {
        cout << vp[i].ff + 1 << " " << vp[i].ss + 1 << endl;
    }
}


#include<bits/stdc++.h>
using namespace std;
int main(){
    int n , i , cntab , cntba , ans , in;
    cin >> n;
    string A , B;
    cin >> A >> B;
    cntab = cntba = 0;
    in = -1;
    vector<int> vba , vab;
    for(i = 0 ; i < n ; i++){
        if(A[i] == B[i]){
            continue;
        }
        if(A[i] == 'b'){
            vba.push_back(i);
            cntba++;
        }
        else{
            vab.push_back(i);
            cntab++;
        }
    }
    if(((cntba + cntab) & 1)){
        cout << -1 ;
        return 0;
    }
    ans = cntab / 2 + cntba / 2;
    if((cntab & 1) || (cntba & 1)){
        cout << vba[cntba - 1] + 1 << " " << vba[cntba - 1] + 1 << "\n";
        cout << vba[cntba - 1] + 1 << " " << vab[cntab - 1] + 1 << "\n";
        ans += 2;
    }
    cout << ans << "\n";
    for(i = 1 ; i < cntab  ; i += 2){
        cout << vab[i - 1 ] + 1  << " " << vab[i] + 1 << "\n";
    }
    for(i = 1 ; i < cntba  ; i += 2){
        cout << vba[i - 1] + 1 << " " << vba[i] + 1<< "\n";
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
    int n , i , cntab , cntba , ans , in;
    cin >> n;
    string A , B;
    cin >> A >> B;
    cntab = cntba = 0;
    in = -1;
    vector<int> vba , vab;
    for(i = 0 ; i < n ; i++){
        if(A[i] == B[i]){
            continue;
        }
        if(A[i] == 'b'){
            vba.push_back(i);
            cntba++;
        }
        else{
            vab.push_back(i);
            cntab++;
        }
    }
    if(((cntba + cntab) & 1)){
        cout << -1 ;
        return 0;
    }
    ans = cntab / 2 + cntba / 2;
    if((cntab & 1) || (cntba & 1)){
        if(cntba & 1){
            cout << vba[cntba - 1] + 1 << " " << vba[cntba - 1] + 1 << "\n";
            cout << vba[cntba - 1] + 1 << " " << vab[cntab - 1] + 1 << "\n";
        }
        else{
            cout << vab[cntba - 1] + 1 << " " << vab[cntba - 1] + 1 << "\n";
            cout << vab[cntba - 1] + 1 << " " << vba[cntab - 1] + 1 << "\n";
        }
        ans += 2;
    }
    cout << ans << "\n";
    for(i = 1 ; i < cntab  ; i += 2){
        cout << vab[i - 1 ] + 1  << " " << vab[i] + 1 << "\n";
    }
    for(i = 1 ; i < cntba  ; i += 2){
        cout << vba[i - 1] + 1 << " " << vba[i] + 1<< "\n";
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
    int n , i , cntab , cntba , ans , in;
    cin >> n;
    string A , B;
    cin >> A >> B;
    cntab = cntba = 0;
    in = -1;
    vector<int> vba , vab;
    for(i = 0 ; i < n ; i++){
        if(A[i] == B[i]){
            continue;
        }
        if(A[i] == 'b'){
            vba.push_back(i);
            cntba++;
        }
        else{
            vab.push_back(i);
            cntab++;
        }
    }
    if(((cntba + cntab) & 1)  || (cntba == 0 && cntab & 1) || (cntab == 0 && cntba & 1)){
        cout << -1 ;
        return 0;
    }
    ans = cntab / 2 + cntba / 2;
    if(cntab & 1){
        cout << vba[cntba - 1] + 1 << " " << vba[cntba - 1] + 1 << "\n";
        cout << vba[cntba - 1] + 1 << " " << vab[cntab - 1] + 1 << "\n";
        ans += 2;
    }
    cout << ans << "\n";
    for(i = 1 ; i < cntab  ; i += 2){
        cout << vab[i - 1 ] + 1  << " " << vab[i] + 1 << "\n";
    }
    for(i = 1 ; i < cntba  ; i += 2){
        cout << vba[i - 1] + 1 << " " << vba[i] + 1<< "\n";
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
    int n , i , cntab , cntba , ans , in;
    cin >> n;
    string A , B;
    cin >> A >> B;
    cntab = cntba = 0;
    in = -1;
    vector<int> vba , vab;
    for(i = 0 ; i < n ; i++){
        if(A[i] == B[i]){
            continue;
        }
        if(A[i] == 'b'){
            vba.push_back(i);
            cntba++;
        }
        else{
            vab.push_back(i);
            cntab++;
        }
    }
    if((cntba + cntab) & 1){
        cout << -1 ;
        return 0;
    }
    ans = cntab / 2 + cntba / 2;
    if(cntab & 1){
        cout << vba[cntba - 1] << " " << vba[cntba - 1] << "\n";
        cout << vba[cntba - 1] << " " << vab[cntab - 1] << "\n";
        ans += 2;
    }
    cout << ans << "\n";
    for(i = 1 ; i < cntab  ; i += 2){
        cout << vab[i - 1 ] + 1  << " " << vab[i] + 1 << "\n";
    }
    for(i = 1 ; i < cntba  ; i += 2){
        cout << vba[i - 1] + 1 << " " << vba[i] + 1<< "\n";
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
    int n , i , cntab , cntba , ans , in;
    cin >> n;
    string A , B;
    cin >> A >> B;
    cntab = cntba = 0;
    in = -1;
    vector<int> vba , vab;
    for(i = 0 ; i < n ; i++){
        if(A[i] == B[i]){
            in = i;
            continue;
        }
        if(A[i] == 'b'){
            vba.push_back(i);
            cntba++;
        }
        else{
            vab.push_back(i);
            cntab++;
        }
    }
    if((cntba + cntab) & 1 || in == -1){
        cout << -1 ;
        return 0;
    }
    ans = cntab / 2 + cntba / 2;
    if(cntab & 1){
        cout << vba[cntba - 1] + 1<< " " << vba[cntba - 1] + 1 << "\n";
        cout << vba[cntba - 1] + 1<< " " << vab[cntab - 1] + 1 << "\n";
        ans += 2;
    }
    cout << ans << "\n";
    for(i = 1 ; i < cntab  ; i += 2){
        cout << vab[i - 1 ] + 1  << " " << vab[i] + 1 << "\n";
    }
    for(i = 1 ; i < cntba  ; i += 2){
        cout << vba[i - 1] + 1 << " " << vba[i] + 1<< "\n";
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
    int n , i , cntab , cntba , ans , in;
    cin >> n;
    string A , B;
    cin >> A >> B;
    cntab = cntba = 0;
    in = -1;
    vector<int> vba , vab;
    for(i = 0 ; i < n ; i++){
        if(A[i] == B[i]){
            continue;
        }
        if(A[i] == 'b'){
            vba.push_back(i);
            cntba++;
        }
        else{
            vab.push_back(i);
            cntab++;
        }
    }
    if(((cntba + cntab) & 1)){
        cout << -1 ;
        return 0;
    }
    ans = cntab / 2 + cntba / 2;
    if((cntab + cntab) & 1){
        cout << vba[cntba - 1] + 1 << " " << vba[cntba - 1] + 1 << "\n";
        cout << vba[cntba - 1] + 1 << " " << vab[cntab - 1] + 1 << "\n";
        ans += 2;
    }
    cout << ans << "\n";
    for(i = 1 ; i < cntab  ; i += 2){
        cout << vab[i - 1 ] + 1  << " " << vab[i] + 1 << "\n";
    }
    for(i = 1 ; i < cntba  ; i += 2){
        cout << vba[i - 1] + 1 << " " << vba[i] + 1<< "\n";
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
    int n , i , cntab , cntba , ans , in;
    cin >> n;
    string A , B;
    cin >> A >> B;
    cntab = cntba = 0;
    in = -1;
    vector<int> vba , vab;
    for(i = 0 ; i < n ; i++){
        if(A[i] == B[i]){
            continue;
        }
        if(A[i] == 'b'){
            vba.push_back(i);
            cntba++;
        }
        else{
            vab.push_back(i);
            cntab++;
        }
    }
    if((cntba + cntab) & 1){
        cout << -1 ;
        return 0;
    }
    ans = cntab / 2 + cntba / 2;
    if(cntab & 1){
        cout << vba[cntba - 1] + 1 << " " << vba[cntba - 1] + 1 << "\n";
        cout << vba[cntba - 1] + 1 << " " << vab[cntab - 1] + 1 << "\n";
        ans += 2;
    }
    cout << ans << "\n";
    for(i = 1 ; i < cntab  ; i += 2){
        cout << vab[i - 1 ] + 1  << " " << vab[i] + 1 << "\n";
    }
    for(i = 1 ; i < cntba  ; i += 2){
        cout << vba[i - 1] + 1 << " " << vba[i] + 1<< "\n";
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
    int n , i , cntab , cntba , ans , in;
    cin >> n;
    string A , B;
    cin >> A >> B;
    cntab = cntba = 0;
    in = -1;
    vector<int> vba , vab;
    for(i = 0 ; i < n ; i++){
        if(A[i] == B[i]){
            continue;
        }
        if(A[i] == 'b'){
            vba.push_back(i);
            cntba++;
        }
        else{
            vab.push_back(i);
            cntab++;
        }
    }
    if(((cntba + cntab) & 1)){
        cout << -1 ;
        return 0;
    }
    ans = cntab / 2 + cntba / 2;
    if((cntba + cntab) & 1){
        cout << vba[cntba - 1] + 1 << " " << vba[cntba - 1] + 1 << "\n";
        cout << vba[cntba - 1] + 1 << " " << vab[cntab - 1] + 1 << "\n";
        ans += 2;
    }
    cout << ans << "\n";
    for(i = 1 ; i < cntab  ; i += 2){
        cout << vab[i - 1 ] + 1  << " " << vab[i] + 1 << "\n";
    }
    for(i = 1 ; i < cntba  ; i += 2){
        cout << vba[i - 1] + 1 << " " << vba[i] + 1<< "\n";
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
    int n , i , cntab , cntba , ans , in;
    cin >> n;
    string A , B;
    cin >> A >> B;
    cntab = cntba = 0;
    in = -1;
    vector<int> vba , vab;
    for(i = 0 ; i < n ; i++){
        if(A[i] == B[i]){
            continue;
        }
        if(A[i] == 'b'){
            vba.push_back(i);
            cntba++;
        }
        else{
            vab.push_back(i);
            cntab++;
        }
    }
    if(((cntba + cntab) & 1)){
        cout << -1 ;
        return 0;
    }
    ans = cntab / 2 + cntba / 2;
    if((cntab & 1) || (cntba & 1)){
        ans = ans + 2;
    }
    cout << ans << "\n";
    if((cntab & 1) || (cntba & 1)){
        if(cntba & 1){
            cout << vba[cntba - 1] + 1 << " " << vba[cntba - 1] + 1 << "\n";
            cout << vba[cntba - 1] + 1 << " " << vab[cntab - 1] + 1 << "\n";
        }
        else{
            cout << vab[cntba - 1] + 1 << " " << vab[cntba - 1] + 1 << "\n";
            cout << vab[cntba - 1] + 1 << " " << vba[cntab - 1] + 1 << "\n";
        }
    }
    for(i = 1 ; i < cntab  ; i += 2){
        cout << vab[i - 1 ] + 1  << " " << vab[i] + 1 << "\n";
    }
    for(i = 1 ; i < cntba  ; i += 2){
        cout << vba[i - 1] + 1 << " " << vba[i] + 1<< "\n";
    }
    return 0;
}


#include<iostream>
#include<vector>
#include<string.h>
#include<utility>
using namespace std;
int main(void){
    int n;
    string s1,s2;
    cin>>n;
    cin>>s1;
    cin>>s2;
    vector<int> ab;
    vector<int> ba;
    vector<int> stack;
    for(int i=0;i<n;++i){
        if(s1[i]=='a' &&s2[i]=='b'){
            ab.push_back(i+1);
        }
        if(s1[i]=='b' &&s2[i]=='a'){
            ba.push_back(i+1);
        }
    }
    if((ab.size()+ba.size())%2==0 && (ab.size()+ba.size()!=0)){
        cout<<ab.size()/2+ ba.size()/2+ ab.size()%2+ba.size()%2<<endl;
        bool odd=ab.size()%2!=0;
        if(!odd){
            for(int i=0;i<ab.size()-1;i+=2){
                cout<<ab[i]<<" "<<ab[i+1]<<endl;
            }
            for(int i=0;i<ba.size()-1;i+=2){
                cout<<ba[i]<<" "<<ba[i+1]<<endl;
            }
        }
        else {
            for(int i=1;i<ab.size()-1;i+=2){
                cout<<ab[i]<<" "<<ab[i-1]<<endl;
            }
            for(int i=1;i<ba.size()-1;i+=2){
                cout<<ba[i]<<" "<<ba[i-1]<<endl;
            }
            cout<<ab[ab.size()-1]<<" "<<ab[ab.size()-1]<<endl;
            cout<<ab[ab.size()-1]<<" "<<ba[ba.size()-1]<<endl;
        }

    }
    else if((ab.size()+ba.size())%2!=0 ) cout<<-1<<endl;
    else cout<<0<<endl;
    return 0;
}


#include<iostream>
#include<vector>
#include<string.h>
#include<utility>
using namespace std;
int main(void){
    int n;
    string s1,s2;
    cin>>n;
    cin>>s1;
    cin>>s2;
    vector<int> ab;
    vector<int> ba;
    vector<int> stack;
    for(int i=0;i<n;++i){
        if(s1[i]=='a' &&s2[i]=='b'){
            ab.push_back(i);
        }
        if(s1[i]=='b' &&s2[i]=='a'){
            ba.push_back(i);
        }
    }
    if((ab.size()+ba.size())%2==0 && (ab.size()+ba.size()!=0)){
        cout<<ab.size()/2+ ba.size()/2+ ab.size()%2+ba.size()%2<<endl;
        bool odd=ab.size()%2!=0;
        if(!odd){
            for(int i=0;i<ab.size()-1;i+=2){
                cout<<ab[i]+1<<" "<<ab[i+1]+1<<endl;
            }
            for(int i=0;i<ba.size()-1;i+=2){
                cout<<ba[i]+1<<" "<<ba[i+1]+1<<endl;
            }
        }
        else {
            for(int i=1;i<ab.size()-1;i+=2){
                cout<<ab[i]+1<<" "<<ab[i-1]+1<<endl;
            }
            for(int i=0;i<ba.size()-1;i+=2){
                cout<<ba[i]+1<<" "<<ba[i-1]+1<<endl;
            }
            cout<<ab[ab.size()-1]+1<<" "<<ab[ab.size()-1]+1<<endl;
            cout<<ab[ab.size()-1]+1<<" "<<ba[ab.size()-1]+1<<endl;
        }

    }
    else if((ab.size()+ba.size())%2!=0 ) cout<<-1<<endl;
    return 0;
}


#include<iostream>
#include<vector>
#include<string.h>
#include<utility>
using namespace std;
int main(void){
    int n;
    string s1,s2;
    cin>>n;
    cin>>s1;
    cin>>s2;
    vector<int> ab;
    vector<int> ba;
    vector<int> stack;
    for(int i=0;i<n;++i){
        if(s1[i]=='a' &&s2[i]=='b'){
            ab.push_back(i);
        }
        if(s1[i]=='b' &&s2[i]=='a'){
            ba.push_back(i);
        }
    }
    if((ab.size()+ba.size())%2==0){
        cout<<ab.size()/2+ ba.size()/2+ ab.size()%2+ba.size()%2<<endl;
        bool odd=ab.size()%2!=0;
        if(!odd){
            for(int i=0;i<ab.size()-1;i+=2){
                cout<<ab[i]+1<<" "<<ab[i+1]+1<<endl;
            }
            for(int i=0;i<ba.size()-1;i+=2){
                cout<<ba[i]+1<<" "<<ba[i+1]+1<<endl;
            }
        }
        else {
            for(int i=1;i<ab.size()-1;i+=2){
                cout<<ab[i]+1<<" "<<ab[i-1]+1<<endl;
            }
            for(int i=0;i<ba.size()-1;i+=2){
                cout<<ba[i]+1<<" "<<ba[i-1]+1<<endl;
            }
            cout<<ab[ab.size()-1]+1<<" "<<ab[ab.size()-1]+1<<endl;
            cout<<ab[ab.size()-1]+1<<" "<<ba[ab.size()-1]+1<<endl;
        }

    }
    else cout<<-1<<endl;
    return 0;
}


#include<iostream>
#include<vector>
#include<string.h>
#include<utility>
using namespace std;
int main(void){
    int n;
    string s1,s2;
    cin>>n;
    cin>>s1;
    cin>>s2;
    vector<int> ab;
    vector<int> ba;
    vector<int> stack;
    for(int i=0;i<n;++i){
        if(s1[i]=='a' &&s2[i]=='b'){
            ab.push_back(i+1);
        }
        if(s1[i]=='b' &&s2[i]=='a'){
            ba.push_back(i+1);
        }
    }
    if((ab.size()+ba.size())%2==0 && (ab.size()+ba.size()!=0)){
        int y=ab.size();
        int z=ba.size();
        cout<<ab.size()/2+ ba.size()/2+ ab.size()%2+ba.size()%2<<endl;
        bool odd=ab.size()%2!=0||ba.size()%2!=0;
        if(!odd){
            for(int i=0;i<(y-1) ;i+=2){
                cout<<ab[i]<<" "<<ab[i+1]<<endl;
            }
            for(int i=0;i<(z-1);i+=2){
                cout<<ba[i]<<" "<<ba[i+1]<<endl;
            }
        }
        else {
            for(int i=1;i<(y-1);i+=2){
                cout<<ab[i]<<" "<<ab[i-1]<<endl;
            }
            for(int i=1;i<(z-1);i+=2){
                cout<<ba[i]<<" "<<ba[i-1]<<endl;
            }
            cout<<ab[y-1]<<" "<<ab[y-1]<<endl;
            cout<<ab[y-1]<<" "<<ba[z-1]<<endl;
        }

    }
    else if((ab.size()+ba.size())%2!=0 ) cout<<-1<<endl;
    else cout<<0<<endl;
    return 0;
}


#include<iostream>
#include<vector>
#include<string.h>
#include<utility>
using namespace std;
int main(void){
    int n;
    string s1,s2;
    cin>>n;
    cin>>s1;
    cin>>s2;
    vector<int> ab;
    vector<int> ba;
    vector<int> stack;
    for(int i=0;i<n;++i){
        if(s1[i]=='a' &&s2[i]=='b'){
            ab.push_back(i+1);
        }
        if(s1[i]=='b' &&s2[i]=='a'){
            ba.push_back(i+1);
        }
    }
    if((ab.size()+ba.size())%2==0 && (ab.size()+ba.size()!=0)){
        cout<<ab.size()/2+ ba.size()/2+ ab.size()%2+ba.size()%2<<endl;
        bool odd=ab.size()%2!=0;
        if(!odd){
            for(int i=0;i<ab.size()-1;i+=2){
                cout<<ab[i]<<" "<<ab[i+1]<<endl;
            }
            for(int i=0;i<ba.size()-1;i+=2){
                cout<<ba[i]<<" "<<ba[i+1]<<endl;
            }
        }
        else {
            for(int i=1;i<ab.size()-1;i+=2){
                cout<<ab[i]<<" "<<ab[i-1]<<endl;
            }
            for(int i=1;i<ba.size()-1;i+=2){
                cout<<ba[i]<<" "<<ba[i-1]<<endl;
            }
            cout<<ab[ab.size()-1]<<" "<<ab[ab.size()-1]<<endl;
            cout<<ab[ab.size()-1]<<" "<<ba[ab.size()-1]<<endl;
        }

    }
    else if((ab.size()+ba.size())%2!=0 ) cout<<-1<<endl;
    else cout<<0<<endl;
    return 0;
}


#include<iostream>
#include<vector>
#include<string.h>
#include<utility>
using namespace std;
int main(void){
    int n;
    string s1,s2;
    cin>>n;
    cin>>s1;
    cin>>s2;
    vector<int> ab;
    vector<int> ba;
    vector<int> stack;
    for(int i=0;i<n;++i){
        if(s1[i]=='a' &&s2[i]=='b'){
            ab.push_back(i);
        }
        if(s1[i]=='b' &&s2[i]=='a'){
            ba.push_back(i);
        }
    }
    if((ab.size()+ba.size())%2==0 && (ab.size()+ba.size()!=0)){
        cout<<ab.size()/2+ ba.size()/2+ ab.size()%2+ba.size()%2<<endl;
        bool odd=ab.size()%2!=0;
        if(!odd){
            for(int i=0;i<ab.size()-1;i+=2){
                cout<<ab[i]+1<<" "<<ab[i+1]+1<<endl;
            }
            for(int i=0;i<ba.size()-1;i+=2){
                cout<<ba[i]+1<<" "<<ba[i+1]+1<<endl;
            }
        }
        else {
            for(int i=1;i<ab.size()-1;i+=2){
                cout<<ab[i]+1<<" "<<ab[i-1]+1<<endl;
            }
            for(int i=0;i<ba.size()-1;i+=2){
                cout<<ba[i]+1<<" "<<ba[i-1]+1<<endl;
            }
            cout<<ab[ab.size()-1]+1<<" "<<ab[ab.size()-1]+1<<endl;
            cout<<ab[ab.size()-1]+1<<" "<<ba[ab.size()-1]+1<<endl;
        }

    }
    else if((ab.size()+ba.size())%2!=0 ) cout<<-1<<endl;
    else cout<<0<<endl;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

int main() {
	int n;
	cin>>n;
	string s,t;
	cin>>s>>t;
	int a=0,b=0,z=0;
	vector<int> ha,hb;
	for(int i=0;i<n;i++){
		if(s[i]=='a')
		a++;
		else
		b++;
		if(t[i]=='a')
		a++;
		else
		b++;
		if(s[i]!=t[i]){
			z++;
			ha.push_back(i);
		}
	}
	if(a!=b||a%2!=0)
	cout<<-1;
	else{
		vector<pair<int,int>> v;
		int i=0,j=1;
		while(i<ha.size()&&j<ha.size()){
			if(s[ha[i]]==t[ha[i]])
			i++;
			else if(s[ha[j]]==t[ha[j]])
			j++;
			else if(i==j)
			j++;
			else{
				int p=ha[i],q=ha[j];
				if(s[p]!=t[q]){
				swap(s[p],t[q]);
				v.push_back({p,q});
				}
				else
				j++;
			}
		}
		if(ha.size()!=0){
			if(s!=t){
				int p=ha[ha.size()-1],q=ha[ha.size()-2];
				swap(s[p],t[p]);
				swap(s[p],t[q]);
				v.push_back({p,p});
				v.push_back({p,q});
			}
		}
		cout<<v.size()<<endl;
		for(auto i:v)
		cout<<i.first+1<<" "<<i.second+1<<endl;
	}

	return 0;
}


#include <bits/stdc++.h>
using namespace std;

int main() {
	int n;
	cin>>n;
	string s,t;
	cin>>s>>t;
	int a=0,b=0,z=0;
	vector<int> ha,hb;
	for(int i=0;i<n;i++){
		if(s[i]=='a')
		a++;
		else
		b++;
		if(t[i]=='a')
		a++;
		else
		b++;
		if(s[i]!=t[i]){
			z++;
			ha.push_back(i);
		}
	}
	if(a%2!=0||b%2!=0)
	cout<<-1;
	else{
		vector<pair<int,int>> v;
		int i=0,j=1;
		while(i<ha.size()&&j<ha.size()){
			if(s[ha[i]]==t[ha[i]])
			i++;
			else if(s[ha[j]]==t[ha[j]])
			j++;
			else if(i==j)
			j++;
			else{
				int p=ha[i],q=ha[j];
				if(s[p]!=t[q]){
				swap(s[p],t[q]);
				v.push_back({p,q});
				}
				else
				j++;
			}
		}
		if(ha.size()!=0){
			if(s!=t){
				int p=ha[ha.size()-1],q=ha[ha.size()-2];
				swap(s[p],t[p]);
				swap(s[p],t[q]);
				v.push_back({p,p});
				v.push_back({p,q});
			}
		}
		cout<<v.size()<<endl;
		for(auto i:v)
		cout<<i.first+1<<" "<<i.second+1<<endl;
	}

	return 0;
}


#include <bits/stdc++.h>
using namespace std;

int main() {
	int n;
	cin>>n;
	string s,t;
	cin>>s>>t;
	int a=0,b=0,z=0;
	vector<int> ha,hb;
	for(int i=0;i<n;i++){
		if(s[i]=='a')
		a++;
		else
		b++;
		if(t[i]=='a')
		a++;
		else
		b++;
		if(s[i]!=t[i]){
			z++;
			if(s[i]=='a')
			ha.push_back(i);
			else
			hb.push_back(i);
		}
	}
	if(a%2!=0||b%2!=0)
	cout<<-1;
	else{
		vector<pair<int,int>> v;
		if(ha.size()!=0)
		for(int i=0;i<ha.size()-1;i+=2){
			v.push_back({ha[i]+1,ha[i+1]+1});
		}
		if(hb.size()!=0)
		for(int i=0;i<hb.size()-1;i+=2){
			v.push_back({hb[i]+1,hb[i+1]+1});
		}
		if(ha.size()%2!=0&&hb.size()%2!=0){
			int p=ha.size()-1,q=hb.size()-1;
			v.push_back({ha[p]+1,ha[p]+1});
			v.push_back({ha[p]+1,hb[q]+1});
		}
		cout<<v.size()<<endl;
		for(auto i:v)
		cout<<i.first<<" "<<i.second<<endl;
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

int main() {
	int n;
	cin>>n;
	string s,t;
	cin>>s>>t;
	int a=0,b=0,z=0;
	vector<int> ha,hb;
	for(int i=0;i<n;i++){
		if(s[i]=='a')
		a++;
		else
		b++;
		if(t[i]=='a')
		a++;
		else
		b++;
		if(s[i]!=t[i]){
			z++;
			if(s[i]=='a')
			ha.push_back(i);
			else
			hb.push_back(i);
		}
	}
	if(a%2!=0||b%2!=0)
	cout<<-1;
	else if(s==t){
		cout<<0;
	}
	else{
		vector<pair<int,int>> v;
		for(int i=0;i<ha.size()-1;i+=2){
			v.push_back({ha[i]+1,ha[i+1]+1});
		}
		for(int i=0;i<hb.size()-1;i+=2){
			v.push_back({hb[i]+1,hb[i+1]+1});
		}
		if(ha.size()%2!=0&&hb.size()%2!=0){
			int p=ha.size()-1,q=hb.size()-1;
			v.push_back({ha[p]+1,ha[p]+1});
			v.push_back({ha[p]+1,hb[q]+1});
		}
		/*int i=0,j=1;
		while(i<ha.size()&&j<ha.size()){
			if(s[ha[i]]==t[ha[i]])
			i++;
			else if(s[ha[j]]==t[ha[j]])
			j++;
			else if(i==j)
			j++;
			else{
				int p=ha[i],q=ha[j];
				if(s[p]!=t[q]){
				swap(s[p],t[q]);
				v.push_back({p,q});
				}
				else
				j++;
			}
		}

		if(ha.size()!=0){
			if(s!=t){
				int p=ha[ha.size()-1],q=ha[ha.size()-2];
				swap(s[p],t[p]);
				swap(s[p],t[q]);
				v.push_back({p,p});
				v.push_back({p,q});
			}
		}*/
		cout<<v.size()<<endl;
		for(auto i:v)
		cout<<i.first<<" "<<i.second<<endl;
	}

	return 0;
}


#include <bits/stdc++.h>
using namespace std;

int main() {
	int n;
	cin>>n;
	string s,t;
	cin>>s>>t;
	int a=0,b=0,z=0;
	vector<int> ha,hb;
	for(int i=0;i<n;i++){
		if(s[i]=='a')
		a++;
		else
		b++;
		if(t[i]=='a')
		a++;
		else
		b++;
		if(s[i]!=t[i]){
			z++;
			if(s[i]=='a')
			ha.push_back(i);
			else
			hb.push_back(i);
		}
	}
	if(a%2!=0||b%2!=0)
	cout<<-1;
	else{
		vector<pair<int,int>> v;
		for(int i=0;i<ha.size()-1;i+=2){
			v.push_back({ha[i]+1,ha[i+1]+1});
		}
		for(int i=0;i<hb.size()-1;i+=2){
			v.push_back({hb[i]+1,hb[i+1]+1});
		}
		if(ha.size()%2!=0&&hb.size()%2!=0){
			int p=ha.size()-1,q=hb.size()-1;
			v.push_back({ha[p]+1,ha[p]+1});
			v.push_back({ha[p]+1,hb[q]+1});
		}
		/*int i=0,j=1;
		while(i<ha.size()&&j<ha.size()){
			if(s[ha[i]]==t[ha[i]])
			i++;
			else if(s[ha[j]]==t[ha[j]])
			j++;
			else if(i==j)
			j++;
			else{
				int p=ha[i],q=ha[j];
				if(s[p]!=t[q]){
				swap(s[p],t[q]);
				v.push_back({p,q});
				}
				else
				j++;
			}
		}

		if(ha.size()!=0){
			if(s!=t){
				int p=ha[ha.size()-1],q=ha[ha.size()-2];
				swap(s[p],t[p]);
				swap(s[p],t[q]);
				v.push_back({p,p});
				v.push_back({p,q});
			}
		}*/
		cout<<v.size()<<endl;
		for(auto i:v)
		cout<<i.first<<" "<<i.second<<endl;
	}
	return 0;
}