Monocarp has got two strings $s$ and $t$ having equal length. Both strings consist of lowercase Latin letters "a" and "b". 

Monocarp wants to make these two strings $s$ and $t$ equal to each other. He can do the following operation any number of times: choose an index $pos_1$ in the string $s$, choose an index $pos_2$ in the string $t$, and swap $s_{pos_1}$ with $t_{pos_2}$.

You have to determine the minimum number of operations Monocarp has to perform to make $s$ and $t$ equal, and print any optimal sequence of operations — or say that it is impossible to make these strings equal.


-----Input-----

The first line contains one integer $n$ $(1 \le n \le 2 \cdot 10^{5})$ — the length of $s$ and $t$.

The second line contains one string $s$ consisting of $n$ characters "a" and "b". 

The third line contains one string $t$ consisting of $n$ characters "a" and "b". 


-----Output-----

If it is impossible to make these strings equal, print $-1$.

Otherwise, in the first line print $k$ — the minimum number of operations required to make the strings equal. In each of the next $k$ lines print two integers — the index in the string $s$ and the index in the string $t$ that should be used in the corresponding swap operation. 


-----Examples-----
Input
4
abab
aabb

Output
2
3 3
3 2

Input
1
a
b

Output
-1

Input
8
babbaabb
abababaa

Output
3
2 6
1 3
7 8



-----Note-----

In the first example two operations are enough. For example, you can swap the third letter in $s$ with the third letter in $t$. Then $s = $ "abbb", $t = $ "aaab". Then swap the third letter in $s$ and the second letter in $t$. Then both $s$ and $t$ are equal to "abab".

In the second example it's impossible to make two strings equal.

Difficulty: interview

Starter code:

Solutions:
n = int(input())
a = input()
s = input()
d1, d2 = [], []
for q in range(n):
    if a[q] == 'a' and s[q] == 'b':
        d1.append(q+1)
    elif a[q] == 'b' and s[q] == 'a':
        d2.append(q+1)
if (len(d1)+len(d2)) % 2 == 1:
    print(-1)
