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: MEDIUM

Solutions:
n = int(input())
s = list(input())
t = list(input())
if (s.count('a') + t.count('a')) % 2 != 0:
	print(-1)
else:
	a = []
	b = []
	for i in range(n):
		if s[i] == 'a' and t[i] == 'b':
			a.append(i)
		elif s[i] == 'b' and t[i] == 'a':
			b.append(i)
	a = a[::-1]
	b = b[::-1]
	ans = []
	while len(a) >= 2:
		ans.append([a.pop() + 1, a.pop() + 1])
	while len(b) >= 2:
		ans.append([b.pop() + 1, b.pop() + 1])
	if a:
		ans.append([a[0] + 1, a[0] + 1])
		ans.append([a[0] + 1, b[0] + 1])
	print(len(ans))
	for x in ans:
		print(*x)


import os
import sys
from io import BytesIO, IOBase

def main():
	n = int(input())
	s = input().rstrip()
	t = input().rstrip()
	(a, b) = ([], [])
	for i in range(n):
		if s[i] != t[i]:
			if s[i] == 'a' and t[i] == 'b':
				a.append(i + 1)
			else:
				b.append(i + 1)
	if len(a) % 2 and len(b) % 2 == 0 or (len(b) % 2 and len(a) % 2 == 0):
		print(-1)
	else:
		f = len(a) % 2
		print(len(a) // 2 + len(b) // 2 + 2 * f)
		for i in range(0, len(a) - f, 2):
			print(a[i], a[i + 1])
		for i in range(0, len(b) - f, 2):
			print(b[i], b[i + 1])
		if f:
			print(a[-1], a[-1])
			print(a[-1], b[-1])
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


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)
(x, y) = (len(a), len(b))
if x % 2 == y % 2:
	k = (x + y) // 2
	if x % 2 == 1:
		print(k + 1)
		for i in range(0, x - 1, 2):
			print(a[i], a[i + 1])
		for i in range(0, y - 1, 2):
			print(b[i], b[i + 1])
		print(a[-1], a[-1])
		print(a[-1], b[-1])
	else:
		print(k)
		for i in range(0, x - 1, 2):
			print(a[i], a[i + 1])
		for i in range(0, y - 1, 2):
			print(b[i], b[i + 1])
else:
	print('-1')


n = int(input())
s = input()
t = input()
ba = 0
ab = 0
baind = []
abind = []
for i in range(n):
	if s[i] != t[i]:
		if s[i] == 'b':
			ba += 1
			baind.append(i)
		else:
			ab += 1
			abind.append(i)
if (ba + ab) % 2 != 0:
	print('-1')
else:
	hi = 0
	swaps = int(ba / 2) + int(ab / 2)
	if ba % 2 != 0:
		hi = 1
		swaps += 2
	print(swaps)
	for x in range(int(len(abind) / 2)):
		print(abind[2 * x] + 1, abind[2 * x + 1] + 1)
	for x in range(int(len(baind) / 2)):
		print(baind[2 * x] + 1, baind[2 * x + 1] + 1)
	if hi == 1:
		print(abind[len(abind) - 1] + 1, abind[len(abind) - 1] + 1)
		print(abind[len(abind) - 1] + 1, baind[len(baind) - 1] + 1)


import sys
RI = lambda : [int(x) for x in sys.stdin.readline().split()]
ri = lambda : sys.stdin.readline().strip()

def input():
	return sys.stdin.readline().strip()

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]

def list4d(a, b, c, d, e):
	return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]

def ceil(x, y=1):
	return int(-(-x // y))

def INT():
	return int(input())

def MAP():
	return map(int, input().split())

def LIST(N=None):
	return list(MAP()) if N is None else [INT() for i in range(N)]

def Yes():
	print('Yes')

def No():
	print('No')

def YES():
	print('YES')

def NO():
	print('NO')
INF = 10 ** 18
MOD = 10 ** 9 + 7
n = int(ri())
a = ri()
b = ri()
pos1 = []
pos2 = []
for i in range(n):
	if a[i] != b[i]:
		if a[i] == 'a':
			pos1.append(i)
		else:
			pos2.append(i)
if len(pos1) % 2 != len(pos2) % 2:
	print(-1)
else:
	ans = []
	i = 0
	for i in range(0, len(pos1), 2):
		if i + 1 < len(pos1):
			ans.append([pos1[i] + 1, pos1[i + 1] + 1])
	for i in range(0, len(pos2), 2):
		if i + 1 < len(pos2):
			ans.append([pos2[i] + 1, pos2[i + 1] + 1])
	if len(pos1) % 2 == 1:
		ans.append([pos1[-1] + 1, pos1[-1] + 1])
		ans.append([pos1[-1] + 1, pos2[-1] + 1])
	print(len(ans))
	for i in ans:
		print(*i)


n = int(input())
s = input()
t = input()
ac = 0
bc = 0
for i in range(n):
	if s[i] == 'a':
		ac += 1
	else:
		bc += 1
	if t[i] == 'a':
		ac += 1
	else:
		bc += 1
if ac % 2 != 0:
	print(-1)
else:
	la = []
	lb = []
	for i in range(n):
		if s[i] != t[i]:
			if s[i] == 'a':
				la.append(i)
			else:
				lb.append(i)
	c = 0
	ans = []
	if len(la) % 2 == 0:
		for i in range(0, len(la), 2):
			ans.append([la[i], la[i + 1]])
		for i in range(0, len(lb), 2):
			ans.append([lb[i], lb[i + 1]])
	else:
		for i in range(0, len(la) - 1, 2):
			ans.append([la[i], la[i + 1]])
		for i in range(0, len(lb) - 1, 2):
			ans.append([lb[i], lb[i + 1]])
		ans.append([la[len(la) - 1], la[len(la) - 1]])
		ans.append([la[len(la) - 1], lb[len(lb) - 1]])
	n = len(ans)
	print(n)
	for i in range(n):
		print(ans[i][0] + 1, ans[i][1] + 1)


import sys
input = lambda : sys.stdin.readline().strip('\r\n')
n = int(input())
s = list(input())
t = list(input())
ablist = []
balist = []
for i in range(n):
	if s[i] == 'a' and t[i] == 'b':
		ablist.append(i + 1)
	elif s[i] == 'b' and t[i] == 'a':
		balist.append(i + 1)
if (len(ablist) + len(balist)) % 2:
	print(-1)
else:
	print((len(ablist) + len(balist)) // 2 + len(ablist) % 2)
	for q in range(1, len(ablist), 2):
		print(ablist[q - 1], ablist[q])
	for q in range(1, len(balist), 2):
		print(balist[q - 1], balist[q])
	if len(ablist) % 2 == 1:
		print(ablist[-1], ablist[-1])
		print(ablist[-1], balist[-1])


n = int(input())
l1 = input()
l2 = input()
ab = []
ba = []
for i in range(n):
	if l1[i] != l2[i]:
		if l1[i] == 'a' and l2[i] == 'b':
			ab.append(i)
		elif l1[i] == 'b' and l2[i] == 'a':
			ba.append(i)
cnt = 0
lis = []
if not len(ab) & 1 and len(ab) > 0:
	for i in range(0, len(ab) - 1, 2):
		cnt += 1
		lis.append((ab[i] + 1, ab[i + 1] + 1))
elif len(ab) % 2 == 1 and len(ab) > 1:
	for i in range(0, len(ab) - 1, 2):
		cnt += 1
		lis.append((ab[i] + 1, ab[i + 1] + 1))
if not len(ba) & 1 and len(ba) > 0:
	for i in range(0, len(ba) - 1, 2):
		cnt += 1
		lis.append((ba[i] + 1, ba[i + 1] + 1))
elif len(ba) % 2 == 1 and len(ba) > 1:
	for i in range(0, len(ba) - 1, 2):
		cnt += 1
		lis.append((ba[i] + 1, ba[i + 1] + 1))
if len(ab) % 2 == 0 and len(ba) % 2 == 1:
	print(-1)
	exit()
elif len(ab) % 2 == 1 and len(ba) % 2 == 0:
	print(-1)
	exit()
elif len(ab) % 2 == 1 and len(ba) % 2 == 1:
	cnt += 2
	lis.append((ab[-1] + 1, ab[-1] + 1))
	lis.append((ab[-1] + 1, ba[-1] + 1))
print(cnt)
for i in lis:
	print(*i)


n = int(input())
word1 = input()
word2 = input()
a = []
b = []
for i in range(n):
	x = word1[i]
	y = word2[i]
	if x == y:
		continue
	if x == 'a':
		a.append(i + 1)
	else:
		b.append(i + 1)
if len(a) % 2 + len(b) % 2 == 1:
	print(-1)
else:
	r = len(a) // 2 + len(b) // 2
	if len(a) % 2 == 1:
		r += 2
	print(r)
	for i in range(1, len(a), 2):
		print(a[i - 1], a[i])
	for i in range(1, len(b), 2):
		print(b[i - 1], b[i])
	if len(a) % 2 == 1:
		print(a[-1], a[-1])
		print(a[-1], b[-1])


n = input()
s1 = input()
s2 = input()
indices_with_ab = []
indices_with_ba = []
for i in range(len(s1)):
	if (s1[i] == 'a') & (s2[i] == 'b'):
		indices_with_ab.append(i)
	elif (s1[i] == 'b') & (s2[i] == 'a'):
		indices_with_ba.append(i)
if (len(indices_with_ab) + len(indices_with_ba)) % 2 == 1:
	print(-1)
	exit()
if len(indices_with_ab) % 2 == 0:
	print(len(indices_with_ab) // 2 + len(indices_with_ba) // 2)
else:
	print(len(indices_with_ab) // 2 + len(indices_with_ba) // 2 + 2)
for i in range(0, len(indices_with_ab) - 1, 2):
	print(f'{indices_with_ab[i] + 1} {indices_with_ab[i + 1] + 1}')
for i in range(0, len(indices_with_ba) - 1, 2):
	print(f'{indices_with_ba[i] + 1} {indices_with_ba[i + 1] + 1}')
if len(indices_with_ab) % 2 != 0:
	print(f'{indices_with_ab[-1] + 1} {indices_with_ab[-1] + 1}')
	print(f'{indices_with_ab[-1] + 1} {indices_with_ba[-1] + 1}')


n = int(input())
x = input()
y = input()
ba = []
ab = []
i = 0
while i < n:
	if x[i] == 'a' and y[i] == 'b':
		ab.append(i + 1)
	elif x[i] == 'b' and y[i] == 'a':
		ba.append(i + 1)
	i += 1
if (len(ab) + len(ba)) % 2 == 1:
	print(-1)
else:
	(i, j) = (0, 0)
	print(len(ab) // 2 + len(ab) % 2 + len(ba) // 2 + len(ba) % 2)
	while i < len(ab) - 1:
		print(ab[i], ab[i + 1])
		i += 2
	while j < len(ba) - 1:
		print(ba[j], ba[j + 1])
		j += 2
	if i < len(ab):
		print(ab[i], ab[i])
		print(ab[i], ba[j])


from collections import defaultdict, deque, Counter
from sys import stdin, stdout
from heapq import heappush, heappop
import math
import io
import os
import math
import bisect

def isPrime(x):
	for i in range(2, x):
		if i * i > x:
			break
		if x % i == 0:
			return False
	return True

def ncr(n, r, p):
	num = den = 1
	for i in range(r):
		num = num * (n - i) % p
		den = den * (i + 1) % p
	return num * pow(den, p - 2, p) % p

def primeFactors(n):
	l = []
	while n % 2 == 0:
		l.append(2)
		n = n / 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			l.append(int(i))
			n = n / i
	if n > 2:
		l.append(n)
	return list(set(l))

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

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 * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime

def digits(n):
	c = 0
	while n > 0:
		n //= 10
		c += 1
	return c

def ceil(n, x):
	if n % x == 0:
		return n // x
	return n // x + 1

def mapin():
	return map(int, input().split())
n = int(input())
s = input()
t = input()
a = s.count('a') + t.count('a')
b = s.count('b') + t.count('b')
if a & 1 == 0 and b & 1 == 0:
	ss = []
	sss = []
	ans = []
	for i in range(n):
		if s[i] == t[i]:
			continue
		elif s[i] == 'a' and t[i] == 'b':
			ss.append(i + 1)
		else:
			sss.append(i + 1)
	for i in range(0, len(ss), 2):
		if i + 1 < len(ss):
			ans.append([ss[i], ss[i + 1]])
	for i in range(0, len(sss), 2):
		if i + 1 < len(sss):
			ans.append([sss[i], sss[i + 1]])
	if len(ss) & 1:
		a = ss[-1]
		b = sss[-1]
		ans.append([a, a])
		ans.append([a, b])
	print(len(ans))
	for i in ans:
		print(*i)
else:
	print(-1)


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')
main()


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


from sys import stdin, exit, setrecursionlimit
from math import *
from bisect import bisect_left
from collections import deque
input = stdin.readline
lmi = lambda : list(map(int, input().split()))
mi = lambda : map(int, input().split())
si = lambda : input().strip('\n')
ssi = lambda : input().strip('\n').split()
mod = 10 ** 9 + 7
n = int(input())
a = si()
b = si()
arr = [0, 0]
arr2 = [[], []]
for i in range(n):
	if a[i] != b[i]:
		arr[a[i] == 'a'] += 1
		if a[i] == 'a':
			arr2[0].append(i)
		else:
			arr2[1].append(i)
ans = arr[0] // 2 + arr[1] // 2
if arr[0] % 2 == 1 and arr[1] % 2 == 1:
	ans += 2
elif arr[0] % 2 == 1 or arr[1] % 2 == 1:
	print(-1)
	exit()
print(ans)
for i in range(0, len(arr2[0]) - 1, 2):
	print(arr2[0][i] + 1, arr2[0][i + 1] + 1)
for i in range(0, len(arr2[1]) - 1, 2):
	print(arr2[1][i] + 1, arr2[1][i + 1] + 1)
if arr[0] % 2 == 1 and arr[1] % 2 == 1:
	print(arr2[0][-1] + 1, arr2[0][-1] + 1)
	print(arr2[0][-1] + 1, arr2[1][-1] + 1)


for _ in range(1):
	n = int(input())
	s = input()
	t = input()
	pos01 = []
	pos10 = []
	for i in range(n):
		if s[i] != t[i]:
			if s[i] == 'a':
				pos01.append(i)
			else:
				pos10.append(i)
	if len(pos10) % 2 == len(pos01) % 2:
		ans = []
		for i in range(0, len(pos01), 2):
			if i + 1 < len(pos01):
				ans.append((pos01[i], pos01[i + 1]))
			else:
				break
		for i in range(0, len(pos10), 2):
			if i + 1 < len(pos10):
				ans.append((pos10[i], pos10[i + 1]))
			else:
				break
		if len(pos01) % 2:
			x = pos01[-1]
			y = pos10[-1]
			ans.append((x, x))
			ans.append((x, y))
		print(len(ans))
		for info in ans:
			print(info[0] + 1, info[1] + 1)
	else:
		print(-1)


from math import *
n = int(input())
l1 = list(input())
l2 = list(input())
ca = 0
for i in range(n):
	if l1[i] == 'a':
		ca += 1
	if l2[i] == 'a':
		ca += 1
if ca % 2 != 0:
	print(-1)
else:
	ab = []
	ba = []
	for i in range(n):
		if l1[i] == 'a' and l2[i] == 'b':
			ab.append(i + 1)
		if l1[i] == 'b' and l2[i] == 'a':
			ba.append(i + 1)
	count = ceil(len(ab) / 2) + ceil(len(ba) / 2)
	print(count)
	c = d = -1
	for i in range(0, len(ab), 2):
		if i == len(ab) - 1:
			c = ab[i]
		else:
			print(ab[i], ab[i + 1])
	for i in range(0, len(ba), 2):
		if i == len(ba) - 1:
			d = ba[i]
		else:
			print(ba[i], ba[i + 1])
	if c != -1:
		print(c, c)
		print(c, d)


n = int(input())
s1 = input()
s2 = input()
if s1.count('a') + s2.count('a') & 1:
	print(-1)
	exit()
alpha = []
beta = []
for i in range(n):
	if s1[i] == 'a' and s2[i] == 'b':
		alpha.append(i)
	elif s1[i] == 'b' and s2[i] == 'a':
		beta.append(i)
print(len(alpha) // 2 + len(beta) // 2 + 2 * (len(alpha) & 1))
for j in range(len(alpha) // 2):
	print(1 + alpha[2 * j], 1 + alpha[2 * j + 1])
for j in range(len(beta) // 2):
	print(1 + beta[2 * j], 1 + beta[2 * j + 1])
if len(alpha) & 1:
	h = alpha[-1]
	k = beta[-1]
	print(h + 1, h + 1)
	print(h + 1, k + 1)


from sys import stdin, stdout
from math import gcd, sqrt, inf
from collections import deque
input = stdin.readline
R = lambda : map(int, input().split())
I = lambda : int(input())
S = lambda : input().rstrip('\n')
L = lambda : list(R())
P = lambda x: stdout.write(x)
hg = lambda x, y: (y + x - 1) // x * x
pw = lambda x: 1 if x == 1 else 1 + pw(x // 2)
chk = lambda x: chk(x // 2) if not x % 2 else True if x == 1 else False
N = inf
n = I()
a = S()
b = S()
x = []
y = []
d = {'a': 0, 'b': 0}
for i in range(n):
	if 'a' == a[i] != b[i]:
		x += (i + 1,)
	elif 'b' == a[i] != b[i]:
		y += (i + 1,)
	d[a[i]] += 1
	d[b[i]] += 1
if not d['a'] % 2 == d['b'] % 2 == 0:
	exit(print(-1))
op = 0
ans = []
ln_x = len(x)
ln_y = len(y)
for i in range(0, ln_x - ln_x % 2, 2):
	ans += ((x[i], x[i + 1]),)
	op += 1
for i in range(0, ln_y - ln_y % 2, 2):
	ans += ((y[i], y[i + 1]),)
	op += 1
if ln_x & 1:
	ans += ((x[-1], x[-1]),)
	ans += ((x[-1], y[-1]),)
	op += 2
print(op)
for i in ans:
	print(*i)


from collections import defaultdict as dd
from collections import deque
import bisect
import heapq

def ri():
	return int(input())

def rl():
	return list(map(int, input().split()))

def solve():
	n = ri()
	s = input()
	t = input()
	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)
	if (len(AB) + len(BA)) % 2 == 1:
		print(-1)
		return
	elif len(AB) % 2 == 0:
		print(len(AB) // 2 + len(BA) // 2)
		for i in range(0, len(AB), 2):
			print(AB[i], AB[i + 1])
		for i in range(0, len(BA), 2):
			print(BA[i], BA[i + 1])
		return
	else:
		print(len(AB) // 2 + len(BA) // 2 + 2)
		for i in range(0, len(AB) - 1, 2):
			print(AB[i], AB[i + 1])
		for i in range(0, len(BA) - 1, 2):
			print(BA[i], BA[i + 1])
		print(AB[-1], AB[-1])
		print(AB[-1], BA[-1])
mode = 'r'
if mode == 'T':
	t = ri()
	for i in range(t):
		solve()
else:
	solve()


n = int(input())
a = list(input())
b = list(input())
(indab, indba) = ([], [])
(ab, ba) = (0, 0)
for i in range(n):
	if a[i] != b[i]:
		if a[i] == 'a':
			ab += 1
			indab.append(i + 1)
		else:
			ba += 1
			indba.append(i + 1)
op = ab // 2 + ba // 2
ab %= 2
ba %= 2
if ab != ba:
	print(-1)
else:
	if ab == 1:
		op += 2
	print(op)
	for i in range(1, len(indab), 2):
		print(indab[i - 1], indab[i])
	for i in range(1, len(indba), 2):
		print(indba[i - 1], indba[i])
	if ab == 1:
		print(indab[-1], indab[-1])
		print(indab[-1], indba[-1])


n = int(input())
s = list(input())
t = list(input())
s1 = []
l1 = 0
s2 = []
l2 = 0
for i in range(n):
	if s[i] != t[i]:
		if s[i] == 'a':
			s1.append(i + 1)
			l1 += 1
		else:
			s2.append(i + 1)
			l2 += 1
if l1 % 2 == l2 % 2:
	ans = []
	ansL = 0
	for i in range(0, l1 - 1, 2):
		ans.append([s1[i], s1[i + 1]])
		ansL += 1
	for i in range(0, l2 - 1, 2):
		ans.append([s2[i], s2[i + 1]])
		ansL += 1
	if l1 % 2 != 0:
		ansL += 2
		ans.append([s1[l1 - 1], s1[l1 - 1]])
		ans.append([s1[l1 - 1], s2[l2 - 1]])
	print(ansL)
	for i in ans:
		print(i[0], i[1])
else:
	print(-1)


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]

def list4d(a, b, c, d, e):
	return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]

def ceil(x, y=1):
	return int(-(-x // y))

def Yes():
	print('Yes')

def No():
	print('No')

def YES():
	print('YES')

def NO():
	print('NO')
INF = 10 ** 18
MOD = 10 ** 9 + 7
Ri = lambda : [int(x) for x in sys.stdin.readline().split()]
ri = lambda : sys.stdin.readline().strip()
n = int(ri())
s = ri()
t = ri()
cnt = [0] * 26
for i in s:
	cnt[ord(i) - ord('a')] += 1
for i in t:
	cnt[ord(i) - ord('a')] += 1
flag = True
for i in cnt:
	if i % 2 != 0:
		flag = False
		break
if not flag:
	print(-1)
	exit()
(cnt1, cnt2) = ([], [])
for i in range(n):
	if s[i] == 'a' and s[i] != t[i]:
		cnt1.append(i)
	if s[i] == 'b' and s[i] != t[i]:
		cnt2.append(i)
totans = []
for i in range(0, len(cnt1) - 1, 2):
	totans.append((cnt1[i] + 1, cnt1[i + 1] + 1))
for i in range(0, len(cnt2) - 1, 2):
	totans.append((cnt2[i] + 1, cnt2[i + 1] + 1))
if len(cnt1) % 2 != 0 or len(cnt1) % 2 != 0:
	totans.append((cnt1[-1] + 1, cnt1[-1] + 1))
	totans.append((cnt1[-1] + 1, cnt2[-1] + 1))
print(len(totans))
for i in totans:
	print(*i)


n = int(input())
a = input()
b = input()
d = {'ab': 0, 'ba': 0}
ca = 0
cb = 0
for i in range(n):
	if a[i] == 'a':
		ca += 1
	else:
		cb += 1
	if b[i] == 'a':
		ca += 1
	else:
		cb += 1
if ca % 2 == 1 or cb % 2 == 1:
	print(-1)
else:
	for i in range(n):
		if a[i] != b[i]:
			d[a[i] + b[i]] += 1
	print(d['ab'] // 2 + d['ba'] // 2 + d['ab'] % 2 + d['ba'] % 2)
	cross = False
	if d['ab'] != 0:
		prev = False
		for i in range(n):
			if a[i] + b[i] == 'ab':
				if not prev:
					prev = True
					pi = i
				else:
					print(pi + 1, i + 1)
					prev = False
		if prev:
			cross = pi + 1
	if d['ba'] != 0:
		prev = False
		for i in range(n):
			if a[i] + b[i] == 'ba':
				if not prev:
					prev = True
					pi = i
				else:
					print(pi + 1, i + 1)
					prev = False
		if cross:
			print(cross, cross)
			print(cross, pi + 1)


a = int(input())
s = input()
r = input()
cmap = []
tmap = []
for i in range(len(s)):
	if s[i] == 'a' and r[i] == 'b':
		cmap.append(i)
	elif s[i] == 'b' and r[i] == 'a':
		tmap.append(i)
r = len(cmap)
t = len(tmap)
if r % 2 == 1 and t % 2 == 0 or (r % 2 == 0 and t % 2 == 1):
	print(-1)
else:
	total = r // 2 + t // 2
	if r % 2 == 1 and t % 2 == 1:
		print(total + 2)
		for i in range(0, len(cmap) - 1, 2):
			print(cmap[i] + 1, cmap[i + 1] + 1)
		for i in range(0, len(tmap) - 1, 2):
			print(tmap[i] + 1, tmap[i + 1] + 1)
		print(cmap[-1] + 1, cmap[-1] + 1)
		print(cmap[-1] + 1, tmap[-1] + 1)
	else:
		print(total)
		for i in range(0, len(cmap), 2):
			print(cmap[i] + 1, cmap[i + 1] + 1)
		for i in range(0, len(tmap), 2):
			print(tmap[i] + 1, tmap[i + 1] + 1)


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)


import math
import random
import sys
n = int(input())
s = str(input())
t = str(input())
ab = []
ba = []
for i in range(n):
	if s[i] != t[i]:
		if s[i] == 'a':
			ab.append(i + 1)
		else:
			ba.append(i + 1)
if len(ab) % 2 != len(ba) % 2:
	print(-1)
else:
	print((len(ab) + len(ba)) // 2 + int(len(ab) % 2 != 0))
	it = 0
	while len(ab) - 1 > it:
		print(ab[it], ab[it + 1])
		it += 2
	it = 0
	while len(ba) - 1 > it:
		print(ba[it], ba[it + 1])
		it += 2
	if len(ab) % 2 != 0:
		print(ab[-1], ab[-1])
		print(ab[-1], ba[-1])


from collections import defaultdict as DD
from bisect import bisect_left as BL
from bisect import bisect_right as BR
from itertools import combinations as IC
from itertools import permutations as IP
from random import randint as RI
import sys
MOD = pow(10, 9) + 7

def IN(f=0):
	if f == 0:
		return [int(i) for i in sys.stdin.readline().split()]
	else:
		return int(sys.stdin.readline())
n = IN(1)
a = input()
b = input()
ab = []
ba = []
for i in range(n):
	if a[i] == 'a' and b[i] == 'b':
		ab.append(i + 1)
	elif a[i] == 'b' and b[i] == 'a':
		ba.append(i + 1)
h = []
y1 = len(ab) % 2
for i in range(1, len(ab), 2):
	h.append([ab[i - 1], ab[i]])
y2 = len(ba) % 2
for i in range(1, len(ba), 2):
	h.append([ba[i - 1], ba[i]])
if y1 != y2:
	print(-1)
elif y1 == 0:
	print(len(h))
	for i in h:
		print(i[0], i[1])
else:
	print(len(h) + 2)
	for i in h:
		print(i[0], i[1])
	print(ab[-1], ab[-1])
	print(ab[-1], ba[-1])


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, t) = (input(), input())
(a, b) = (list(), list())
for i in range(n):
	if s[i] == 'a' and t[i] == 'b':
		a.append(i + 1)
	elif s[i] == 'b' and t[i] == 'a':
		b.append(i + 1)
if (len(a) + len(b)) % 2 == 1:
	print(-1)
else:
	print((len(a) + len(b)) // 2 + len(a) % 2)
	for i in range(1, len(a), 2):
		print(a[i - 1], a[i])
	for i in range(1, len(b), 2):
		print(b[i - 1], b[i])
	if len(a) % 2 == 1:
		print(a[-1], a[-1])
		print(a[-1], b[-1])


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)
	exit()
print(len(tot))
for item in tot:
	print(*item)


x = int(input())
a = list(input())
b = list(input())
p = []
q = []
for n in range(x):
	if a[n] == 'a' and b[n] == 'b':
		p.append(n + 1)
	elif a[n] == 'b' and b[n] == 'a':
		q.append(n + 1)
if len(p) % 2 != len(q) % 2:
	print(-1)
	exit(0)
print(len(p) // 2 + len(q) // 2 + len(p) % 2 * 2)
for n in range(0, len(p), 2):
	if n < len(p) - 1:
		print(p[n], p[n + 1])
for n in range(0, len(q), 2):
	if n < len(q) - 1:
		print(q[n], q[n + 1])
if len(p) % 2:
	print(p[-1], p[-1])
	print(p[-1], q[-1])


import os
import sys
import math
from io import BytesIO, IOBase
from fractions import Fraction
import collections
from itertools import permutations
from collections import defaultdict
from collections import deque
import threading
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

class Factorial:

	def __init__(self, MOD):
		self.MOD = MOD
		self.factorials = [1, 1]
		self.invModulos = [0, 1]
		self.invFactorial_ = [1, 1]

	def calc(self, n):
		if n <= -1:
			print('Invalid argument to calculate n!')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		if n < len(self.factorials):
			return self.factorials[n]
		nextArr = [0] * (n + 1 - len(self.factorials))
		initialI = len(self.factorials)
		prev = self.factorials[-1]
		m = self.MOD
		for i in range(initialI, n + 1):
			prev = nextArr[i - initialI] = prev * i % m
		self.factorials += nextArr
		return self.factorials[n]

	def inv(self, n):
		if n <= -1:
			print('Invalid argument to calculate n^(-1)')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		p = self.MOD
		pi = n % p
		if pi < len(self.invModulos):
			return self.invModulos[pi]
		nextArr = [0] * (n + 1 - len(self.invModulos))
		initialI = len(self.invModulos)
		for i in range(initialI, min(p, n + 1)):
			next = -self.invModulos[p % i] * (p // i) % p
			self.invModulos.append(next)
		return self.invModulos[pi]

	def invFactorial(self, n):
		if n <= -1:
			print('Invalid argument to calculate (n^(-1))!')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		if n < len(self.invFactorial_):
			return self.invFactorial_[n]
		self.inv(n)
		nextArr = [0] * (n + 1 - len(self.invFactorial_))
		initialI = len(self.invFactorial_)
		prev = self.invFactorial_[-1]
		p = self.MOD
		for i in range(initialI, n + 1):
			prev = nextArr[i - initialI] = prev * self.invModulos[i % p] % p
		self.invFactorial_ += nextArr
		return self.invFactorial_[n]

class Combination:

	def __init__(self, MOD):
		self.MOD = MOD
		self.factorial = Factorial(MOD)

	def ncr(self, n, k):
		if k < 0 or n < k:
			return 0
		k = min(k, n - k)
		f = self.factorial
		return f.calc(n) * f.invFactorial(max(n - k, k)) * f.invFactorial(min(k, n - k)) % self.MOD
n = int(input())
a = input()
b = input()
if (a.count('a') + b.count('a')) % 2 != 0:
	print(-1)
	sys.exit(0)
a = list(a)
b = list(b)
r = []
one = []
two = []
for i in range(n):
	if a[i] == 'a' and b[i] == 'b':
		one.append(i + 1)
	elif a[i] == 'b' and b[i] == 'a':
		two.append(i + 1)
for i in range(0, len(one) - 1, 2):
	r.append((one[i], one[i + 1]))
for i in range(0, len(two) - 1, 2):
	r.append((two[i], two[i + 1]))
if len(one) % 2 == 1:
	r.append((one[-1], one[-1]))
	r.append((one[-1], two[-1]))
print(len(r))
for i in r:
	print(*i)


n = int(input())
s = list(input())
t = list(input())
ab = [idx for (idx, (s, t)) in enumerate(zip(s, t)) if (s == 'a') & (t == 'b')]
ba = [idx for (idx, (s, t)) in enumerate(zip(s, t)) if (s == 'b') & (t == 'a')]
if len(ab) + len(ba) & 1:
	print(-1)
else:
	print(len(ab) // 2 + len(ba) // 2 + len(ab) % 2 + len(ba) % 2)
	for (i, j) in zip(ab[::2], ab[1::2]):
		print(i + 1, j + 1)
	for (i, j) in zip(ba[::2], ba[1::2]):
		print(i + 1, j + 1)
	if len(ab) % 2 + len(ba) % 2:
		print(ab[-1] + 1, ab[-1] + 1)
		print(ab[-1] + 1, ba[-1] + 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())
s1 = input()
s2 = input()
ab = []
ba = []

def one():
	global s1, s2
	global ab, ba
	for i in range(len(s1)):
		if s1[i] == 'a' and s2[i] == 'b':
			ab.append(i + 1)
		if s1[i] == 'b' and s2[i] == 'a':
			ba.append(i + 1)
if (s1.count('a') + s2.count('a')) % 2 == 1:
	print(-1)
elif s1 == s2:
	print(0)
else:
	one()
	(a, b) = (len(ab), len(ba))
	print(str(a // 2 + b // 2 + 2 * (a % 2)))
	i = 0
	while i + 1 < len(ab):
		print(str(ab[i]) + ' ' + str(ab[i + 1]))
		i += 2
	i = 0
	while i + 1 < len(ba):
		print(str(ba[i]) + ' ' + str(ba[i + 1]))
		i += 2
	if len(ab) % 2 == 1:
		(i, j) = (ab[len(ab) - 1], ba[len(ba) - 1])
		print(str(i) + ' ' + str(i))
		print(str(i) + ' ' + str(j))


from sys import stdin, stdout
from math import floor, gcd, fabs, factorial, fmod, sqrt, inf, log
from collections import defaultdict as dd, deque
from heapq import merge, heapify, heappop, heappush, nsmallest
from bisect import bisect_left as bl, bisect_right as br, bisect
mod = pow(10, 9) + 7
mod2 = 998244353

def inp():
	return stdin.readline().strip()

def iinp():
	return int(inp())

def out(var, end='\n'):
	stdout.write(str(var) + '\n')

def outa(*var, end='\n'):
	stdout.write(' '.join(map(str, var)) + end)

def lmp():
	return list(mp())

def mp():
	return map(int, inp().split())

def smp():
	return map(str, inp().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(m, val) for j in range(n)]

def remadd(x, y):
	return 1 if x % y else 0

def ceil(a, b):
	return (a + b - 1) // b
S1 = 'abcdefghijklmnopqrstuvwxyz'
S2 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'

def isprime(x):
	if x <= 1:
		return False
	if x in (2, 3):
		return True
	if x % 2 == 0:
		return False
	for i in range(3, int(sqrt(x)) + 1, 2):
		if x % i == 0:
			return False
	return True
n = iinp()
s = inp()
t = inp()
(a, b) = ([], [])
for i in range(n):
	if s[i] == t[i]:
		continue
	if s[i] == 'a':
		a.append(i + 1)
	else:
		b.append(i + 1)
if (len(a) + len(b)) % 2:
	print(-1)
else:
	ml = []
	for i in range(0, len(a) - 1, 2):
		ml.append((a[i], a[i + 1]))
	for i in range(0, len(b) - 1, 2):
		ml.append((b[i], b[i + 1]))
	if len(a) % 2:
		i = a[-1]
		j = b[-1]
		ml.append((i, i))
		ml.append((i, j))
	print(len(ml))
	for i in ml:
		print(*i)


from collections import Counter
n = int(input())
s = input()
t = input()
x1 = Counter(s)
x2 = Counter(t)
if (x1['a'] + x2['a']) % 2 != 0 or (x1['b'] + x2['b']) % 2 != 0:
	print(-1)
else:
	l1 = []
	l2 = []
	for i in range(n):
		if s[i] != t[i]:
			if s[i] == 'a':
				l1.append(i + 1)
			else:
				l2.append(i + 1)
	ans = []
	for j in range(0, len(l1) - 1, 2):
		zz = [l1[j], l1[j + 1]]
		ans.append(zz)
	for jr in range(0, len(l2) - 1, 2):
		zz1 = [l2[jr], l2[jr + 1]]
		ans.append(zz1)
	if len(l1) % 2:
		w1 = l1[-1]
		w2 = l2[-1]
		a11 = [w1, w1]
		a12 = [w1, w2]
		ans.append(a11)
		ans.append(a12)
	print(len(ans))
	for ty in ans:
		print(*ty)


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)


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])


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

def check(a, b):
	if (len(a) + len(b)) % 2 == 1:
		print(-1)
	else:
		seq = []
		N = 0
		la = len(a) - len(a) % 2
		lb = len(b) - len(b) % 2
		N += la // 2 + lb // 2
		for i in range(0, la // 2):
			seq += [(a[2 * i] + 1, a[2 * i + 1] + 1)]
		for i in range(0, lb // 2):
			seq += [(b[2 * i] + 1, b[2 * i + 1] + 1)]
		la = len(a) - 1
		lb = len(b) - 1
		if la % 2 == 0:
			seq += [(a[la] + 1, a[la] + 1)]
			seq += [(a[la] + 1, b[lb] + 1)]
			N += 2
		print(N)
		for i in range(0, len(seq)):
			print(seq[i][0], seq[i][1])
a = []
b = []
for i in range(0, n):
	if s[i] != t[i]:
		if s[i] == 'a':
			a += [i]
		else:
			b += [i]
check(a, b)


n = int(input())
s1 = input().strip()
s2 = input().strip()
a1 = s1.count('a')
b1 = s1.count('b')
a2 = s2.count('a')
b2 = s2.count('b')
if (a1 + a2) % 2 == 0 and (b1 + b2) % 2 == 0:
	ab = []
	ba = []
	for i in range(n):
		if s1[i] == 'a' and s2[i] == 'b':
			ab.append(i + 1)
		elif s1[i] == 'b' and s2[i] == 'a':
			ba.append(i + 1)
	l1 = len(ab)
	l2 = len(ba)
	ans = l1 // 2 + l2 // 2
	ansList = []
	for i in range(0, l1, 2):
		if i + 1 <= l1 - 1:
			ansList.append([ab[i], ab[i + 1]])
	for i in range(0, l2, 2):
		if i + 1 <= l2 - 1:
			ansList.append([ba[i], ba[i + 1]])
	if l1 % 2 == 1 and l2 % 2 == 1:
		ansList.append([ab[-1], ab[-1]])
		ansList.append([ab[-1], ba[-1]])
		ans += 2
	print(ans)
	for i in range(ans):
		print(*ansList[i])
else:
	print(-1)


n = int(input())
s = input()
t = input()
res = {'ab': [], 'ba': []}
for i in range(n):
	if s[i] != t[i]:
		res[s[i] + t[i]].append(i)
r1 = len(res['ab'])
r2 = len(res['ba'])
l1 = r1 + r2
if l1 % 2 == 0:
	val = r1 // 2 + r2 // 2 + r1 % 2 + r2 % 2
	print(val)
	for i in range(1, r1, 2):
		print(res['ab'][i - 1] + 1, res['ab'][i] + 1)
	for i in range(1, r2, 2):
		print(res['ba'][i - 1] + 1, res['ba'][i] + 1)
	if r1 % 2 == 1:
		i = res['ab'][-1]
		j = res['ba'][-1]
		print(i + 1, i + 1)
		print(i + 1, j + 1)
else:
	print(-1)


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 = input()
t = input()
ab = []
ba = []
for i in range(n):
	if s[i] == t[i]:
		continue
	elif 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)


n = int(input())
s1 = list(input())
s2 = list(input())
(ab, ba) = ([], [])
for i in range(n):
	if s1[i] + s2[i] == 'ab':
		ab.append(i + 1)
	elif s1[i] + s2[i] == 'ba':
		ba.append(i + 1)
if len(ab) & 1 != len(ba) & 1:
	print(-1)
	exit()
ret = []
for i in range(0, len(ab) - 1, 2):
	ret.append('%d %d' % (ab[i], ab[i + 1]))
for i in range(0, len(ba) - 1, 2):
	ret.append('%d %d' % (ba[i], ba[i + 1]))
if len(ab) & 1 == 1:
	ret.extend(('%d %d' % (ab[-1], ab[-1]), '%d %d' % (ab[-1], ba[-1])))
print('%d\n%s' % (len(ret), '\n'.join(ret)))


import bisect

def readInt():
	x = int(input())
	return x

def readList():
	x = map(int, input().split(' '))
	return list(x)
tx = readInt()
s = input()
t = input()
(sa, sb) = (s.count('a'), s.count('b'))
(ta, tb) = (t.count('a'), t.count('b'))
if (ta + sa) % 2 == (tb + sb) % 2 and (ta + sa) % 2 == 0:
	(vab, vba) = ([], [])
	(ab, ba) = (0, 0)
	for i in range(tx):
		if s[i] == 'a' and t[i] == 'b':
			ab += 1
			vab.append(i)
		elif t[i] == 'a' and s[i] == 'b':
			ba += 1
			vba.append(i)
		else:
			continue
	swaps = ab // 2 + ba // 2
	ab %= 2
	ba %= 2
	swaps += ab + ba
	print(swaps)
	if len(vab) % 2 == 0:
		for i in range(0, len(vab), 2):
			print(vab[i] + 1, vab[i + 1] + 1)
		for i in range(0, len(vba), 2):
			print(vba[i] + 1, vba[i + 1] + 1)
	else:
		for i in range(0, len(vab) - 1, 2):
			print(vab[i] + 1, vab[i + 1] + 1)
		for i in range(0, len(vba) - 1, 2):
			print(vba[i] + 1, vba[i + 1] + 1)
		(lvab, lvba) = (len(vab), len(vba))
		print(vab[lvab - 1] + 1, vab[lvab - 1] + 1)
		print(vab[lvab - 1] + 1, vba[lvba - 1] + 1)
else:
	print('-1')


n = int(input())
s = input()
t = input()
if (s.count('a') + t.count('a')) % 2 != 0:
	print(-1)
	exit()
a = []
b = []
for i in range(n):
	if s[i] != t[i]:
		if s[i] == 'a':
			a += [i]
		else:
			b += [i]
swaps = len(a) // 2 + len(b) // 2
swaps += len(a) % 2 * 2
print(swaps)
for i in range(len(a) // 2):
	print(a[2 * i] + 1, a[2 * i + 1] + 1)
for i in range(len(b) // 2):
	print(b[2 * i] + 1, b[2 * i + 1] + 1)
if len(a) % 2 != 0:
	print(a[-1] + 1, a[-1] + 1)
	print(a[-1] + 1, b[-1] + 1)


n = int(input())
s = input()
t = input()
if s == t:
	print(0)
	exit()
cnta = s.count('a') + t.count('a')
cntb = s.count('b') + t.count('b')
if cnta % 2 != 0 or cntb % 2 != 0:
	print(-1)
	exit()
else:
	ab = []
	ba = []
	for i in range(n):
		if s[i] == 'a' and t[i] == 'b':
			ab.append(i)
		if s[i] == 'b' and t[i] == 'a':
			ba.append(i)
	if len(ab) % 2 == 0 and len(ba) % 2 != 0 or (len(ab) % 2 != 0 and len(ba) % 2 == 0):
		print(-1)
		exit()
	if len(ab) % 2 == 0 and len(ba) % 2 == 0:
		ans = len(ab) // 2 + len(ba) // 2
		l = []
		i = 0
		while i < len(ab):
			l.append((ab[i] + 1, ab[i + 1] + 1))
			i += 2
		i = 0
		while i < len(ba):
			l.append((ba[i] + 1, ba[i + 1] + 1))
			i += 2
		print(ans)
		for i in l:
			print(*i)
	else:
		ans = len(ab) // 2 + len(ba) // 2
		l = []
		i = 0
		while i < len(ab) - 1:
			l.append((ab[i] + 1, ab[i + 1] + 1))
			i += 2
		i = 0
		while i < len(ba) - 1:
			l.append((ba[i] + 1, ba[i + 1] + 1))
			i += 2
		l.append((ab[-1] + 1, ab[-1] + 1))
		l.append((ab[-1] + 1, ba[-1] + 1))
		print(ans + 2)
		for i in l:
			print(*i)


from collections import defaultdict as dd
n = int(input())
s = input()
ss = input()
d = dd(list)
for i in range(n):
	sss = s[i] + ss[i]
	d[sss].append(i + 1)
ll = []
res = 0
lol = 0
if len(d['ab']) % 2 == 0 and len(d['ba']) % 2 == 1 or (len(d['ba']) % 2 == 0 and len(d['ab']) % 2 == 1):
	lol = 1
elif len(d['ab']) % 2 == 0:
	for i in range(0, len(d['ab']), 2):
		ll.append((d['ab'][i], d['ab'][i + 1]))
		res += 1
	for i in range(0, len(d['ba']), 2):
		ll.append((d['ba'][i], d['ba'][i + 1]))
		res += 1
else:
	for i in range(0, len(d['ab']) - 1, 2):
		ll.append((d['ab'][i], d['ab'][i + 1]))
		res += 1
	for i in range(0, len(d['ba']) - 1, 2):
		ll.append((d['ba'][i], d['ba'][i + 1]))
		res += 1
	res += 2
	ll.append((d['ab'][-1], d['ab'][-1]))
	ll.append((d['ab'][-1], d['ba'][-1]))
if lol == 1:
	print(-1)
else:
	print(res)
	for i in ll:
		print(*i)


def main():
	n = int(input())
	s1 = str(input())
	s2 = str(input())
	if s1 == s2:
		print(0)
		return
	a = []
	b = []
	cnt = 0
	for i in range(n):
		if s1[i] != s2[i]:
			cnt += 1
			if s1[i] == 'a':
				a.append(i + 1)
			else:
				b.append(i + 1)
	if cnt % 2:
		print(-1)
		return
	if len(a) % 2:
		print((len(a) + len(b)) // 2 + 1)
	else:
		print((len(a) + len(b)) // 2)
	for i in range(0, len(a) - len(a) % 2, 2):
		print(a[i], a[i + 1])
	for i in range(0, len(b) - len(b) % 2, 2):
		print(b[i], b[i + 1])
	if len(a) % 2 != 0:
		print(a[-1], a[-1])
		print(a[-1], b[-1])
	return
main()


n = int(input())
a = list(input())
b = list(input())
same = 0
ab = 0
ba = 0
abi = []
bai = []
for i in range(n):
	if a[i] == 'a' and b[i] == 'b':
		ab += 1
		abi.append(i + 1)
	elif a[i] == 'b' and b[i] == 'a':
		ba += 1
		bai.append(i + 1)
k = ab // 2 + ba // 2
if ab % 2 + ba % 2 == 0:
	l = 1
	print(k)
elif ab % 2 + ba % 2 == 2:
	l = 2
	print(k + 2)
else:
	l = 0
	print(-1)
if l == 1:
	i = 0
	while i < len(abi):
		print(abi[i], abi[i + 1])
		i += 2
	i = 0
	while i < len(bai):
		print(bai[i], bai[i + 1])
		i += 2
elif l == 2:
	i = 0
	while i < len(abi) - 1:
		print(abi[i], abi[i + 1])
		i += 2
	i = 0
	while i < len(bai) - 1:
		print(bai[i], bai[i + 1])
		i += 2
	print(abi[-1], abi[-1])
	print(abi[-1], bai[-1])


n = int(input())
a = input()
b = input()
temp = []
d = {'a': [], 'b': []}
for i in range(len(a)):
	if a[i] != b[i]:
		d[a[i]].append(i + 1)
if (len(d['a']) + len(d['b'])) % 2 != 0:
	print(-1)
else:
	cnt = 0
	final = []
	if len(d['a']) > 1:
		for i in range(0, len(d['a']) - 1, 2):
			s = str(d['a'][i])
			s = s + ' ' + str(d['a'][i + 1])
			cnt = cnt + 1
			final.append(s)
	if len(d['b']) > 1:
		for i in range(0, len(d['b']) - 1, 2):
			s = str(d['b'][i])
			s = s + ' ' + str(d['b'][i + 1])
			final.append(s)
			cnt = cnt + 1
	if len(d['a']) % 2 == 1:
		s1 = str(d['a'][len(d['a']) - 1]) + ' ' + str(d['a'][len(d['a']) - 1])
		s2 = str(d['a'][len(d['a']) - 1]) + ' ' + str(d['b'][len(d['b']) - 1])
		final.append(s1)
		final.append(s2)
		cnt = cnt + 2
	print(cnt)
	for i in final:
		print(i)


from bisect import *
from collections import *
from itertools import *
import functools
import sys
import math
from decimal import *
from copy import *
from heapq import *
getcontext().prec = 30
MAX = sys.maxsize
MAXN = 10 ** 5 + 10
MOD = 10 ** 9 + 7

def isprime(n):
	n = abs(int(n))
	if n < 2:
		return False
	if n == 2:
		return True
	if not n & 1:
		return False
	for x in range(3, int(n ** 0.5) + 1, 2):
		if n % x == 0:
			return False
	return True

def mhd(a, b):
	return abs(a[0] - b[0]) + abs(b[1] - a[1])

def charIN(x=' '):
	return sys.stdin.readline().strip().split(x)

def arrIN(x=' '):
	return list(map(int, sys.stdin.readline().strip().split(x)))

def eld(x, y):
	a = y[0] - x[0]
	b = x[1] - y[1]
	return (a * a + b * b) ** 0.5

def lgcd(a):
	g = a[0]
	for i in range(1, len(a)):
		g = math.gcd(g, a[i])
	return g

def ms(a):
	msf = -MAX
	meh = 0
	st = en = be = 0
	for i in range(len(a)):
		meh += a[i]
		if msf < meh:
			msf = meh
			st = be
			en = i
		if meh < 0:
			meh = 0
			be = i + 1
	return (msf, st, en)

def ncr(n, r):
	num = den = 1
	for i in range(r):
		num = num * (n - i) % MOD
		den = den * (i + 1) % MOD
	return num * pow(den, MOD - 2, MOD) % MOD

def flush():
	return sys.stdout.flush()

def fac(n):
	ans = 1
	for i in range(1, n + 1):
		ans *= i
		ans %= MOD
	return ans
n = int(input())
s1 = [i for i in input()]
s2 = [i for i in input()]
ab = []
ba = []
ans = []
a1 = s1.count('a')
a2 = s2.count('a')
b1 = s1.count('b')
b2 = s2.count('b')
if (a1 + a2) % 2 or (b1 + b2) % 2:
	print(-1)
	exit(0)
for i in range(n):
	if s1[i] + s2[i] == 'ab':
		ab.append(i)
	elif s1[i] + s2[i] == 'ba':
		ba.append(i)
j = 0
while j < len(ab) - 1:
	ans.append([ab[j] + 1, ab[j + 1] + 1])
	(s1[ab[j]], s2[ab[j + 1]]) = (s2[ab[j + 1]], s1[ab[j]])
	j += 2
k = 0
while k < len(ba) - 1:
	ans.append([ba[k] + 1, ba[k + 1] + 1])
	(s1[ba[k]], s2[ba[k + 1]]) = (s2[ba[k + 1]], s1[ba[k]])
	k += 2
if j == len(ab):
	if k == len(ba):
		print(len(ans))
		for i in ans:
			print(*i)
	else:
		print(-1)
elif k == len(ba):
	if j == len(ab):
		print(len(ans))
		for i in ans:
			print(*i)
	else:
		print(-1)
else:
	ans.append([ab[j] + 1, ab[j] + 1])
	ans.append([ab[j] + 1, ba[k] + 1])
	print(len(ans))
	for i in ans:
		print(*i)


def answer(n, A, B):
	count = 0
	d = {}
	for i in range(n):
		if A[i] == 'a':
			count += 1
		if B[i] == 'a':
			count += 1
		if (A[i], B[i]) in d:
			d[A[i], B[i]].append(i + 1)
		else:
			d[A[i], B[i]] = [i + 1]
	if count % 2 != 0:
		return -1
	ans = []
	k1 = -1
	k2 = -1
	if ('a', 'b') in d:
		v = d['a', 'b']
		for i in range(0, len(v) - len(v) % 2, 2):
			ans.append([v[i], v[i + 1]])
		if len(v) % 2 != 0:
			k1 = v[-1]
	if ('b', 'a') in d:
		v = d['b', 'a']
		for i in range(0, len(v) - len(v) % 2, 2):
			ans.append([v[i], v[i + 1]])
		if len(v) % 2 != 0:
			k2 = v[-1]
	if k1 != -1 and k2 != -1:
		ans.append([k1, k1])
		ans.append([k1, k2])
	return ans
n = int(input())
s = input()
t = input()
y = answer(n, s, t)
if y == -1:
	print(-1)
else:
	print(len(y))
	for i in range(len(y)):
		print(*y[i])


n = int(input())
a = list(input())
b = list(input())
aa = 0
bb = 0
c = []
d = []
for i in range(n):
	if a[i] != b[i]:
		if a[i] == 'a':
			aa += 1
			c.append(i + 1)
		else:
			bb += 1
			d.append(i + 1)
if aa % 2 != bb % 2:
	print(-1)
elif aa % 2 == 0:
	print(aa // 2 + bb // 2)
	i = 0
	while i < len(c) - 1:
		print(c[i], c[i + 1])
		i += 2
	i = 0
	while i < len(d) - 1:
		print(d[i], d[i + 1])
		i += 2
else:
	i = 0
	print(aa // 2 + bb // 2 + 2)
	while i < len(c) - 2:
		print(c[i], c[i + 1])
		i += 2
	i = 0
	while i < len(d) - 2:
		print(d[i], d[i + 1])
		i += 2
	print(c[-1], c[-1])
	print(c[-1], d[-1])


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 = []
two = []
for i in range(n):
	if a[i] == b[i]:
		pass
	elif 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]))
	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)


n = int(input())
s = input()
t = input()
s_a = []
s_b = []
diffs = 0
for i in range(n):
	if s[i] != t[i]:
		diffs += 1
		if s[i] == 'a':
			s_a.append(i + 1)
		else:
			s_b.append(i + 1)
if diffs % 2 != 0:
	print('-1')
else:
	if len(s_a) % 2 == 0:
		print(len(s_a) // 2 + len(s_b) // 2)
	else:
		print(len(s_a) // 2 + len(s_b) // 2 + 2)
	for i in range(0, len(s_a) - 1, 2):
		print(str(s_a[i]) + ' ' + str(s_a[i + 1]))
	for i in range(0, len(s_b) - 1, 2):
		print(str(s_b[i]) + ' ' + str(s_b[i + 1]))
	if len(s_a) % 2 != 0:
		print(str(s_a[-1]) + ' ' + str(s_a[-1]))
		print(str(s_a[-1]) + ' ' + str(s_b[-1]))


n = int(input())
s1 = input()
s2 = input()
cnt1 = 0
cnt2 = 0
swap = []
a = []
b = []
c = s1.count('a') + s2.count('a')
cc = s1.count('b') + s2.count('b')
if c % 2 != 0 or cc % 2 != 0:
	print(-1)
	exit()
for i in range(n):
	if s1[i] == 'a' and s2[i] == 'b':
		cnt1 += 1
		a.append(i + 1)
	elif s1[i] == 'b' and s2[i] == 'a':
		cnt2 += 1
		b.append(i + 1)
if cnt1 % 2 == 0:
	ans = cnt1 // 2 + cnt2 // 2
	print(ans)
	i = 0
	while i < len(a) - 1:
		print(a[i], a[i + 1])
		i += 2
	i = 0
	while i < len(b) - 1:
		print(b[i], b[i + 1])
		i = i + 2
else:
	ans = cnt1 // 2 + cnt2 // 2 + 2
	print(ans)
	i = 0
	while i < len(a) - 1:
		print(a[i], a[i + 1])
		i += 2
	i = 0
	while i < len(b) - 1:
		print(b[i], b[i + 1])
		i = i + 2
	x = a.pop()
	y = b.pop()
	print(x, x)
	print(x, y)


n = int(input())
s = input()
t = input()
ab = []
ba = []
for i in range(0, 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)
	exit()
moves = []
for i in range(int(len(ab) / 2)):
	moves.append((ab[i * 2], ab[i * 2 + 1]))
for i in range(int(len(ba) / 2)):
	moves.append((ba[i * 2], ba[i * 2 + 1]))
if len(ab) % 2 == 1:
	last_ab = ab[len(ab) - 1]
	last_ba = ba[len(ba) - 1]
	moves.append((last_ab, last_ab))
	moves.append((last_ab, last_ba))
print(len(moves))
for m in moves:
	print(m[0] + 1, m[1] + 1)


n = int(input())
s = input()
t = input()
i = 1
count = 0
arr1 = []
arr2 = []
while i < n + 1:
	if s[i - 1] != t[i - 1]:
		if s[i - 1] == 'a':
			arr1.append(i)
		else:
			arr2.append(i)
	i += 1
x = len(arr1)
y = len(arr2)
if (x + y) % 2 == 1:
	print(-1)
else:
	print(x // 2 + y // 2 + 2 * (x % 2))
	for i in range(0, x - 1, 2):
		print(str(arr1[i]) + ' ' + str(arr1[i + 1]))
	for i in range(0, y - 1, 2):
		print(str(arr2[i]) + ' ' + str(arr2[i + 1]))
	if x % 2 == 1:
		print(str(arr1[-1]) + ' ' + str(arr1[-1]))
		print(str(arr1[-1]) + ' ' + str(arr2[-1]))


n = int(input())
s = input()
t = input()
ab = 0
ba = 0
ab_index = []
ba_index = []
swap_index = []
for i in range(n):
	if s[i] == 'a' and t[i] == 'b':
		ab_index.append(i)
	elif s[i] == 'b' and t[i] == 'a':
		ba_index.append(i)
ab = len(ab_index)
ba = len(ba_index)
if (ab + ba) % 2:
	print(-1)
else:
	ans = 0
	ans += ab // 2
	ans += ba // 2
	if ab % 2:
		ans += 2
	for i in range(0, ab, 2):
		if i == ab - 1:
			break
		swap_index.append([ab_index[i], ab_index[i + 1]])
	for i in range(0, ba, 2):
		if i == ba - 1:
			break
		swap_index.append([ba_index[i], ba_index[i + 1]])
	if ab % 2:
		swap_index.append([ab_index[-1], ab_index[-1]])
		swap_index.append([ab_index[-1], ba_index[-1]])
	print(ans)
	for i in swap_index:
		print(i[0] + 1, i[1] + 1)


n = int(input())
(s1, s2) = (input(), input())
(arr1, arr2) = ([0] * n, [0] * n)
for i in range(n):
	arr1[i] = 0 if s1[i] == 'a' else 1
	arr2[i] = 0 if s2[i] == 'a' else 1
if (sum(arr1) + sum(arr2)) % 2 != 0:
	print(-1)
else:
	problem0 = []
	problem1 = []
	ans = []
	for i in range(n):
		if arr1[i] == 0 and arr2[i] == 1:
			problem0.append(i)
		if arr1[i] == 1 and arr2[i] == 0:
			problem1.append(i)
	for i in range(1, len(problem0), 2):
		ans.append([problem0[i - 1], problem0[i]])
	for i in range(1, len(problem1), 2):
		ans.append([problem1[i - 1], problem1[i]])
	(n1, n2) = (len(problem0), len(problem1))
	if n1 % 2 != 0:
		ans.append([problem0[n1 - 1], problem0[n1 - 1]])
		ans.append([problem0[n1 - 1], problem1[n2 - 1]])
	print(len(ans))
	for row in ans:
		print(' '.join([str(elem + 1) for elem in row]))


n = int(input())
s1 = str(input())
s2 = str(input())
ab = []
ba = []
ans = 0
anss = []
l = []
for i in range(n):
	if s1[i] != s2[i]:
		l.append(i)
if len(l) == 0:
	print(0)
else:
	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)
	ans += len(ab) // 2 + len(ba) // 2
	c = len(ab)
	d = len(ba)
	for i in range(0, len(ab), 2):
		if i != c - 1:
			anss.append([ab[i] + 1, ab[i + 1] + 1])
	for i in range(0, len(ba), 2):
		if i != d - 1:
			anss.append([ba[i] + 1, ba[i + 1] + 1])
	if c % 2 == 0 and d % 2 == 0:
		print(ans)
		for i in anss:
			print(*i)
	elif c % 2 != 0 and d % 2 != 0:
		ans += 2
		anss.append([ab[-1] + 1, ab[-1] + 1])
		anss.append([ab[-1] + 1, ba[-1] + 1])
		print(ans)
		for i in anss:
			print(*i)
	else:
		print(-1)


def run():
	n = eval(input())
	s1 = input()
	s2 = input()
	num_diffs = 0
	one_ind = []
	two_ind = []
	for i in range(n):
		if s1[i] != s2[i]:
			if s1[i] == 'a':
				one_ind.append(i)
			else:
				two_ind.append(i)
	if (len(one_ind) + len(two_ind)) % 2 == 1:
		print(-1)
		return
	result = []
	c = 0
	last_one = None
	last_two = None
	i = 0
	while i < len(one_ind):
		if i == len(one_ind) - 1:
			break
		result.append(str(one_ind[i] + 1) + ' ' + str(one_ind[i + 1] + 1))
		i += 2
	if i == len(one_ind) - 1:
		one_ind = one_ind[i:]
	else:
		one_ind = []
	j = 0
	while j < len(two_ind):
		if j == len(two_ind) - 1:
			break
		result.append(str(two_ind[j] + 1) + ' ' + str(two_ind[j + 1] + 1))
		j += 2
	if j == len(two_ind) - 1:
		two_ind = two_ind[j:]
	else:
		two_ind = []
	if len(two_ind) > 0:
		result.append(str(one_ind[-1] + 1) + ' ' + str(one_ind[-1] + 1))
		result.append(str(one_ind[-1] + 1) + ' ' + str(two_ind[-1] + 1))
	c = len(result)
	print(c)
	for i in result:
		print(i)
run()


import os
import sys
debug = True
if debug and os.path.exists('input.in'):
	input = open('input.in', 'r').readline
else:
	debug = False
	input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return s[:len(s) - 1]

def invr():
	return map(int, input().split())
test_count = 1
if debug:
	test_count = int(input())
for t in range(test_count):
	if debug:
		print('Test Case #', t + 1)
	n = inp()
	a = insr()
	b = insr()
	aIndex = list()
	bIndex = list()
	if (a.count('a') + b.count('a')) % 2 != 0:
		print(-1)
	else:
		for i in range(n):
			if a[i] != b[i]:
				if a[i] == 'a':
					aIndex.append(i + 1)
				else:
					bIndex.append(i + 1)
		steps = len(aIndex) // 2 + len(bIndex) // 2 + len(aIndex) % 2 + len(bIndex) % 2
		print(steps)
		for i in range(0, len(aIndex) - 1, 2):
			print(aIndex[i], aIndex[i + 1])
		for i in range(0, len(bIndex) - 1, 2):
			print(bIndex[i], bIndex[i + 1])
		if len(aIndex) % 2 == 1:
			print(aIndex[-1], aIndex[-1])
			print(aIndex[-1], bIndex[-1])