else:
    print((len(d1)+len(d2))//2+len(d1) % 2)
    for q in range(1, len(d1), 2):
        print(d1[q-1], d1[q])
    for q in range(1, len(d2), 2):
        print(d2[q-1], d2[q])
    if len(d1) % 2 == 1:
        print(d1[-1], d1[-1])
        print(d1[-1], d2[-1])


n =  int(input())
s = input()
t = input()
a, b = [], []
for i in range(n):
    if(s[i] != t[i]):
        if(s[i] == 'a'):
            a.append(i+1)
        else:
            b.append(i+1)
m = len(a) + len(b)
if(m&1):
    print(-1)
else:
    ans = m//2
    if(len(a)&1):
        ans += 1
    print(ans)
    if(len(a)&1):
        print(a[-1], a[-1])
        print(a[-1], b[-1])
    for i in range(0, len(a)-1, 2):
        # print(i)
        print(a[i], a[i+1])
    for i in range(0, len(b)-1, 2):
        print(b[i], b[i+1])


n = int(input())
s = input()
t = input()
lenS = len(s)
ta = []
tb = []
lenTa = lenTb = 0
res = []

for i in range(lenS):
    if s[i] != t[i]:
        if t[i] == 'a':
            ta.append(i)
            lenTa += 1
        else:
            tb.append(i)
            lenTb += 1

while lenTa > 1:
    res.append((ta[-1], ta[-2]))
    ta.pop()
    ta.pop()
    lenTa -= 2

while lenTb > 1:
    res.append((tb[-1], tb[-2]))
    tb.pop()
    tb.pop()
    lenTb -= 2

if lenTa and lenTb:
    res.append((ta[-1], ta[-1]))
    res.append((ta[-1], tb[-1]))
    
    print(len(res))
    
    for i in res:
        print(i[0]+1, i[1]+1)
elif lenTa or lenTb:
    print(-1)
else:
    print(len(res))
    
    for i in res:
        print(i[0]+1, i[1]+1)

import math
import sys
import collections


# imgur.com/Pkt7iIf.png

def getdict(n):
    d = {}
    if type(n) is list:
        for i in n:
            if i in d:
                d[i] += 1
            else:
                d[i] = 1
    else:
        for i in range(n):
            t = ii()
            if t in d:
                d[t] += 1
            else:
                d[t] = 1
    return d
def sieve(n):
    prime = [True for i in range(n + 1)]
    p = 2
    while (p * p <= n):
        if (prime[p] == True):
            for i in range(p * 2, n + 1, p):
                prime[i] = False
        p += 1
    prime[0] = prime[1] = False
    r = [p for p in range(n + 1) if prime[p]]
    return r
def cdiv(n, k): return n // k + (n % k != 0)
def ii(): return int(input())
def mi(): return map(int, input().split())
def li(): return list(map(int, input().split()))
def lcm(a, b): return abs(a * b) // math.gcd(a, b)
def prr(a, sep = ' '): print(sep.join(map(str, a)))

n = ii()
s = input()
t = input()
if (s.count('a') + t.count('a'))%2:
    print(-1);return()

ab = []
ba = []
for i in range(n):
    if s[i] == 'a' and t[i] == 'b':
        ab.append(i + 1)
    elif s[i] == 'b' and t[i] == 'a':
        ba.append(i + 1)

r = []
while len(ab) >= 2:
    v = ab.pop()
    u = ab.pop()
    r.append(f'{u} {v}')
while len(ba) >= 2:
    v = ba.pop()
    u = ba.pop()
    r.append(f'{u} {v}')

if len(ab) != len(ba):
    print(-1);return()
elif len(ab) > 0:
    u = ab[0]
    v = ba[0]
    r.append(f'{u} {u}')
    r.append(f'{u} {v}')

print(len(r))
for i in r:
    print(i)

n = int(input())
a = [int(c == 'b') for c in input()]
b = [int(c == 'b') for c in input()]
x = [i + 1 for i in range(n) if (a[i], b[i]) == (0, 1)]
y = [i + 1 for i in range(n) if (a[i], b[i]) == (1, 0)]
if (len(x) & 1) ^ (len(y) & 1) == 1:
    print(-1)
    return
cnt = 0
res = []
while len(x) > 1:
    res.append(f'{x.pop()} {x.pop()}')
    cnt += 1
while len(y) > 1:
    res.append(f'{y.pop()} {y.pop()}')
    cnt += 1
if len(x) == 1:
    c, d = x[0], y[0]
    res.append(f'{c} {c}')
    res.append(f'{c} {d}')
    cnt += 2
print(cnt)
print('\n'.join(res))

n = int(input())
s = input()
t = input()

cnt_s_a = 0
cnt_t_a = 0
for i in range(n):
    if s[i] == "a":
        cnt_s_a += 1
    if t[i] == "a":
        cnt_t_a += 1
if (cnt_t_a + cnt_s_a) % 2 == 1:
    print(-1)
    return

b_a = []
a_b = []

for i in range(n):
    if s[i] == "a" and t[i] == "b":
        a_b.append(i)
    if s[i] == "b" and t[i] == "a":
        b_a.append(i)

ans = []
for i in range(len(a_b)//2):
    ans.append((a_b[2*i]+1, a_b[2*i+1]+1))
for i in range(len(b_a)//2):
    ans.append((b_a[2*i]+1, b_a[2*i+1]+1))  

if len(a_b) % 2 == 1:
    ans.append((a_b[-1]+1, a_b[-1]+1))
    ans.append((a_b[-1]+1, b_a[-1]+1))
print(len(ans))
for i in ans:
    print(*i)


    




n = int(input())
s1 = input()
s2 = input()
if (s1.count('a') + s2.count('a')) % 2 == 1 or (s1.count('b') + s2.count('b')) % 2 == 1:
    print(-1)
    return

sort1 = []
sort2 = []
for i in range(n):
    if s1[i] != s2[i]:
        if s1[i] == 'a':
            sort1.append(i)
        else:
            sort2.append(i)
moves = []
while len(sort1) > 1:
    moves.append([sort1[-1], sort1[-2]])
    sort1.pop()
    sort1.pop()
while len(sort2) > 1:
    moves.append([sort2[-1], sort2[-2]])
    sort2.pop()
    sort2.pop()
if len(sort1) == 1:
    moves.append([sort1[0], sort1[0]])
    moves.append([sort1[0], sort2[0]])
print(len(moves))
for x in moves:
    print(x[0] + 1, x[1] + 1)


import sys 
from collections import defaultdict
input = lambda : sys.stdin.readline().rstrip()

n = int(input())
s = input()
t = input()

x = s.count("a")
y = t.count("a")

if not ( (x + y) % 2 == 0 and (2 * n - x - y) % 2 == 0 ):
  print("-1")
  return



ab = []
ba = []
for i in range(n):
  if s[i] == t[i]:
    continue
  elif s[i] == "a":
    ab.append(i + 1)
  else:
    ba.append(i + 1)

ans = []
while len(ab) >= 2:
  x, y = ab.pop(), ab.pop()
  ans.append((x, y))


while len(ba) >= 2:
  x, y = ba.pop(), ba.pop()
  ans.append((x, y))

if len(ab) + len(ba) == 0:
  print(len(ans))
  for i in ans:
    print(*i)

else:
  x = ab[0]
  y = ba[0]
  ans.append((x, x))
  ans.append((x, y))

  print(len(ans))
  for i in ans:
    print(*i)


n = int(input())
s = input()
t = input()
b_a = 0
ba = []
a_b = 0
ab = []
for i in range(n):
    if s[i] == 'a' and t[i] == 'b':
        a_b += 1
        ab.append(i)
    if s[i] == 'b' and t[i] == 'a':
        b_a += 1
        ba.append(i)
ans = -1
if (a_b % 2 == b_a % 2):
    ans = a_b // 2 + b_a // 2
    ans += 2 * (a_b % 2)
    print(ans)
    for i in range(1, len(ab), 2):
        print(ab[i - 1] + 1, ab[i] +1)
    for i in range(1, len(ba), 2):
        print(ba[i - 1] + 1, ba[i] +1)
    if a_b % 2 != 0:
        print(ab[-1] + 1, ab[-1] + 1)
        print(ab[-1] + 1, ba[-1] + 1)

if ans == -1:
    print(ans)

n=int(input())
s=list(input())
t=list(input())
plat1=[]
plat2=[]
tot=[]
for i in range(n):
    if (s[i]=='a' and t[i]=='b'):
        plat1.append(i+1)
    elif s[i]=='b' and t[i]=='a':
        plat2.append(i+1)
m=len(plat1)
k=len(plat2)
for i in range(1,m,2):
    tot.append((plat1[i-1],plat1[i]))
for i in range(1,k,2):
    tot.append((plat2[i-1],plat2[i]))
if m%2==1 and k%2==1:
    x,y=plat1[-1],plat2[-1]
    tot.append((x,x))
    tot.append((x,y))
elif m%2==1 and k%2==0 or m%2==0 and k%2==1:
    print(-1)
    return
print(len(tot))
for item in tot:
    print(*item)
        
        


import sys

n = int(sys.stdin.readline().strip())
s = sys.stdin.readline().strip()
t = sys.stdin.readline().strip()
A = []
B = []
C = []
D = []
a, b, c, d = 0, 0, 0, 0
for i in range (0, n):
    if s[i] == "a" and t[i] == "a":
        a = a + 1
        A.append(i)
    if s[i] == "a" and t[i] == "b":
        c = c + 1
        C.append(i)
    if s[i] == "b" and t[i] == "a":
        d = d + 1
        D.append(i)
    if s[i] == "b" and t[i] == "b":
        b = b + 1
        B.append(i)

if (c + d) % 2 != 0:
    print(-1)
else:
    print((c+1)//2 + (d+1)//2)
    lc = len(C)
    ld = len(D)
    while lc >= 2:
        print(str(C[lc - 1]+1) + " " + str(C[lc - 2]+1))
        lc = lc - 2
        B.append(lc-1)
        A.append(lc-2)
    while ld >= 2:
        print(str(D[ld - 1]+1) + " " + str(D[ld - 2]+1))
        ld = ld - 2
        A.append(ld-1)
        B.append(ld-2)
    if lc == ld == 1:
        print(str(C[0]+1) + " " + str(C[0]+1))
        print(str(C[0]+1) + " " + str(D[0]+1))


n = int(input())
s1 = input()
s2 = input()
ab = []
ba = []
for i in range(n):
    if s1[i] == 'a' and s2[i] == 'b':
        ab.append(i)
    elif s1[i] == 'b' and s2[i] == 'a':
        ba.append(i)
if (len(ab) + len(ba)) % 2:
    print(-1)
else:
    print(len(ab) // 2 + len(ba) // 2 + (len(ab) % 2) * 2)
    for i in range(1, len(ab), 2):
        print(ab[i - 1] + 1, ab[i] + 1)
    for i in range(1, len(ba), 2):
        print(ba[i - 1] + 1, ba[i] + 1)
    if len(ab) % 2:
        print(ab[-1] + 1, ab[-1] + 1)
        print(ab[-1] + 1, ba[-1] + 1)

'''input
8
babbaabb
abababaa



'''
import sys
from collections import defaultdict as dd
from itertools import  permutations as pp
from itertools import combinations as cc
from collections import Counter as ccd
from random import randint as rd
from bisect import bisect_left as bl
from  heapq import heappush as hpush
from heapq import heappop as hpop
mod=10**9+7

def ri(flag=0):
	if flag==0:
		return [int(i) for i in sys.stdin.readline().split()]
	else:
		return int(sys.stdin.readline())


n = ri(1)

a= input()
b = input()
one =[] #ab
two=[]  #ba

for i in range(n):
	if a[i]==b[i]:
		pass
	else:
		if a[i]=="a":
			one.append(i+1)
		else:
			two.append(i+1)

if (len(one)+len(two)) %2 ==1:
	print(-1)
else:
	k = len(one)+len(two)
	steps=[]

	for i in range(0,len(one),2):

		if i+1<len(one):
			steps.append((one[i],one[i+1]))

	for i in range(0,len(two),2):
		if i+1<len(two):
			steps.append((two[i],two[i+1]))

	#print(one,two)
	if len(one)%2==1:

		steps.append((one[-1],one[-1]))
		steps.append((one[-1],two[-1]))

	print(len(steps))
	for i in steps:
		print(*i)







def countchar(s1,s2):
    vala = s1.count("a") + s2.count("a")
    valb = s2.count("b") + s2.count("b")
    if(vala%2 == 0 and valb%2 == 0):
        return True
    else:
        return False

def calcarr(s1,s2):
    a2b,b2a=[],[]
    sol=[]
    for i in range(len(s1)):
        if(s1[i]=="a" and s2[i]=="b"):
            a2b.append(i)
        elif(s1[i]=="b" and s2[i]=="a"):
            b2a.append(i)
    
    k=0
    if(len(a2b)%2 ==0 and len(b2a)%2==0):

        for i in range(1,len(a2b),2):
            sol.append([a2b[i-1]+1,a2b[i]+1])
            k+=1

        for i in range(1,len(b2a),2):
            sol.append([b2a[i-1]+1,b2a[i]+1])
            k+=1

    else:

        for i in range(1,len(a2b),2):
            sol.append([a2b[i-1]+1,a2b[i]+1])
            k+=1

        for i in range(1,len(b2a),2):
            sol.append([b2a[i-1]+1,b2a[i]+1])
            k+=1

        sol.append([a2b[-1]+1,a2b[-1]+1])
        sol.append([a2b[-1]+1,b2a[-1]+1])
        k+=2

    print(k)
    for i in sol:
        print(i[0],i[1])


def main():

    n= int(input())
    s1 = input()
    s2 = input()

    if(countchar(s1,s2)):
        calcarr(s1,s2)
    else:
        print("-1")


def __starting_point():
    main()
__starting_point()

n = int(input())
s = input()
t = input()

ab = []
ba = []

for i in range(n):
    if s[i] == t[i]:
        continue
    else:
        if s[i] == "a":
            ab.append(i)
        else:
            ba.append(i)

if (len(ab) + len(ba)) % 2 == 0:
    ans = []
    for i in range(len(ab)//2):
        ans.append([ab[2*i], ab[2*i+1]])
    for i in range(len(ba)//2):
        ans.append([ba[2*i], ba[2*i+1]])
    if len(ab) % 2 != 0:
        ans.append([ab[-1], ab[-1]])
        ans.append([ab[-1], ba[-1]])
    print(len(ans))
    for i, j in ans:
        print(i+1, j+1)

else:
    print(-1)


def out(l):
	i = 0
	while i + 1 < len(l):
		print(l[i], l[i +1])
		i += 2

n = int(input())
s = input()
t = input()
ab = []
ba = []
for i in range(n):
	if s[i] == 'a' and t[i] == 'b':
		ab.append(i + 1)
	if s[i] == 'b' and t[i] == 'a':
		ba.append(i + 1)

if len(ab) % 2 == len(ba) % 2:
	cnt = len(ab) // 2 + len(ba) // 2
	if len(ab) % 2 == 1:
		cnt += 2
	print(cnt)
	out(ab)
	out(ba)
	if len(ab) % 2 == 1:
		a = ab[len(ab) - 1]
		b = ba[len(ba) - 1] 
		print(a, a)
		print(a, b)
else:
	print(-1)


n = int(input())
s = input()
t = input()

ab = []
ba = []

for i in range(n):
    if (s[i] != t[i]):
        if (s[i] == 'a'):
            ab.append(i)
        else:
            ba.append(i)

if ((len(ab)+len(ba)) % 2 > 0):
    print(-1)
    return

swaps = []

while (len(ab) > 1):
    swaps.append((ab.pop(), ab.pop()))

while (len(ba) > 1):
    swaps.append((ba.pop(), ba.pop()))

if (len(ab) > 0):
    t1 = ab.pop()
    t2 = ba.pop()
    swaps.append((t1, t1))
    swaps.append((t1, t2))

print(len(swaps))
for (t1, t2) in swaps:
    print(t1 + 1, t2 + 1)

n=int(input())
s=input()
t=input()

result = 0
out = []
ab=ba=-1
for i in range(n):
    if s[i]==t[i]:
        continue
    if s[i]=='a' and t[i]=='b':
        if ab != -1:
            out.append((ab+1,i+1))
            result += 1
            ab = -1
        else:
            ab = i
    else:
        if ba != -1:
            out.append((ba+1,i+1))
            result += 1
            ba = -1
        else:
            ba = i

if (ab == -1) != (ba == -1):
    print(-1)
elif (ab == ba == -1):
    print(result)
    for i,j in out:
        print(i,j)
else:
    print(result+2)
    for i,j in out:
        print(i,j)
    print(ab+1,ab+1)
    print(ab+1,ba+1)


''' CODED WITH LOVE BY SATYAM KUMAR '''

from sys import stdin, stdout
import heapq
import cProfile, math
from collections import Counter, defaultdict, deque
from bisect import bisect_left, bisect, bisect_right
import itertools
from copy import deepcopy
from fractions import Fraction
import sys, threading
import operator as op
from functools import reduce
import sys

sys.setrecursionlimit(10 ** 6)  # max depth of recursion
threading.stack_size(2 ** 27)  # new thread will get stack of such size
fac_warm_up = False
printHeap = str()
memory_constrained = False
P = 10 ** 9 + 7


class MergeFind:
    def __init__(self, n):
        self.parent = list(range(n))
        self.size = [1] * n
        self.num_sets = n
        self.lista = [[_] for _ in range(n)]

    def find(self, a):
        to_update = []
        while a != self.parent[a]:
            to_update.append(a)
            a = self.parent[a]
        for b in to_update:
            self.parent[b] = a
        return self.parent[a]

    def merge(self, a, b):
        a = self.find(a)
        b = self.find(b)
        if a == b:
            return
        if self.size[a] < self.size[b]:
            a, b = b, a
        self.num_sets -= 1
        self.parent[b] = a
        self.size[a] += self.size[b]
        self.lista[a] += self.lista[b]

    def set_size(self, a):
        return self.size[self.find(a)]

    def __len__(self):
        return self.num_sets


def display(string_to_print):
    stdout.write(str(string_to_print) + "\n")


def prime_factors(n):  # n**0.5 complex
    factors = dict()
    for i in range(2, math.ceil(math.sqrt(n)) + 1):
        while n % i == 0:
            if i in factors:
                factors[i] += 1
            else:
                factors[i] = 1
            n = n // i
    if n > 2:
        factors[n] = 1
    return (factors)


def all_factors(n):
    return set(reduce(list.__add__,
                      ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0)))


def fibonacci_modP(n, MOD):
    if n < 2: return 1
    return (cached_fn(fibonacci_modP, (n + 1) // 2, MOD) * cached_fn(fibonacci_modP, n // 2, MOD) + cached_fn(
        fibonacci_modP, (n - 1) // 2, MOD) * cached_fn(fibonacci_modP, (n - 2) // 2, MOD)) % MOD


def factorial_modP_Wilson(n, p):
    if (p <= n):
        return 0
    res = (p - 1)
    for i in range(n + 1, p):
        res = (res * cached_fn(InverseEuler, i, p)) % p
    return res


def binary(n, digits=20):
    b = bin(n)[2:]
    b = '0' * (digits - len(b)) + b
    return b


def is_prime(n):
    """Returns True if n is prime."""
    if n < 4:
        return True
    if n % 2 == 0:
        return False
    if n % 3 == 0:
        return False
    i = 5
    w = 2
    while i * i <= n:
        if n % i == 0:
            return False
        i += w
        w = 6 - w
    return True


def generate_primes(n):
    prime = [True for i in range(n + 1)]
    p = 2
    while p * p <= n:
        if prime[p]:
            for i in range(p * 2, n + 1, p):
                prime[i] = False
        p += 1
    return prime


factorial_modP = []


def warm_up_fac(MOD):
    nonlocal factorial_modP, fac_warm_up
    if fac_warm_up: return
    factorial_modP = [1 for _ in range(fac_warm_up_size + 1)]
    for i in range(2, fac_warm_up_size):
        factorial_modP[i] = (factorial_modP[i - 1] * i) % MOD
    fac_warm_up = True


def InverseEuler(n, MOD):
    return pow(n, MOD - 2, MOD)


def nCr(n, r, MOD):
    nonlocal fac_warm_up, factorial_modP
    if not fac_warm_up:
        warm_up_fac(MOD)
        fac_warm_up = True
    return (factorial_modP[n] * (
                (pow(factorial_modP[r], MOD - 2, MOD) * pow(factorial_modP[n - r], MOD - 2, MOD)) % MOD)) % MOD


def test_print(*args):
    if testingMode:
        print(args)


def display_list(list1, sep=" "):
    stdout.write(sep.join(map(str, list1)) + "\n")


def display_2D_list(li):
    for i in li:
        print(i)


def prefix_sum(li):
    sm = 0
    res = []
    for i in li:
        sm += i
        res.append(sm)
    return res


def get_int():
    return int(stdin.readline().strip())


def get_tuple():
    return map(int, stdin.readline().split())


def get_list():
    return list(map(int, stdin.readline().split()))


memory = dict()


def clear_cache():
    nonlocal memory
    memory = dict()


def cached_fn(fn, *args):
    nonlocal memory
    if args in memory:
        return memory[args]
    else:
        result = fn(*args)
        memory[args] = result
        return result


def ncr(n, r):
    return math.factorial(n) / (math.factorial(n - r) * math.factorial(r))


def binary_search(i, li):
    fn = lambda x: li[x] - x // i
    x = -1
    b = len(li)
    while b >= 1:
        while b + x < len(li) and fn(b + x) > 0:  # Change this condition 2 to whatever you like
            x += b
        b = b // 2
    return x


# -------------------------------------------------------------- MAIN PROGRAM


TestCases = False
fac_warm_up_size = 10 ** 5 + 100
optimise_for_recursion = False  # Can not be used clubbed with TestCases WHen using recursive functions, use Python 3


def main():
    n = get_int()
    s = list(stdin.readline().strip())
    t = list(stdin.readline().strip())
    type1, type2 = [], []
    res = []
    for i in range(n):
        if s[i]!=t[i]:
            if s[i]>t[i]:
                type1.append(i)
            else:
                type2.append(i)
    if len(type1)%2 != len(type2)%2:
        print(-1)
    else:
        k = (len(type1))//2
        #print(k, type1)
        for i in range(k):
            res.append([type1[2*i]+1, type1[2*i + 1]+1])
        k = (len(type2))//2
        #print(k, type2)
        for i in range(k):
            res.append([type2[2*i]+1, type2[2*i + 1]+1])
        if len(type1)%2!=0:
            i = type1[-1]
            j = type2[-1]
            res.append([i+1,i+1])
            res.append([i+1,j+1])
        print(len(res))
        for li in res:
            display_list(li)


# --------------------------------------------------------------------- END=


if TestCases:
    for i in range(get_int()):
        main()
else:
    main() if not optimise_for_recursion else threading.Thread(target=main).start()

n = int(input())
s = input()
t = input()

ab = 0
abs_ = set()
ba = 0
bas = set()

for i in range(n):
    ss = s[i]
    tt = t[i]
    if ss != tt:
        if ss == 'a':
            ab += 1
            abs_.add(i+1)
        else:
            ba += 1
            bas.add(i+1)

if (ab + ba)%2 != 0:
    print(-1)
    return

res = []
if len(abs_)%2 == 1:
    first = abs_.pop()
    second = bas.pop()
    res.append((first, first))
    res.append((first, second))

while abs_:
    first = abs_.pop()
    second = abs_.pop()
    res.append((first, second))

while bas:
    first = bas.pop()
    second = bas.pop()
    res.append((first, second))

print(len(res))
for x, y in res:
    print(x, y)

n = int(input())
s1= input()
s2= input()
dif = 0 
s1_a = []
s2_a = []
for idx in range(n):
    if s1[idx] != s2[idx]:
        dif +=1
        if s1[idx]=='a': s1_a.append(idx+1)
        else: s2_a.append(idx+1)
if dif%2:
    print(-1)
else:
    print(len(s1_a)//2 + len(s2_a)//2 + 2*(len(s1_a)%2))
    while len(s1_a)>=2:
        print(s1_a.pop(), s1_a.pop())
    while len(s2_a)>=2:
        print(s2_a.pop(), s2_a.pop())
    while s1_a:
        t = s1_a.pop()
        print(t, t)
        print(s2_a.pop(), t)



n = int(input())
s = input().rstrip()
t = input().rstrip()

tobe_a = []
tobe_b = []
for i, (sch, tch) in enumerate(zip(s, t)):
    if sch == "b" and tch == "a":
        tobe_a.append(i + 1)
    elif sch == "a" and tch == "b":
        tobe_b.append(i + 1)

if (len(tobe_a) + len(tobe_b)) % 2 != 0:
    print(-1)
    return

ans = []
for a1, a2 in zip(tobe_a[::2], tobe_a[1::2]):
    ans.append((a1, a2))
for b1, b2 in zip(tobe_b[::2], tobe_b[1::2]):
    ans.append((b1, b2))

if len(tobe_a) % 2 == 1:
    ans.append((tobe_a[-1], tobe_a[-1]))
    ans.append((tobe_a[-1], tobe_b[-1]))

print(len(ans))
for a, b in ans:
    print(a, b)

n = int(input())
x = input()
y = input()


ab = []
ba = []
for i, (xi, yi) in enumerate(zip(x, y), 1):
    s = xi+yi
    if s == 'ab':
        ab.append(i)
    elif s == 'ba':
        ba.append(i)

if len(ab)%2 != len(ba)%2:
    print(-1)
else:
    n1 = len(ab)
    n2 = len(ba)
    print(n1//2+n2//2+(2 if n1%2 == 1 else 0))
    for i in range(n1//2):
        print(ab[i*2], ab[i*2+1])
    for i in range(n2//2):
        print(ba[i*2], ba[i*2+1])
    if n1 % 2 == 1:
        print(ab[n1-1], ab[n1-1])
        print(ab[n1-1], ba[n2-1])
    


SI = lambda : input()
from collections import Counter

n = int(input())
a = SI()
b = SI()

def solve(n,a,b):
	d = Counter(a)+Counter(b)
	for i in d:
		if(d[i]&1):
			print(-1)
			return
	xa = d[a]//2
	newa = []
	newb = []
	for i in range(n):
		if(a[i]!=b[i]):
			newa.append((a[i],i))
			newb.append((b[i],i))
	a,b = newa,newb
	aux = len(a)
	if(aux==0):
		print(0)
		return
	canta = 0
	for i in a:
		if(i[0]=='a'):
			canta+=1
	if(canta&1):
		print(len(a)//2+1)
		print(a[0][1]+1,a[0][1]+1)
		a[0],b[0] = b[0],a[0]
			
	else:
		print(len(a)//2)
	lastA,lastB = -1,-1
	for i in range(aux):
		if(a[i][0]=='a'):
			if(lastA==-1):
				lastA=a[i][1]
			else:
				print(lastA+1,a[i][1]+1)
				lastA=-1
		else:
			if(lastB==-1):
				lastB=a[i][1]
			else:
				print(lastB+1,a[i][1]+1)
				lastB=-1
solve(n,a,b)