Polycarp is a head of a circus troupe. There are n — an even number — artists in the troupe. It is known whether the i-th artist can perform as a clown (if yes, then c_i = 1, otherwise c_i = 0), and whether they can perform as an acrobat (if yes, then a_i = 1, otherwise a_i = 0).

Split the artists into two performances in such a way that: 

  * each artist plays in exactly one performance, 
  * the number of artists in the two performances is equal (i.e. equal to n/2), 
  * the number of artists that can perform as clowns in the first performance is the same as the number of artists that can perform as acrobats in the second performance. 

Input

The first line contains a single integer n (2 ≤ n ≤ 5 000, n is even) — the number of artists in the troupe.

The second line contains n digits c_1 c_2 … c_n, the i-th of which is equal to 1 if the i-th artist can perform as a clown, and 0 otherwise.

The third line contains n digits a_1 a_2 … a_n, the i-th of which is equal to 1, if the i-th artist can perform as an acrobat, and 0 otherwise.

Output

Print n/2 distinct integers — the indices of the artists that should play in the first performance.

If there are multiple answers, print any.

If there is no solution, print a single integer -1.

Examples

Input


4
0011
0101


Output


1 4


Input


6
000000
111111


Output


-1


Input


4
0011
1100


Output


4 3


Input


8
00100101
01111100


Output


1 2 3 6

Note

In the first example, one of the possible divisions into two performances is as follows: in the first performance artists 1 and 4 should take part. Then the number of artists in the first performance who can perform as clowns is equal to 1. And the number of artists in the second performance who can perform as acrobats is 1 as well.

In the second example, the division is not possible.

In the third example, one of the possible divisions is as follows: in the first performance artists 3 and 4 should take part. Then in the first performance there are 2 artists who can perform as clowns. And the number of artists in the second performance who can perform as acrobats is 2 as well.

Difficulty: MEDIUM_HARD
Tags: String algorithms

Complete search

Mathematics

Greedy algorithms
Skill types: Complete search

Greedy algorithms

Starter code:

Solutions:
import sys
import random
N = int(input())
C = list(map(int, input()))
A = list(map(int, input()))

def build_solution(i, j, x, y):
	I = (0, 0)
	J = (0, 1)
	X = (1, 0)
	Y = (1, 1)
	ans = []
	for q in range(N):
		p = (C[q], A[q])
		if i and p == I:
			i -= 1
			ans.append(q + 1)
		elif j and p == J:
			j -= 1
			ans.append(q + 1)
		elif x and p == X:
			x -= 1
			ans.append(q + 1)
		elif y and p == Y:
			y -= 1
			ans.append(q + 1)
	return map(str, ans)
a = b = c = d = 0
for i in range(N):
	if C[i] == 0:
		if A[i] == 0:
			a += 1
		else:
			b += 1
	elif A[i] == 0:
		c += 1
	else:
		d += 1
for i in range(0, a + 1):
	y = -N // 2 + i + b + d
	if y < 0:
		continue
	min_j = max(0, N // 2 - i - c - y)
	max_j = min(b + 1, N // 2 + 1)
	for j in range(min_j, max_j):
		x = N // 2 - i - j - y
		if x < 0:
			break
		if not (0 <= x <= c and 0 <= y <= d):
			continue
		sol = build_solution(i, j, x, y)
		print(' '.join(sol))
		exit(0)
print(-1)


from collections import defaultdict

def solve(type_size, type_dict):
	ret = []
	for (i, k) in enumerate([('0', '0'), ('0', '1'), ('1', '0'), ('1', '1')]):
		for j in range(type_size[i]):
			ret.append(type_dict[k][j] + 1)
	print(*ret)

def main():
	n = int(input())
	c = input()
	a = input()
	type_dict = defaultdict(list)
	for i in range(n):
		type_dict[c[i], a[i]].append(i)
	temp = len(type_dict['0', '1']) + len(type_dict['1', '1'])
	for i in range(len(type_dict['0', '1']) + 1):
		for j in range(len(type_dict['1', '0']) + 1):
			if i + j > temp:
				break
			if (temp - i - j) % 2:
				continue
			k = (temp - i - j) // 2
			if k > len(type_dict['1', '1']):
				continue
			if n // 2 - i - j - k > len(type_dict['0', '0']):
				continue
			if i + j + k > n // 2:
				continue
			solve([n // 2 - i - j - k, i, j, k], type_dict)
			return
	print('-1')
main()


import sys
input = sys.stdin.readline
n = int(input())
x = input()
y = input()
a = []
b = []
c = []
d = []
for i in range(n):
	if x[i] == '0' and y[i] == '0':
		a.append(i + 1)
	elif x[i] == '0' and y[i] == '1':
		b.append(i + 1)
	elif x[i] == '1' and y[i] == '0':
		c.append(i + 1)
	elif x[i] == '1' and y[i] == '1':
		d.append(i + 1)
n_a = len(a)
n_b = len(b)
n_c = len(c)
n_d = len(d)
state = True
box = []
for i in range(n_a + 1):
	for j in range(n_d + 1):
		if i - j == n // 2 - n_b - n_d:
			if 0 <= n // 2 - i - j <= n_b + n_c:
				s = i
				v = j
				state = False
				break
if state:
	print(-1)
else:
	t = min(n_b, n // 2 - s - v)
	u = n // 2 - s - v - t
	for i in range(s):
		print(a.pop(), end=' ')
	for i in range(v):
		print(d.pop(), end=' ')
	for i in range(t):
		print(b.pop(), end=' ')
	for j in range(u):
		print(c.pop(), end=' ')
	print()


from collections import *
from math import *
n = int(input())
s = input()
t = input()
d = dict()
(d['00'], d['01'], d['10'], d['11']) = (0, 0, 0, 0)
for i in range(n):
	x = s[i] + t[i]
	d[x] += 1
na = d['00']
nb = d['01']
nc = d['10']
nd = d['11']
for i in range(nb + 1):
	for j in range(nc + 1):
		(b, c) = (i, j)
		if (nb + nd - b - c) % 2 == 1:
			continue
		d = (nb + nd - b - c) // 2
		if d < 0 or d > nd:
			continue
		a = n // 2 - b - c - d
		if a < 0 or a > na:
			continue
		else:
			ans = []
			for i in range(n):
				x = s[i] + t[i]
				if x == '00' and a != 0:
					ans.append(i + 1)
					a -= 1
				if x == '01' and b != 0:
					ans.append(i + 1)
					b -= 1
				if x == '10' and c != 0:
					ans.append(i + 1)
					c -= 1
				if x == '11' and d != 0:
					ans.append(i + 1)
					d -= 1
			print(*ans)
			exit(0)
print(-1)


from sys import stdin, stdout
n = int(stdin.readline())
a = [int(x) for x in stdin.readline().strip()]
c = [int(x) for x in stdin.readline().strip()]
ind = [[], [], [], []]
for i in range(len(a)):
	ind[2 * a[i] + c[i]].append(i + 1)
cnt = []
r = []
for i in range(n // 2 + 1):
	for j in range(i + 1):
		if j > len(ind[2]):
			continue
		if i - j > len(ind[3]):
			continue
		cnt = [len(x) for x in ind]
		cnt[2] -= j
		cnt[3] += -i + j
		cnt1soll = i - cnt[3]
		cnt0soll = n // 2 - i - cnt[2]
		if cnt1soll >= 0 and cnt1soll <= cnt[1] and (cnt0soll >= 0) and (cnt0soll <= cnt[0]):
			for x in range(j):
				r.append(ind[2][x])
			for x in range(i - j):
				r.append(ind[3][x])
			for x in range(cnt[1] - cnt1soll):
				r.append(ind[1][x])
			for x in range(cnt[0] - cnt0soll):
				r.append(ind[0][x])
			break
	else:
		continue
	break
else:
	r = [-1]
r = [str(x) for x in r]
r.append('\n')
stdout.write(' '.join(r))


n = int(input())
cc = input()
aa = input()
na = 0
nb = 0
nc = 0
nd = 0
for i in range(len(aa)):
	if cc[i] == '0' and aa[i] == '0':
		na += 1
	if cc[i] == '0' and aa[i] == '1':
		nb += 1
	if cc[i] == '1' and aa[i] == '0':
		nc += 1
	if cc[i] == '1' and aa[i] == '1':
		nd += 1
ans = []
f = False
for c in range(nc + 1):
	for d in range(nd + 1):
		xx = n // 2 - (c + d)
		b = nb + nd - (2 * d + c)
		a = xx - b
		if a >= 0 and b >= 0 and (a <= na) and (b <= nb):
			ans.append([a, b, c, d])
			f = True
			break
	if f:
		break
if len(ans) == 0:
	print(-1)
	exit()
for i in range(len(ans)):
	a = ans[i][0]
	b = ans[i][1]
	c = ans[i][2]
	d = ans[i][3]
	temp = []
	for j in range(len(aa)):
		if a > 0:
			if cc[j] == '0' and aa[j] == '0':
				a -= 1
				temp.append(j)
		if b > 0:
			if cc[j] == '0' and aa[j] == '1':
				b -= 1
				temp.append(j)
		if c > 0:
			if cc[j] == '1' and aa[j] == '0':
				c -= 1
				temp.append(j)
		if d > 0:
			if cc[j] == '1' and aa[j] == '1':
				d -= 1
				temp.append(j)
	if a == 0 and b == 0 and (c == 0) and (d == 0):
		for ii in temp:
			print(ii + 1, end=' ')
		print()
		exit()


maxn = int(5010)
a = [0 for i in range(0, maxn)]
b = [0 for i in range(0, maxn)]
n = int(input())
s1 = input()
s2 = input()
(aa, bb, cc, dd) = (0, 0, 0, 0)
(na, nb, nc, nd) = (0, 0, 0, 0)
for i in range(0, n):
	a[i] = int(s1[i])
	b[i] = int(s2[i])
	if a[i] == 0 and b[i] == 0:
		aa += 1
	elif a[i] == 0 and b[i] == 1:
		bb += 1
	elif a[i] == 1 and b[i] == 0:
		cc += 1
	else:
		dd += 1
if bb > n // 2 or cc > n // 2:
	print('-1')
else:
	flag = False
	for i in range(0, bb + 1):
		if flag == True:
			break
		for j in range(0, dd + 1):
			nc = dd - 2 * j + bb - i
			na = n // 2 - nc - i - j
			if na >= 0 and nc >= 0 and (na <= aa) and (nc <= cc):
				flag = True
				nb = i
				nd = j
				break
	if flag:
		for i in range(0, n):
			if a[i] == 0 and b[i] == 0 and (na != 0):
				na -= 1
				print(i + 1, end=' ')
			if a[i] == 0 and b[i] == 1 and (nb != 0):
				nb -= 1
				print(i + 1, end=' ')
			if a[i] == 1 and b[i] == 0 and (nc != 0):
				nc -= 1
				print(i + 1, end=' ')
			if a[i] == 1 and b[i] == 1 and (nd != 0):
				nd -= 1
				print(i + 1, end=' ')
	else:
		print('-1')


def calc(s, n, d):
	cnts = [len(v) for v in d.values()]
	half = n // 2
	for a in range(0, cnts[0] + 1):
		for b in range(0, cnts[1] + 1):
			c = n - 2 * a - b - s
			d = a + s - half
			if 0 <= c <= cnts[2] and 0 <= d <= cnts[3] and (a + b + c + d == half) and (b + c + 2 * d == s):
				return (True, a, b, c, d)
	return (False,)

def main():
	n = int(input())
	c_arr = list(map(int, list(input())))
	a_arr = list(map(int, list(input())))
	s = 0
	kinds = [(0, 0), (0, 1), (1, 0), (1, 1)]
	d = {kind: [] for kind in kinds}
	for i in range(n):
		if a_arr[i] == 1:
			s += 1
		d[c_arr[i], a_arr[i]].append(i)
	(result, *params) = calc(s, n, d)
	if not result:
		print(-1)
	else:
		ans = []
		for (i, kind) in enumerate(kinds):
			for j in range(params[i]):
				ix = d[kind][j]
				ans.append(str(ix + 1))
		print(' '.join(ans))
main()


import sys
n = int(input())
s = input()
s1 = input()
a = 0
b = 0
c = 0
d = 0
an = []
for i in range(n):
	if s[i] == '0' and s1[i] == '0':
		a += 1
	elif s[i] == '1' and s1[i] == '0':
		b += 1
	elif s[i] == '0' and s1[i] == '1':
		c += 1
	else:
		d += 1
x = 0
y = 0
z = 0
w = 0
t = 0
for i in range(a + 1):
	for j in range(d + 1):
		if n // 2 - i - j == c + d - 2 * j and n // 2 - i - j >= 0 and (n // 2 - i - j <= b + c):
			x = i
			y = min(b, n // 2 - i - j)
			z = n // 2 - i - j - y
			w = j
			t = 1
			break
if t == 0:
	print(-1)
	sys.exit()
for i in range(n):
	if s[i] == '0' and s1[i] == '0' and (x > 0):
		an.append(i + 1)
		x -= 1
	elif s[i] == '1' and s1[i] == '0' and (y > 0):
		an.append(i + 1)
		y -= 1
	elif s[i] == '0' and s1[i] == '1' and (z > 0):
		an.append(i + 1)
		z -= 1
	elif s[i] == '1' and s1[i] == '1' and (w > 0):
		an.append(i + 1)
		w -= 1
print(*an, sep=' ')


n = int(input())
d = {v: [] for v in [(0, 0), (0, 1), (1, 0), (1, 1)]}
for (j, x, y) in zip(range(n), map(int, input()), map(int, input())):
	d[x, y] += [j + 1]
x = n // 2
y = len(d[0, 1]) + len(d[1, 1])
x += x - y
c = min(x, y, len(d[0, 1]) + len(d[1, 0]))
if c % 2 != y % 2:
	c -= 1
b = (y - c) // 2
a = (x - c) // 2
if a <= len(d[0, 0]) and 0 <= c and (b <= len(d[1, 1])):
	print(*d[0, 0][:a] + (d[0, 1] + d[1, 0])[:c] + d[1, 1][:b])
else:
	print(-1)


n = int(input())
c = list(map(int, list(input())))
a = list(map(int, list(input())))
p = [0, 0, 0, 0]
ind = [[], [], [], []]
for i in range(n):
	if c[i] and a[i]:
		p[3] += 1
		ind[3].append(i)
	elif c[i]:
		p[1] += 1
		ind[1].append(i)
	elif a[i]:
		p[2] += 1
		ind[2].append(i)
	else:
		p[0] += 1
		ind[0].append(i)
first = [0, p[1], 0, 0]
second = [0, 0, p[2], 0]

def trans(i, n):
	first[i] += n
	second[i] -= n
if p[2] > p[1]:
	d = p[2] - p[1]
	first[2] += d
	second[2] -= d
else:
	d = p[1] - p[2]
	first[1] -= d
	second[1] += d
d = p[3]
while d > 0:
	if first[1] + first[3] > second[2] + second[3]:
		second[3] += 1
		d -= 1
	else:
		first[3] += 1
		d -= 1
dif = first[1] + first[3] - (second[2] + second[3])
if dif > 0:
	if first[2] > 0:
		trans(2, -1)
	elif first[1] > 0:
		trans(1, -1)
	elif first[3] > 0 and second[1] > 0:
		trans(3, -1)
		trans(1, 1)
	else:
		print(-1)
		quit()
elif dif < 0:
	if second[1] > 0:
		trans(1, 1)
	elif second[2] > 0:
		trans(2, 2)
	elif second[3] > 0 and first[2] > 0:
		trans(3, 1)
		trans(2, -1)
	else:
		print(-1)
		quit()
d = p[0]
while d > 0:
	if sum(first) > sum(second):
		second[0] += 1
		d -= 1
	else:
		first[0] += 1
		d -= 1
while sum(first) > sum(second):
	if first[1] > 0 and first[2] > 0 and (second[3] > 0):
		trans(1, -1)
		trans(2, -1)
		trans(3, 1)
	elif first[2] > 1 and second[3] > 0:
		trans(2, -1)
		trans(2, -1)
		trans(3, 1)
	else:
		print(-1)
		quit()
while sum(first) < sum(second):
	if second[1] > 0 and second[2] > 0 and (first[3] > 0):
		trans(1, 1)
		trans(2, 1)
		trans(3, -1)
	elif second[1] > 1 and first[3] > 0:
		trans(1, 1)
		trans(1, 1)
		trans(3, -1)
	else:
		print(-1)
		quit()
ans = []
for i in range(4):
	for j in range(first[i]):
		ans.append(ind[i][j])
print(' '.join([str(x + 1) for x in ans]))


from __future__ import division, print_function
from fractions import Fraction
import sys
import os
from io import BytesIO, IOBase
from functools import cmp_to_key
from heapq import *
from math import gcd, factorial, floor, ceil, sqrt
from copy import deepcopy
from collections import deque
from bisect import bisect_left as bl
from bisect import bisect_right as br
from bisect import bisect
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')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
from types import GeneratorType

def iterative(f, stack=[]):

	def wrapped_func(*args, **kwargs):
		if stack:
			return f(*args, **kwargs)
		to = f(*args, **kwargs)
		while True:
			if type(to) is GeneratorType:
				stack.append(to)
				to = next(to)
				continue
			stack.pop()
			if not stack:
				break
			to = stack[-1].send(to)
		return to
	return wrapped_func

def inp():
	return sys.stdin.readline().rstrip('\r\n')

def out(var):
	sys.stdout.write(str(var))

def lis():
	return list(map(int, inp().split()))

def stringlis():
	return list(map(str, inp().split()))

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

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

def testcase(t):
	for pp in range(t):
		solve(pp)

def google(p):
	print('Case #' + str(p) + ': ', end='')

def lcm(a, b):
	return a * b // gcd(a, b)

def power(x, y, p):
	y %= p - 1
	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 ncr(n, r):
	return factorial(n) // (factorial(r) * factorial(max(n - r, 1)))

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True
inf = pow(10, 20)
mod = 10 ** 9 + 7

def solve(case):
	n = int(inp())
	c = list(inp())
	b = list(inp())
	a = [0, 0, 0, 0]
	for i in range(n):
		if c[i] == '0' and b[i] == '0':
			a[0] += 1
		if c[i] == '1' and b[i] == '1':
			a[1] += 1
		if c[i] == '0' and b[i] == '1':
			a[3] += 1
		if c[i] == '1' and b[i] == '0':
			a[2] += 1
	for i in range(a[1] + a[2] + 1):
		clowns = i
		if clowns > n // 2:
			continue
		for j in range(0, i + 1):
			both = a[1] - j
			cl = clowns - j
			if cl > a[2] or both < 0:
				continue
			if a[3] + both < clowns or clowns + a[2] - cl > n // 2 or both > clowns:
				continue
			ac = clowns - both
			if a[3] - ac + clowns > n // 2:
				continue
			ans = []
			cnt = 0
			ind = 0
			taken = [0] * n
			while cnt < j:
				if c[ind] == '1' and b[ind] == '1' and (not taken[ind]):
					cnt += 1
					ans.append(ind)
					taken[ind] = 1
				ind += 1
			ind = 0
			while cnt < clowns:
				if c[ind] == '1' and b[ind] == '0' and (not taken[ind]):
					cnt += 1
					ans.append(ind)
					taken[ind] = 1
				ind += 1
			ind = 0
			while cnt < clowns + a[3] - ac:
				if c[ind] == '0' and b[ind] == '1' and (not taken[ind]):
					cnt += 1
					ans.append(ind)
					taken[ind] = 1
				ind += 1
			ind = 0
			while cnt < n // 2:
				if c[ind] == b[ind] and c[ind] == '0' and (not taken[ind]):
					cnt += 1
					ans.append(ind)
					taken[ind] = 1
				ind += 1
			print(' '.join((str(ans[ii] + 1) for ii in range(n // 2))))
			return
	print(-1)
testcase(1)


n = int(input())
y = list(map(int, list(input())))
a = list(map(int, list(input())))
x = [0, 0, 0, 0]
for i in range(n):
	if y[i] == 0:
		if a[i] == 0:
			x[0] += 1
		else:
			x[1] += 1
	elif a[i] == 0:
		x[2] += 1
	else:
		x[3] += 1
ok = False
ans = []
for c in range(x[2] + 1):
	for d in range(x[3] + 1):
		b = x[1] + x[3] - c - 2 * d
		if 0 <= b + c + d <= n // 2 and 0 <= b <= x[1] and (n // 2 - (b + c + d) <= x[0]):
			ok = True
			ans = [n // 2 - (b + c + d), b, c, d]
if not ok:
	print(-1)
	exit()
fin = []
for i in range(n):
	cur = -1
	if y[i] == 0:
		if a[i] == 0:
			cur = 0
		else:
			cur = 1
	elif a[i] == 0:
		cur = 2
	else:
		cur = 3
	if ans[cur] > 0:
		ans[cur] -= 1
		fin.append(i + 1)
print(*fin)


n = int(input())
s1 = input()
s2 = input()
first = []
second = []
none = []
both = []
for i in range(n):
	if s1[i] == '1' and s2[i] == '0':
		first.append(i + 1)
	elif s1[i] == '0' and s2[i] == '1':
		second.append(i + 1)
	elif s1[i] == '1' and s2[i] == '1':
		both.append(i + 1)
	else:
		none.append(i + 1)
fl = len(first)
sl = len(second)
bl = len(both)
nl = len(none)
ans = []
flag = 0
for a in range(fl + 1):
	for c in range(bl + 1):
		b = a + c - (bl - c)
		if b <= sl and b >= 0 and (a + c + (sl - b) <= n // 2) and (b + (bl - c) == a + c):
			ans = [a, sl - b, c, n // 2 - (a + c + (sl - b))]
			if ans[3] <= nl and ans[3] >= 0:
				flag = 1
				break
	if flag == 1:
		break
if flag == 1:
	print(*first[:ans[0]], *second[:ans[1]], *both[:ans[2]], *none[:ans[3]])
else:
	print('-1')


import sys
N = int(input())
c_ls = list(input())
a_ls = list(input())
total_both = 0
ls_both = []
total_Aonly = 0
ls_Aonly = []
total_Conly = 0
ls_Conly = []
total_none = 0
ls_none = []
for i in range(N):
	if c_ls[i] == '1' and a_ls[i] == '1':
		total_both += 1
		ls_both.append(i)
	elif c_ls[i] == '1':
		total_Conly += 1
		ls_Conly.append(i)
	elif a_ls[i] == '1':
		total_Aonly += 1
		ls_Aonly.append(i)
	else:
		total_none += 1
		ls_none.append(i)
for first_both in range(total_both + 1):
	for first_Conly in range(total_Conly + 1):
		if first_both + first_Conly > N // 2:
			continue
		second_both = total_both - first_both
		second_Conly = total_Conly - first_Conly
		second_Aonly = first_both + first_Conly - second_both
		if second_Aonly < 0 or second_Aonly > total_Aonly:
			continue
		second_none = N // 2 - (second_both + second_Conly + second_Aonly)
		if second_none < 0 or second_none > total_none:
			continue
		ans_ls = []
		for i in range(first_both):
			ans_ls.append(ls_both[i] + 1)
		for i in range(first_Conly):
			ans_ls.append(ls_Conly[i] + 1)
		first_Aonly = total_Aonly - second_Aonly
		for i in range(first_Aonly):
			ans_ls.append(ls_Aonly[i] + 1)
		first_none = total_none - second_none
		for i in range(first_none):
			ans_ls.append(ls_none[i] + 1)
		print(*ans_ls)
		sys.exit()
print(-1)


n = int(input())
aa = input()
bb = input()
s = [0] * n
t = [0] * n
ans = [0] * n
for i in range(n):
	s[i] = aa[i]
	t[i] = bb[i]
	ans[i] = i + 1
k = n // 2
(cs, at) = (0, 0)
for i in range(n // 2):
	if s[i] == '1':
		cs += 1
	if t[k + i] == '1':
		at += 1
if cs == at:
	for i in range(n // 2):
		print(i + 1, end=' ')
	print()
	exit()
else:
	for i in range(k):
		for j in range(k, n, 1):
			ncs = cs
			nat = at
			if s[i] == '1':
				ncs -= 1
			if t[j] == '1':
				nat -= 1
			if s[j] == '1':
				ncs += 1
			if t[i] == '1':
				nat += 1
			if abs(ncs - nat) < abs(cs - at):
				(s[i], s[j]) = (s[j], s[i])
				(t[i], t[j]) = (t[j], t[i])
				(ans[i], ans[j]) = (ans[j], ans[i])
				cs = ncs
				at = nat
		if cs == at:
			break
if cs == at:
	print(*ans[:n // 2])
else:
	print('-1')


n = int(input())
c = [int(i) for i in input()]
a = [int(i) for i in input()]
dzero_index = []
done_index = []
one_zero_index = []
aone_count = 0
find = False
for i in range(n):
	if c[i] == a[i] == 0:
		dzero_index.append(i + 1)
	elif c[i] == a[i] == 1:
		done_index.append(i + 1)
	else:
		one_zero_index.append(i + 1)
	if a[i] == 1:
		aone_count += 1
for i in range(len(done_index) + 1):
	x = aone_count - 2 * i
	if x <= len(one_zero_index) and x >= 0 and (n // 2 - i - x >= 0) and (n // 2 - i - x <= len(dzero_index)):
		a = x
		b = i
		c = n // 2 - i - x
		find = True
		break
if find:
	result = ' '.join((str(i) for i in one_zero_index[0:a])) + ' ' + ' '.join((str(i) for i in done_index[0:b])) + ' ' + ' '.join((str(i) for i in dzero_index[0:c]))
	print(result)
else:
	print(-1)


def problem_1138b():
	n = int(input())
	c = input()
	a = input()
	(n0, c0, a0, b0) = (0, 0, 0, 0)
	for i in range(n):
		if c[i] == '0' and a[i] == '0':
			n0 += 1
		elif c[i] == '0' and a[i] == '1':
			a0 += 1
		elif c[i] == '1' and a[i] == '0':
			c0 += 1
		else:
			b0 += 1
	half_n = int(n / 2)
	for i in range(half_n + 1):
		if b0 > 2 * i:
			continue
		if a0 < i and c0 < i:
			if i - a0 + i - c0 == b0:
				em = half_n - i
				d1 = i - c0
				cc = i
				if em > n0:
					continue
				for i in range(n):
					if c[i] == '0' and a[i] == '0' and em:
						em -= 1
						print(str(i + 1) + ' ', end='')
					elif c[i] == '0' and a[i] == '1':
						continue
					elif c[i] == '1' and a[i] == '0' and cc:
						cc -= 1
						print(str(i + 1) + ' ', end='')
					elif c[i] == '1' and a[i] == '1' and d1:
						d1 -= 1
						print(str(i + 1) + ' ', end='')
				return
		elif c0 < i <= a0:
			d1 = b0 - i + c0
			d2 = a0 - i
			if i >= d1 >= 0:
				d5 = i - c0
				d3 = d2 + d1
				d4 = half_n - i - d3
				cc = i
				if d4 > n0 or d4 < 0:
					continue
				for i in range(n):
					if c[i] == '0' and a[i] == '0' and d4:
						d4 -= 1
						print(str(i + 1) + ' ', end='')
					elif c[i] == '0' and a[i] == '1' and d3:
						d3 -= 1
						print(str(i + 1) + ' ', end='')
					elif c[i] == '1' and a[i] == '0' and cc:
						cc -= 1
						print(str(i + 1) + ' ', end='')
					elif c[i] == '1' and a[i] == '1' and d5:
						d5 -= 1
						print(str(i + 1) + ' ', end='')
				return
		elif a0 < i <= c0:
			d1 = b0 - i + a0
			if 0 <= d1 <= i:
				cc = i - d1
				d2 = half_n - cc - d1
				if d2 > n0 or d2 < 0:
					continue
				for i in range(n):
					if c[i] == '0' and a[i] == '0' and d2:
						d2 -= 1
						print(str(i + 1) + ' ', end='')
					elif c[i] == '0' and a[i] == '1':
						continue
					elif c[i] == '1' and a[i] == '0' and cc:
						cc -= 1
						print(str(i + 1) + ' ', end='')
					elif c[i] == '1' and a[i] == '1' and d1:
						d1 -= 1
						print(str(i + 1) + ' ', end='')
				return
		else:
			d1 = int(b0 / 2)
			d2 = i - d1
			d3 = b0 - d1
			d4 = i - d3
			d5 = c0 - d2
			d6 = a0 - d4
			if d6 + d1 + d2 <= half_n and d3 + d4 + d5 <= half_n:
				d7 = half_n - d6 - d1 - d2
				if d7 > n0 or d2 < 0:
					continue
				for i in range(n):
					if c[i] == '0' and a[i] == '0' and d7:
						d7 -= 1
						print(str(i + 1) + ' ', end='')
					elif c[i] == '0' and a[i] == '1' and d6:
						d6 -= 1
						print(str(i + 1) + ' ', end='')
					elif c[i] == '1' and a[i] == '0' and d2:
						d2 -= 1
						print(str(i + 1) + ' ', end='')
					elif c[i] == '1' and a[i] == '1' and d1:
						d1 -= 1
						print(str(i + 1) + ' ', end='')
				return
	print(-1)
	return
problem_1138b()


n = int(input())
s1 = input()
s2 = input()
(w, x, y, z) = (0, 0, 0, 0)
(W, X, Y, Z) = ([], [], [], [])
for i in range(n):
	s = s1[i] + s2[i]
	if s == '00':
		w += 1
		W.append(i)
	elif s == '11':
		x += 1
		X.append(i)
	elif s == '10':
		y += 1
		Y.append(i)
	else:
		z += 1
		Z.append(i)
can = False
res_count = []
for i in range(x + 1):
	for j in range(n // 2 + 1):
		(req1, left1) = (j - i, y - j + i)
		if req1 < 0:
			continue
		if y < req1:
			continue
		req2 = j - (x - i)
		left2 = z - req2
		if req2 < 0 or z < req2:
			continue
		if req2 + left1 + (x - i) > n // 2 or req1 + left2 + i > n // 2:
			continue
		w_req = n // 2 - i - req1 - left2
		if w_req > w:
			continue
		res_count = [i, req1, left2]
		can = True
		break
	if can:
		break
if not can:
	print(-1)
	exit(0)
res = []
for i in range(res_count[0]):
	res.append(X[i] + 1)
for i in range(res_count[1]):
	res.append(Y[i] + 1)
for i in range(res_count[2]):
	res.append(Z[i] + 1)
for i in range(n // 2 - len(res)):
	res.append(W[i] + 1)
res.sort()
print(' '.join(map(str, res)))


n = int(input()) // 2
c = map(int, list(input()))
a = map(int, list(input()))
artists = zip(c, a)
(both, none, clowns, acrobats) = ([], [], [], [])
for (i, artist) in enumerate(artists):
	if sum(artist) == 2:
		both.append(i + 1)
	elif sum(artist) == 0:
		none.append(i + 1)
	elif artist[0] == 1:
		clowns.append(i + 1)
	else:
		acrobats.append(i + 1)
success = False
for z1 in range(len(none) + 1):
	b1 = len(acrobats) + len(both) - n + z1
	if not 0 <= b1 <= len(both):
		continue
	if success:
		break
	for a1 in range(len(acrobats) + 1):
		c1 = n - z1 - b1 - a1
		if not 0 <= c1 <= len(clowns):
			continue
		if a1 + b1 + c1 + z1 == n:
			first = []
			for i in range(z1):
				first.append(none[i])
			for i in range(b1):
				first.append(both[i])
			for i in range(a1):
				first.append(acrobats[i])
			for i in range(c1):
				first.append(clowns[i])
			success = True
			print(*first)
			break
if not success:
	print(-1)


(a, b, c, d) = (0, 0, 0, 0)
(n, s, t) = (int(input()), input(), input())
for i in range(n):
	if s[i] == '1' and t[i] == '1':
		d += 1
	elif s[i] == t[i]:
		a += 1
	elif s[i] == '1':
		c += 1
	else:
		b += 1
if n % 2 == 1:
	print(-1)
	exit(0)
hi = n // 2
for x in range(a + 1):
	for m in range(b + 1):
		y = b + d + x - hi
		n = hi - m - x - y
		if 0 <= y <= d and 0 <= n <= c:
			for i in range(hi * 2):
				if s[i] == '1' and t[i] == '1':
					if y > 0:
						print(i + 1, end=' ')
						y -= 1
				elif s[i] == t[i]:
					if x > 0:
						print(i + 1, end=' ')
						x -= 1
				elif s[i] == '1':
					if n > 0:
						print(i + 1, end=' ')
						n -= 1
				elif m > 0:
					print(i + 1, end=' ')
					m -= 1
			exit(0)
print(-1)


from operator import itemgetter

class CodeforcesTask1138BSolution:

	def __init__(self):
		self.result = ''
		self.artist_count = 0
		self.clowns = []
		self.acrobats = []

	def read_input(self):
		self.artist_count = int(input())
		self.clowns = [int(x) for x in input()]
		self.acrobats = [int(x) for x in input()]

	def process_task(self):
		pure_clowns = 0
		pure_acrobats = 0
		pure_useless = 0
		pure_both = 0
		for x in range(self.artist_count):
			if self.acrobats[x]:
				if self.clowns[x]:
					pure_both += 1
				else:
					pure_acrobats += 1
			elif self.clowns[x]:
				pure_clowns += 1
			else:
				pure_useless += 1
		eq = self.artist_count // 2 - pure_acrobats - pure_both
		a_d = []
		possible_a = [x for x in range(pure_useless + 1)]
		for pos_a in possible_a:
			d = pos_a - eq
			if d <= pure_both and d >= 0:
				a_d.append((pos_a, d))
		possb = [x for x in range(pure_acrobats + 1)]
		possc = [x for x in range(pure_clowns + 1)]
		solutions = []
		for para in a_d:
			eq2 = pure_acrobats + pure_both - 2 * para[1]
			for b in possb:
				c = eq2 - b
				if c in possc:
					solutions.append([para[0], b, c, para[1]])
					break
			if solutions:
				break
		if not solutions:
			self.result = '-1'
		else:
			squad = []
			for x in range(self.artist_count):
				if self.acrobats[x]:
					if self.clowns[x]:
						if solutions[0][3]:
							solutions[0][3] -= 1
							squad.append(x)
					elif solutions[0][1]:
						solutions[0][1] -= 1
						squad.append(x)
				elif self.clowns[x]:
					if solutions[0][2]:
						solutions[0][2] -= 1
						squad.append(x)
				elif solutions[0][0]:
					solutions[0][0] -= 1
					squad.append(x)
			self.result = ' '.join([str(x + 1) for x in squad])

	def get_result(self):
		return self.result
Solution = CodeforcesTask1138BSolution()
Solution.read_input()
Solution.process_task()
print(Solution.get_result())


n = int(input())
c = list(map(int, input()))
a = list(map(int, input()))
b = [0, 0, 0, 0]
for (x, y) in zip(c, a):
	if x ^ y:
		b[0] += x
		b[1] += y
	elif x:
		b[2] += 1
	else:
		b[3] += 1
l = [0, 0, 0, 0]
r = [0, 0, 0, 0]
z = min(b[0], b[1])
l[0] += z
r[1] += z
b[0] -= z
b[1] -= z
if b[0]:
	z = min(b[0], b[2])
	l[0] += z
	r[2] += z
	b[0] -= z
	b[2] -= z
	if b[0]:
		r[0] += b[0]
		b[0] = 0
	if b[2]:
		l[2] += b[2] // 2
		r[2] += b[2] // 2
		b[2] &= 1
		if b[2]:
			l[0] -= 1
			l[2] += 1
			r[0] += 1
			b[2] = 0
if b[1]:
	z = min(b[1], b[2])
	l[2] += z
	r[1] += z
	b[1] -= z
	b[2] -= z
	if b[1]:
		l[1] += b[1]
		b[1] = 0
	if b[2]:
		l[2] += b[2] // 2
		r[2] += b[2] // 2
		b[2] &= 1
		if b[2]:
			r[1] -= 1
			r[2] += 1
			l[1] += 1
			b[2] = 0
if b[2]:
	l[2] += b[2] // 2
	r[2] += b[2] // 2
	b[2] &= 1
	if b[2]:
		if l[0]:
			l[0] -= 1
			l[2] += 1
			r[0] += 1
			b[2] = 0
		elif r[1]:
			r[1] -= 1
			r[2] += 1
			l[1] += 1
			b[2] = 0
		else:
			r[0] = n
if sum(l) > n // 2 or sum(r) > n // 2:
	print(-1)
else:
	l[3] = n // 2 - sum(l)
	if l[3] > b[3]:
		print(-1)
	else:
		d = []
		for i in range(n):
			if c[i] ^ a[i]:
				if c[i]:
					if l[0]:
						d += (i + 1,)
						l[0] -= 1
				elif l[1]:
					d += (i + 1,)
					l[1] -= 1
			elif c[i]:
				if l[2]:
					d += (i + 1,)
					l[2] -= 1
			elif l[3]:
				d += (i + 1,)
				l[3] -= 1
		print(*d)


from collections import Counter

def divide(counter, n):
	total = n
	t0 = counter['0', '0']
	t1 = counter['0', '1']
	t2 = counter['1', '0']
	t3 = counter['1', '1']
	for c1 in range(t1 + 1):
		for c3 in range(t3 + 1):
			c2 = t1 + t3 - c1 - 2 * c3
			if not 0 <= c2 <= t2:
				continue
			c0 = total // 2 - (c1 + c2 + c3)
			if not 0 <= c0 <= t0:
				continue
			return [c0, c1, c2, c3]
	return False
n = int(input())
inp = list(zip(input(), input()))
c = Counter(inp)
division = divide(c, n)
if not division:
	print(-1)
	exit(0)
i = 0
selection = []
while sum(division):
	representation = int(inp[i][0]) * 2 + int(inp[i][1])
	if division[representation] > 0:
		selection.append(i + 1)
		division[representation] -= 1
	i += 1
print(' '.join(map(str, selection)))


n = int(input())
a = input()
b = input()
import sys
pary = []
for i in range(n):
	pary.append([int(a[i]), int(b[i])])
jj = []
jz = []
zj = []
zz = []
for i in range(n):
	if pary[i] == [0, 0]:
		zz.append(i)
	if pary[i] == [1, 0]:
		jz.append(i)
	if pary[i] == [0, 1]:
		zj.append(i)
	if pary[i] == [1, 1]:
		jj.append(i)
a = len(jj)
b = len(jz)
c = len(zj)
d = len(zz)
aa = -1
bb = 0
chuj = 0
for a1 in range(a + 1):
	if a - b <= 2 * a1 and 2 * a1 <= a + c and (a + c - n // 2 <= a1) and (a1 <= d + a + c - n // 2):
		aa = a1
		break
if aa == -1:
	print(-1)
	sys.exit(0)
dd = aa - a - c + n // 2
bb = min(b, a + c - 2 * aa)
cc = a + c - 2 * aa - bb
for i in range(aa):
	print(jj[i] + 1, end=' ')
for i in range(bb):
	print(jz[i] + 1, end=' ')
for i in range(cc):
	print(zj[i] + 1, end=' ')
for i in range(dd):
	print(zz[i] + 1, end=' ')


n = int(input())
s = input()
t = input()
A = []
B = []
C = []
D = []
(a, b, c, d) = (0, 0, 0, 0)
for i in range(n):
	f = s[i] + t[i]
	if f == '00':
		d += 1
		D.append(i + 1)
	elif f == '01':
		a += 1
		A.append(i + 1)
	elif f == '11':
		c += 1
		C.append(i + 1)
	else:
		b += 1
		B.append(i + 1)
for x1 in range(a + 1):
	for x2 in range(b + 1):
		if (a + c - x1 - x2) % 2 == 0:
			x3 = (a + c - x1 - x2) // 2
			x4 = n // 2 - x1 - x2 - x3
			if 0 <= x3 <= c and 0 <= x4 <= d:
				ans = []
				for i in range(x1):
					ans.append(A[i])
				for i in range(x2):
					ans.append(B[i])
				for i in range(x3):
					ans.append(C[i])
				for i in range(x4):
					ans.append(D[i])
				print(' '.join(list(map(str, ans))))
				exit(0)
print(-1)


from sys import stdin
n = int(stdin.readline().strip())
s = stdin.readline().strip()
s1 = stdin.readline().strip()
s2 = []
x00 = 0
x01 = 0
x10 = 0
x11 = 0
for i in range(n):
	if s[i] == '0' and s1[i] == '0':
		x00 += 1
	elif s[i] == '0' and s1[i] == '1':
		x01 += 1
	elif s[i] == '1' and s1[i] == '0':
		x10 += 1
	else:
		x11 += 1
mid = n // 2
for y10 in range(x10 + 1):
	for y11 in range(x11 + 1):
		y01 = -y10 - y11 + x01 + x11 - y11
		y00 = mid - y01 - y11 - y10
		if y01 < 0 or y01 > x01 or y00 < 0 or (y00 > x00) or (y00 + y01 + y11 + y10 != mid):
			continue
		for i in range(n):
			if s[i] == '0' and s1[i] == '0' and y00:
				print(i + 1, end=' ')
				y00 -= 1
			elif s[i] == '0' and s1[i] == '1' and y01:
				print(i + 1, end=' ')
				y01 -= 1
			elif s[i] == '1' and s1[i] == '0' and y10:
				print(i + 1, end=' ')
				y10 -= 1
			elif s[i] == '1' and s1[i] == '1' and y11:
				print(i + 1, end=' ')
				y11 -= 1
		exit(0)
print(-1)


n = int(input())
a = input()
b = input()
init = sum((int(c) for c in b))
mp = [[] for i in range(3)]
for i in range(n):
	c = int(a[i]) + int(b[i])
	mp[c] += [i + 1]
need = n // 2
for i in range(len(mp[1]) + 1):
	for j in range(len(mp[2]) + 1):
		if i + 2 * j == init and i + j <= need and (i + j + len(mp[0]) >= need):
			print(*mp[0][:need - i - j] + mp[1][:i] + mp[2][:j])
			exit()
print(-1)


import sys
N = int(input())
n = N // 2
A = input()
B = input()
C = [(a == '1') * 2 + (b == '1') for (a, b) in zip(A, B)]
w = C.count(0)
x = C.count(1)
y = C.count(2)
z = N - w - x - y
Ans = []
for i in range(x + 1):
	for j in range(y + 1):
		z1 = x + z - i - j
		if z1 % 2:
			continue
		z1 //= 2
		if not 0 <= z1 <= z:
			continue
		w1 = n - i - j - z1
		if not 0 <= w1 <= w:
			continue
		cnt = [w1, i, j, z1]
		ans = []
		for (k, a, b) in zip(range(1, N + 1), A, B):
			if cnt[(a == '1') * 2 + (b == '1')] > 0:
				cnt[(a == '1') * 2 + (b == '1')] -= 1
				Ans.append(k)
		print(*Ans)
		sys.exit()
print(-1)


from copy import copy
n = int(input())
p = [[int(i), 0] for i in input()]
p00 = [[], []]
p01 = [[], []]
p11 = [[], []]
p10 = [[], []]
indx = 0
for (i, j) in enumerate(list(input())):
	p[i][1] = int(j)
	if i >= n // 2:
		indx = 1
	if p[i] == [0, 0]:
		p00[indx].append(i)
	if p[i] == [0, 1]:
		p01[indx].append(i)
	if p[i] == [1, 0]:
		p10[indx].append(i)
	if p[i] == [1, 1]:
		p11[indx].append(i)
s1 = len(p11[0]) + len(p10[0])
s2 = len(p11[1]) + len(p01[1])
flag = False
if s1 > s2:
	(p00[0], p00[1]) = (copy(p00[1]), copy(p00[0]))
	(p10[0], p10[1]) = (copy(p10[1]), copy(p10[0]))
	(p01[0], p01[1]) = (copy(p01[1]), copy(p01[0]))
	(p11[0], p11[1]) = (copy(p11[1]), copy(p11[0]))
	flag = True
	(s1, s2) = (s2, s1)
for _ in range(6000):
	while s1 <= s2 - 2 and len(p00[0]) > 0 and (len(p11[1]) > 0):
		p00[1].append(p00[0].pop())
		p11[0].append(p11[1].pop())
		s1 += 1
		s2 -= 1
	while s1 < s2 and len(p01[0]) > 0 and (len(p11[1]) > 0):
		p01[1].append(p01[0].pop())
		p11[0].append(p11[1].pop())
		s1 = s1 + 1
	while s1 < s2 and len(p10[0]) > 0 and (len(p11[1]) > 0):
		p10[1].append(p10[0].pop())
		p11[0].append(p11[1].pop())
		s2 = s2 - 1
	while s1 < s2 and len(p00[0]) > 0 and (len(p10[1]) > 0):
		p00[1].append(p00[0].pop())
		p10[0].append(p10[1].pop())
		s1 = s1 + 1
	while s1 < s2 and len(p00[0]) > 0 and (len(p01[1]) > 0):
		p00[1].append(p00[0].pop())
		p01[0].append(p01[1].pop())
		s2 = s2 - 1
if s1 == s2:
	res = []
	res += p00[0]
	res += p01[0]
	res += p10[0]
	res += p11[0]
	if flag:
		chert = set(res)
		polo = [i for i in range(n)]
		polo = set(polo)
		res = list(polo - chert)
	for i in res:
		print(i + 1, end=' ')
	print()
	import sys
	sys.exit(0)
print(-1)


k = lambda : map(int, input().split())
l = lambda : list(k())
n = int(input())
pairs = [None for _ in range(n)]
cant = acros = clowns = both = 0
(l1, l2) = (input(), input())
(g1, g2) = ([0, 0, 0, 0], [0, 0, 0, 0])
ans = [0] * n
for i in range(n):
	pairs[i] = (int(l1[i]), int(l2[i]), i + 1)
	ans[i] = pairs[i][0] + pairs[i][1] * 2
	if pairs[i][0]:
		if pairs[i][1]:
			both += 1
		else:
			clowns += 1
	elif pairs[i][1]:
		acros += 1
	else:
		cant += 1
if (acros + clowns + both) % 2 == 1:
	if acros == clowns == 0:
		print(-1)
		raise SystemExit()
	if acros > clowns:
		acros -= 1
		cant -= 1
		g1[2] += 1
		g2[0] += 1
	else:
		clowns -= 1
		cant -= 1
		g2[1] += 1
		g1[0] += 1
val = min(acros, clowns)
g1[1] += val
g2[2] += val
acros -= val
clowns -= val
if clowns > 0:
	valb = min(clowns, both)
	g1[1] += valb
	g2[3] += valb
	both -= valb
	clowns -= valb
elif acros > 0:
	valb = min(acros, both)
	g1[3] += valb
	g2[2] += valb
	acros -= valb
	both -= valb
valb = both // 2
g1[3] += valb
g2[3] += valb
both -= valb * 2
if clowns > 0:
	valc = min(clowns, cant)
	g2[1] += valc
	g1[0] += valc
	clowns -= valc
	cant -= valc
if acros > 0:
	valc = min(acros, cant)
	g2[0] += valc
	g1[2] += valc
	acros -= valc
	cant -= valc
valc = cant // 2
g1[0] += valc
g2[0] += valc
cant -= valc * 2
if cant > 0 or clowns > 0 or acros > 0 or (both > 0):
	print(-1)
else:
	for i in range(n):
		if g1[ans[i]] > 0:
			g1[ans[i]] -= 1
			print(i + 1, end=' ')
	print()


import sys

def rint():
	return map(int, sys.stdin.readline().split())
n = int(input())
c = input()
a = input()
v = []
for i in range(n):
	v.append(int(a[i]) + int(c[i]) * 2)
cnt = [0 for i in range(4)]
c1 = [0 for i in range(4)]
for i in range(n):
	cnt[v[i]] += 1
t = cnt[1] + cnt[3] - n // 2
found = 0
for a0 in range(0, cnt[0] + 1):
	a3 = t + a0
	if a3 < 0 or a3 > cnt[3]:
		continue
	for a2 in range(0, cnt[2] + 1):
		a1 = cnt[3] + cnt[1] - 2 * a3 - a2
		if a1 < 0 or a1 > cnt[1]:
			continue
		else:
			c1[0] = a0
			c1[1] = a1
			c1[2] = a2
			c1[3] = a3
			found = 1
			break
	if found == 1:
		break
if found == 0:
	print(-1)
	exit()
ans = []
for j in range(4):
	i = 0
	while c1[j]:
		if v[i] == j:
			ans.append(i + 1)
			c1[j] -= 1
		i += 1
print(*ans)


n = int(input())
c = input()
a = input()
clowns = []
acr = []
both = []
neither = []
for i in range(n):
	if c[i] == '1' and a[i] == '1':
		both.append(i + 1)
	elif c[i] == '1':
		clowns.append(i + 1)
	elif a[i] == '1':
		acr.append(i + 1)
	else:
		neither.append(i + 1)
x = len(clowns)
y = len(acr)
z = len(both)
mn = min(x, y)
mx = max(x, y)
if mn == x:
	smaller = clowns
	larger = acr
	v = 0
else:
	smaller = acr
	larger = clowns
	v = 1
if mn + z < mx and mx > n / 2 or (mx == 0 and z % 2 == 1):
	print(-1)
else:
	if mn + z < mx:
		smaller = smaller + both
		while mx > mn + z:
			smaller.append(larger[-1])
			mx -= 1
			del larger[-1]
		p = len(smaller)
		while p < n / 2:
			smaller.append(neither[0])
			del neither[0]
			p += 1
		larger = larger + neither
	else:
		while mn < mx:
			smaller.append(both[0])
			mn += 1
			del both[0]
			if both == []:
				break
		while len(both) > 1:
			smaller.append(both[0])
			larger.append(both[1])
			del both[0]
			del both[0]
		if both != []:
			smaller.append(larger[0])
			del larger[0]
			larger.append(both[0])
			larger.append(neither[0])
			del neither[0]
		while neither != []:
			smaller.append(neither[0])
			larger.append(neither[1])
			del neither[0]
			del neither[0]
	if v == 0:
		for i in smaller:
			print(i, end=' ')
	else:
		for i in larger:
			print(i, end=' ')


import sys
input = sys.stdin.readline
n = int(input())
c = list(input().rstrip())
a = list(input().rstrip())
f = [[] for i in range(4)]
for i in range(n):
	c[i] = int(c[i])
	a[i] = int(a[i])
	if c[i] == a[i] == 0:
		f[0].append(i)
	elif c[i] == 0 and a[i] == 1:
		f[1].append(i)
	elif c[i] == 1 and a[i] == 0:
		f[2].append(i)
	else:
		f[3].append(i)
(ans1, ans2) = ([], [])
for w1 in range(len(f[3]) + 1):
	w2 = len(f[3]) - w1
	for y1 in range(len(f[1]) + 1):
		y2 = len(f[1]) - y1
		z1 = y2 + w2 - w1
		z2 = len(f[2]) - z1
		if z1 >= 0 and z2 >= 0 and ((len(f[0]) + z2 - y1) % 2 == 0):
			x1 = (len(f[0]) + z2 - y1) // 2
			x2 = len(f[0]) - x1
			if not (x1 >= 0 and x2 >= 0):
				continue
			for i in range(x1):
				ans1.append(f[0][i] + 1)
			for i in range(x1, len(f[0])):
				ans2.append(f[0][i] + 1)
			for i in range(y1):
				ans1.append(f[1][i] + 1)
			for i in range(y1, len(f[1])):
				ans2.append(f[1][i] + 1)
			for i in range(z1):
				ans1.append(f[2][i] + 1)
			for i in range(z1, len(f[2])):
				ans2.append(f[2][i] + 1)
			for i in range(w1):
				ans1.append(f[3][i] + 1)
			for i in range(w1, len(f[3])):
				ans2.append(f[3][i] + 1)
		if ans1:
			break
	if ans1:
		break
if ans1:
	print(*ans1)
else:
	print(-1)


def half(a):
	sa = sum(a)
	sb = sa // 2
	a13 = a[1] + a[3]
	for b1 in range(a[1] + 1):
		for b3 in range(a[3] + 1):
			b2 = a13 - b1 - 2 * b3
			if not 0 <= b2 <= a[2]:
				continue
			b0 = sb - b1 - b2 - b3
			if 0 <= b0 <= a[0]:
				return [b0, b1, b2, b3]
	return False
n = int(input())
line = list(zip(input(), input()))
a = [0] * 4
for (i, j) in line:
	a[int(i) * 2 + int(j)] += 1
b = half(a)
if not b:
	print(-1)
	exit()
i = 0
while sum(b) > 0:
	j = int(line[i][0]) * 2 + int(line[i][1])
	if b[j] > 0:
		print(i + 1, end=' ')
		b[j] -= 1
	i += 1


n = int(input())
c = input()
a = input()
counta = 0
for x in a:
	x = int(x)
	if x == 1:
		counta += 1
c0 = 0
c1 = 0
c2 = 0
for (x, y) in zip(c, a):
	(x, y) = (int(x), int(y))
	if x == 1 and y == 1:
		c2 += 1
	elif x == 1 or y == 1:
		c1 += 1
	else:
		c0 += 1
p = 0
q = 0
r = 0
for k in range(c0 + 1):
	for l in range(c1 + 1):
		m = n // 2 - k - l
		if m < 0:
			break
		elif c2 < m:
			continue
		if l + m * 2 == counta:
			(p, q, r) = (k, l, m)
			break
if p == 0 and q == 0 and (r == 0):
	print(-1)
	exit()
ans = []
for i in range(n):
	if a[i] == '0' and c[i] == '0' and (p > 0):
		ans.append(i + 1)
		p -= 1
	elif a[i] == '1' and c[i] == '1' and (r > 0):
		ans.append(i + 1)
		r -= 1
	elif (a[i] == '1' and c[i] == '0' or (a[i] == '0' and c[i] == '1')) and q > 0:
		ans.append(i + 1)
		q -= 1
print(*ans)


n = int(input())
n2 = n // 2
c = input()
a = input()
cl = []
ac = []
uni = []
par = []
res = []
for i in range(0, n):
	if c[i] == '1':
		if a[i] == '0':
			cl.append(i + 1)
		else:
			uni.append(i + 1)
	elif a[i] == '0':
		par.append(i + 1)
	else:
		ac.append(i + 1)
lcl = len(cl)
lac = len(ac)
lpar = len(par)
luni = len(uni)
if lcl > n2 or lac > n2 or (lcl == 0 and lac == 0 and (luni % 2 == 1)):
	print(-1)
else:
	if luni + lpar - abs(lac - lcl) < 0:
		print(-1)
	else:
		if luni - abs(lac - lcl) < 0:
			nmin = lpar
			if nmin > abs(lac - lcl):
				nmin = abs(lac - lcl)
			if lcl < lac:
				cl = cl + ac[lcl:lcl + nmin:1]
				lcl = lcl + nmin
				lpar = lpar - nmin
			elif lcl > lac:
				cl = cl[0:lcl - nmin:1] + par[0:nmin:1]
				lac = lac + nmin
				par = par[nmin:]
				lpar = lpar - nmin
		x = 0
		if lcl < lac:
			for i in range(0, lac - lcl):
				cl.append(uni[i])
			x = lac - lcl
		if (luni - abs(lac - lcl)) % 2 == 1:
			if lac > 0:
				cl.append(ac[0])
			else:
				cl = cl[1:]
				cl.append(uni[luni - 1])
				cl.append(par[lpar - 1])
			luni = luni - 1
			lpar = lpar - 1
		n4 = (luni - abs(lac - lcl)) // 2
		for i in range(x, x + n4):
			cl.append(uni[i])
		n5 = lpar // 2
		for i in range(0, n5):
			cl.append(par[i])
	print(*cl)


n = int(input())
c = input()
a = input()
an = [0 for i in range(n)]
for i in range(n):
	if c[i] == '1' and a[i] == '1':
		an[i] = 3
	elif a[i] == '1':
		an[i] = 1
	elif c[i] == '1':
		an[i] = 2
a1 = []
a2 = []
a3 = []
a4 = []
for i in range(n):
	if an[i] == 1:
		a1.append(i)
	elif an[i] == 2:
		a2.append(i)
	elif an[i] == 3:
		a3.append(i)
	else:
		a4.append(i)
(l1, l2, l3, l4) = (len(a1), len(a2), len(a3), len(a4))
ans = []
su = 0
while l2 + l3 != l1 + su:
	if l1 > l2 + l3:
		if l1 == 0:
			print(-1)
			exit()
		ans.append(a1.pop())
		l1 -= 1
	elif l1 + su + 1 <= l2 + l3 - 1:
		if l3 == 0:
			if l2 != 0:
				a2.pop()
				l2 -= 1
			else:
				print(-1)
				exit()
		else:
			a3.pop()
			l3 -= 1
			su += 1
	elif l2 != 0:
		a2.pop()
		l2 -= 1
	else:
		print(-1)
		exit()
ans.extend(a2)
ans.extend(a3)
l = len(ans)
if l > n // 2:
	print(-1)
	exit()
for i in range(n // 2 - l):
	if a4:
		ans.append(a4.pop())
	else:
		print(-1)
		exit()
for i in range(n // 2):
	ans[i] += 1
print(*ans)


import sys
n = int(sys.stdin.readline().strip())
c = sys.stdin.readline().strip()
a = sys.stdin.readline().strip()
onlyc = 0
onlya = 0
both = 0
neither = 0
for i in range(0, n):
	if c[i] == '1':
		if a[i] == '1':
			both = both + 1
		else:
			onlyc = onlyc + 1
	elif a[i] == '1':
		onlya = onlya + 1
	else:
		neither = neither + 1
onlyc0 = 0
onlya0 = 0
both0 = 0
neither0 = 0
onlyc1 = 0
onlya1 = 0
both1 = 0
neither1 = 0
if both % 2 == 1:
	if onlya > onlyc:
		both = both - 1
		onlya = onlya - 1
		onlya1 = onlya1 + 1
		both0 = both0 + 1
	elif onlyc > 0:
		both = both - 1
		onlyc = onlyc - 1
		onlyc0 = onlyc0 + 1
		both1 = both1 + 1
if neither % 2 == 1:
	if onlya > onlyc:
		neither = neither - 1
		onlya = onlya - 1
		onlya0 = onlya0 + 1
		neither1 = neither1 + 1
	elif onlyc > 0:
		neither = neither - 1
		onlyc = onlyc - 1
		onlyc1 = onlyc1 + 1
		neither0 = neither0 + 1
if both % 2 == 1 or neither % 2 == 1:
	print(-1)
else:
	m = min([onlya, onlyc])
	onlya = onlya - m
	onlyc = onlyc - m
	onlya1 = onlya1 + m
	onlyc0 = onlyc0 + m
	m = min([onlya, neither])
	onlya = onlya - m
	neither = neither - m
	onlya0 = onlya0 + m
	neither1 = neither1 + m
	m = min([onlya, both])
	onlya = onlya - m
	both = both - m
	onlya1 = onlya1 + m
	both0 = both0 + m
	m = min([onlyc, neither])
	onlyc = onlyc - m
	neither = neither - m
	onlyc1 = onlyc1 + m
	neither0 = neither0 + m
	m = min([onlyc, both])
	onlyc = onlyc - m
	both = both - m
	onlyc0 = onlyc0 + m
	both1 = both1 + m
	both1 = both1 + both // 2
	both0 = both0 + both // 2
	both = both - 2 * (both // 2)
	neither1 = neither1 + neither // 2
	neither0 = neither0 + neither // 2
	neither = neither - 2 * (neither // 2)
	if onlya + onlyc + both + neither > 0:
		print(-1)
	else:
		ans = ''
		for i in range(0, n):
			if c[i] == '1' and a[i] == '1':
				if both1 > 0:
					both1 = both1 - 1
				else:
					ans = ans + str(i + 1) + ' '
			if c[i] == '1' and a[i] == '0':
				if onlyc1 > 0:
					onlyc1 = onlyc1 - 1
				else:
					ans = ans + str(i + 1) + ' '
			if c[i] == '0' and a[i] == '1':
				if onlya1 > 0:
					onlya1 = onlya1 - 1
				else:
					ans = ans + str(i + 1) + ' '
			if c[i] == '0' and a[i] == '0':
				if neither1 > 0:
					neither1 = neither1 - 1
				else:
					ans = ans + str(i + 1) + ' '
		print(ans)


from sys import stdin, stdout
N = int(input())
clown = input()
acro = input()
clown = list(clown)
acro = list(acro)
k1 = 0
k2 = 0
k3 = 0
k4 = 0
for i in range(N):
	if clown[i] == '0' and acro[i] == '0':
		k1 += 1
	if clown[i] == '0' and acro[i] == '1':
		k2 += 1
	if clown[i] == '1' and acro[i] == '0':
		k3 += 1
	if clown[i] == '1' and acro[i] == '1':
		k4 += 1
a = 0
b = 0
c = 0
d = 0
target = k1 + k3 - k2 - k4
if target % 2 == 1:
	print(-1)
	quit()
if target < 0:
	a = 0
	d = -target // 2
else:
	a = target // 2
	d = 0
valid = 0
for i in range(10000):
	if a <= k1 and d <= k4:
		b = N // 2 - a - d
		c = 0
		while b >= 0 and c >= 0:
			if b <= k2 and c <= k3:
				for j in range(N):
					if clown[j] == '0' and acro[j] == '0' and (a > 0):
						print(j + 1, end=' ')
						a -= 1
					if clown[j] == '0' and acro[j] == '1' and (b > 0):
						print(j + 1, end=' ')
						b -= 1
					if clown[j] == '1' and acro[j] == '0' and (c > 0):
						print(j + 1, end=' ')
						c -= 1
					if clown[j] == '1' and acro[j] == '1' and (d > 0):
						print(j + 1, end=' ')
						d -= 1
				quit()
			b -= 1
			c += 1
	else:
		break
	a += 1
	d += 1
print(-1)


n = int(input())
n2 = n // 2
c = input()
a = input()
only_clown = sum([1 for i in range(n) if c[i] == '1' and a[i] == '0'])
only_acrobat = sum([1 for i in range(n) if c[i] == '0' and a[i] == '1'])
both = sum([1 for i in range(n) if c[i] == '1' and a[i] == '1'])
neither = sum([1 for i in range(n) if c[i] == '0' and a[i] == '0'])
answer = []

def choose_n(n, ai, ci):
	idx = 0
	chosen = 0
	while chosen < n:
		if a[idx] == ai and c[idx] == ci:
			answer.append(idx + 1)
			chosen += 1
		idx += 1
for choose_clowns_left in range(n2 + 1):
	for choose_only_clowns_left in range(0, min(choose_clowns_left, only_clown) + 1):
		both_left = choose_clowns_left - choose_only_clowns_left
		clown_right = only_clown - choose_only_clowns_left
		if both_left > both:
			continue
		both_right = both - both_left
		acrobat_right = choose_clowns_left - both_right
		acrobat_left = only_acrobat - acrobat_right
		if acrobat_right < 0 or acrobat_left < 0:
			continue
		if choose_clowns_left + clown_right > n2:
			continue
		if acrobat_left + choose_clowns_left > n2:
			continue
		neither_left = n2 - (choose_only_clowns_left + both_left + acrobat_left)
		if neither_left > neither:
			continue
		choose_n(choose_only_clowns_left, ai='0', ci='1')
		choose_n(both_left, ai='1', ci='1')
		choose_n(acrobat_left, ai='1', ci='0')
		choose_n(neither_left, ai='0', ci='0')
		print(*answer)
		exit()
print(-1)


n = int(input())
clow = input()
acro = input()
(a, b, c, d) = (0, 0, 0, 0)
for i in range(len(clow)):
	if clow[i] == '1' and acro[i] == '1':
		a += 1
	elif clow[i] == '1':
		b += 1
	elif acro[i] == '1':
		c += 1
	else:
		d += 1
(x, y, z, t) = (0, 0, 0, 0)
isAns = False
for i in range(d + 1):
	x = a + c - int(n / 2) + i
	t = i
	if x < 0 or x > a:
		continue
	y = min(int(n / 2) - i - x, b)
	z = min(int(n / 2) - i - x - y, c)
	if y + z != int(n / 2) - i - x or y < 0 or z < 0:
		continue
	isAns = True
	break
if not isAns:
	print(-1)
else:
	for i in range(len(clow)):
		if clow[i] == '1' and acro[i] == '1':
			if x > 0:
				x -= 1
				print(i + 1, end=' ')
		elif clow[i] == '1':
			if y > 0:
				y -= 1
				print(i + 1, end=' ')
		elif acro[i] == '1':
			if z > 0:
				z -= 1
				print(i + 1, end=' ')
		elif t > 0:
			t -= 1
			print(i + 1, end=' ')


def find_sol1(result, num_dict):
	ans_list = []
	for i in range(num_dict['a'] + 1):
		for j in range(num_dict['d'] + 1):
			if i - j == result:
				ans_list.append((i, j))
	return ans_list

def find_sol2(N, num_dict, ans_list):
	for (a, d) in ans_list:
		for i in range(num_dict['b'] + 1):
			for j in range(num_dict['c'] + 1):
				if i + j + a + d == N // 2:
					b = i
					c = j
					return (a, b, c, d)
	return (-1, -1, -1, -1)
N = int(input().strip())
clown = [int(i) for i in input().strip()]
acro = [int(i) for i in input().strip()]
num_dict = {'a': 0, 'b': 0, 'c': 0, 'd': 0}
for i in range(N):
	if clown[i] == 0 and acro[i] == 0:
		num_dict['a'] += 1
	elif clown[i] == 1 and acro[i] == 0:
		num_dict['b'] += 1
	elif clown[i] == 0 and acro[i] == 1:
		num_dict['c'] += 1
	else:
		num_dict['d'] += 1
(a, b, c, d) = (0, 0, 0, 0)
result = N // 2 - num_dict['c'] - num_dict['d']
ans_list = find_sol1(result, num_dict)
if ans_list == []:
	print(-1)
else:
	(a, b, c, d) = find_sol2(N, num_dict, ans_list)
	if a == -1:
		print(-1)
	else:
		ans = []
		for i in range(N):
			if clown[i] == 0 and acro[i] == 0:
				if a > 0:
					ans.append(i + 1)
					a -= 1
			elif clown[i] == 1 and acro[i] == 0:
				if b > 0:
					ans.append(i + 1)
					b -= 1
			elif clown[i] == 0 and acro[i] == 1:
				if c > 0:
					ans.append(i + 1)
					c -= 1
			elif d > 0:
				ans.append(i + 1)
				d -= 1
		print(' '.join((str(i) for i in ans)))


import os
import sys
from io import BytesIO, IOBase
from itertools import groupby

def main():
	n = int(input())
	nums1 = [int(x) for x in input()]
	nums2 = [int(x) for x in input()]
	(both1, both0, a0b1, a1b0) = (0, 0, 0, 0)
	for x in range(len(nums1)):
		if nums1[x] == nums2[x] == 1:
			both1 += 1
		elif nums1[x] == nums2[x] == 0:
			both0 += 1
		elif nums1[x] == 0 and nums2[x] == 1:
			a0b1 += 1
		else:
			a1b0 += 1
	for x in range(a0b1 + 1):
		for y in range(a1b0 + 1):
			a = (both1 + a0b1 - y - x) // 2
			b = n // 2 - x - y - a
			if (both1 + a0b1 - y - x) % 2 == 0 and a >= 0 and (a <= both1) and (b >= 0) and (b <= both0):
				ans = []
				for z in range(len(nums1)):
					if nums1[z] == 0 and nums2[z] == 1 and (x > 0):
						x -= 1
						ans.append(z + 1)
					if nums1[z] == 1 and nums2[z] == 0 and (y > 0):
						y -= 1
						ans.append(z + 1)
					if nums1[z] == 1 and nums2[z] == 1 and (a > 0):
						a -= 1
						ans.append(z + 1)
					if nums1[z] == 0 and nums2[z] == 0 and (b > 0):
						b -= 1
						ans.append(z + 1)
				print(*ans)
				return
	print(-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())
s1 = [int(i) for i in input()]
s2 = [int(i) for i in input()]
a = [[] for i in range(4)]
for i in range(n):
	a[s2[i] * 2 + s1[i]].append(i + 1)

def cal(a0, a2):
	nota0 = len(a[0]) - a0
	nota2 = len(a[2]) - a2
	nota1 = a0 + a2 - nota0
	a1 = len(a[1]) - nota1
	a3 = n // 2 - a0 - a1 - a2
	nota3 = len(a[3]) - a3
	if len(a[0]) < a0:
		return None
	if len(a[2]) < a2:
		return None
	if len(a[1]) < a1 or a1 < 0:
		return None
	if len(a[3]) < a3 or a3 < 0:
		return None
	if a1 + a3 != nota2 + nota3:
		return None
	return (a0, a1, a2, a3)
ans = None
for i in range(n // 2 + 1):
	if ans != None:
		break
	for j in range(n // 2 + 1):
		ans = cal(i, j)
		if ans != None:
			break
if ans == None:
	print(-1)
else:
	res = []
	(a0, a1, a2, a3) = ans
	for i in range(a0):
		res.append(a[0][i])
	for i in range(a1):
		res.append(a[1][i])
	for i in range(a2):
		res.append(a[2][i])
	for i in range(a3):
		res.append(a[3][i])
	print(*res)


from sys import stdin, stdout
from itertools import combinations
from collections import defaultdict
import math

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

def stringListIn():
	return [x for x in stdin.readline().split()]

def intIn():
	return int(stdin.readline())

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

def neutral(zo, oz, oo, l):
	l3 = l
	if l3 % 2 == 0:
		oz = oz + oo[:l3 // 2]
		zo = zo + oo[l3 // 2:]
	else:
		oz = oz + oo[:l3 // 2] + [zo[0]]
		zo = zo[1:] + oo[l3 // 2:]
	return [zo, oz]
n = intIn()
c = stringIn()
a = stringIn()
(zz, oo, zo, oz) = ([], [], [], [])
for i in range(n):
	if c[i] == '0' and a[i] == '0':
		zz.append(i + 1)
	elif c[i] == '0' and a[i] == '1':
		zo.append(i + 1)
	elif c[i] == '1' and a[i] == '0':
		oz.append(i + 1)
	else:
		oo.append(i + 1)
(l1, l2) = (len(zo), len(oz))
(l3, l4) = (len(oo), len(zz))
if len(oz) == n or len(zo) == n:
	print(-1)
	exit(0)
if len(oo) == n or len(zz) == n:
	print(*list(range(1, n // 2 + 1)))
	exit(0)
if len(oz) == 0 and len(zo) == 0:
	if l3 % 2 == 0:
		zo = zo + oo[:l3 // 2] + zz[:l4 // 2]
		oz = oz + oo[l3 // 2:] + zz[l4 // 2:]
		oz.sort()
		print(*oz)
	else:
		print(-1)
	exit(0)
diff = abs(l1 - l2)
if diff == 0:
	(zo, oz) = neutral(zo, oz, oo, l3)
else:
	d = abs(diff - l3)
	m = min(diff, l3)
	if l2 > l1:
		if diff >= l3:
			zo = zo + oo[:m] + oz[:d]
			oz = oz[d:] + oo[m:]
		else:
			zo = zo + oo[:m]
			oo = oo[m:]
			(zo, oz) = neutral(zo, oz, oo, d)
	elif diff >= l3:
		oz = oz + oo[:m] + zo[:d]
		zo = zo[d:] + oo[m:]
	else:
		oz = oz + oo[:m]
		oo = oo[m:]
		(zo, oz) = neutral(zo, oz, oo, d)
(ll1, ll2) = (len(zo), len(oz))
cn = n // 2
lr1 = cn - ll1
zo = zo + zz[:lr1]
oz = oz + zz[lr1:]
(lll1, lll2) = (len(zo), len(oz))
if len(zo) != len(oz):
	print(-1)
else:
	oz.sort()
	print(*oz)


import math
n = int(input())
clowns = [int(c) for c in input()]
acrobats = [int(c) for c in input()]
case = [0] * 4
for i in range(n):
	case[3 - 2 * clowns[i] - acrobats[i]] += 1
n_group = int(n / 2)
n_max = min(n_group, case[0] + case[1], case[0] + case[2])
n_min = max(math.ceil(case[0] / 2), case[1] - (n_group - math.floor(case[0] / 2)), case[2] - (n_group - math.floor(case[0] / 2)))
find = False
for l in range(n_min, n_max + 1):
	for a in range(min(case[0], l) + 1):
		b = l - a
		if b > case[1]:
			continue
		c = case[0] - a + case[2] - a - b
		if c < 0 or c > case[2]:
			continue
		d = n_group - a - b - c
		if d < 0 or d > case[3]:
			continue
		find = True
		g1 = [a, b, c, d]
		break
	if find:
		break
if find:
	for i in range(n):
		c = 3 - 2 * clowns[i] - acrobats[i]
		if g1[c] > 0:
			g1[c] -= 1
			n_group -= 1
			print(i + 1, end=' ')
		if n_group == 0:
			print('')
			break
else:
	print(-1)


n = int(input())
c = input()
a = input()
a1 = 0
c1 = 0
ac = 0
ac0 = 0
lista = []
listc = []
listac = []
listac0 = []
output = []
p = n // 2
for i in range(0, n):
	if a[i] == '1' and c[i] == '0':
		a1 += 1
		lista.append(i + 1)
	if c[i] == '1' and a[i] == '0':
		c1 += 1
		listc.append(i + 1)
	if c[i] == '1' and a[i] == '1':
		ac += 1
		listac.append(i + 1)
	if c[i] == '0' and a[i] == '0':
		ac0 += 1
		listac0.append(i + 1)
if a1 > p or c1 > p or (ac % 2 == 1 and a1 == 0 and (c1 == 0)):
	print(-1)
	exit()
d = abs(a1 - c1)
if a1 >= c1:
	if a1 >= c1 + ac:
		for i in listc:
			output.append(i)
		for i in listac:
			output.append(i)
		for i in range(0, a1 - (c1 + ac)):
			output.append(lista[i])
	elif (c1 + ac - a1) % 2 == 0:
		for i in listc:
			output.append(i)
		for i in range(0, a1 - c1):
			output.append(listac[0])
			listac.pop(0)
		for i in range(0, len(listac) // 2):
			output.append(listac[i])
	else:
		if c1 != 0:
			listc.pop(0)
		for i in listc:
			output.append(i)
		for i in range(0, a1 - c1 + 1):
			output.append(listac[0])
			listac.pop(0)
		for i in range(0, len(listac) // 2):
			output.append(listac[i])
elif c1 <= a1 + ac:
	if (a1 + ac - c1) % 2 == 0:
		for i in listc:
			output.append(i)
		for i in range(0, (a1 + ac - c1) // 2):
			output.append(listac[i])
	else:
		output.append(lista[0])
		for i in listc:
			output.append(i)
		for i in range(0, (a1 + ac - 1 - c1) // 2):
			output.append(listac[i])
else:
	for i in range(0, a1 + ac):
		output.append(listc[i])
l = len(output)
for i in range(0, p - l):
	output.append(listac0[i])
if len(output) != p:
	print(-1)
	exit()
for i in output:
	print(i, end=' ')


def func(clown, acro, x):
	if clown[x] == '1':
		if acro[x] == '1':
			return 3
		else:
			return 1
	elif acro[x] == '1':
		return 2
	else:
		return 0

def main():
	length = int(input())
	clown = input()
	acro = input()
	arr = [0, 0, 0, 0]
	for x in range(length):
		arr[func(clown, acro, x)] += 1
	bound = arr[2] + arr[3] - length // 2
	bo = False
	for a in range(arr[0] + 1):
		d = a + bound
		if d >= 0 and d <= arr[3]:
			for b in range(arr[1] + 1):
				c = length // 2 - a - b - d
				if c >= 0 and c <= arr[2]:
					bo = True
					break
		if bo:
			break
	if bo:
		arr[0] = a
		arr[1] = b
		arr[2] = c
		arr[3] = d
		for x in range(length):
			test = func(clown, acro, x)
			if arr[test] > 0:
				arr[test] -= 1
				print(x + 1, end=' ')
	else:
		print(-1)
main()


from math import *
import math
n = int(input())
c = [int(i) for i in input()]
a = [int(i) for i in input()]
x = 0
y = 0
z = 0
for i in range(n):
	if c[i] and a[i]:
		x += 1
	elif a[i]:
		z += 1
	elif c[i]:
		y += 1
e = n - x - y - z
ha = False
y2 = 0
z2 = 0
d2 = 0
for y1 in range(0, y + 1):
	for z1 in range(0, z + 1):
		d = (x - y1 + z1) / 2
		if d >= 0 and d <= x:
			if int(d) == d:
				if y1 + d + z - z1 <= n / 2 and z1 + x - d + y - y1 <= n / 2:
					if e + y1 + d + z - z1 >= n // 2 and e + z1 + x - d + y - y1 >= n // 2:
						ha = True
						z2 = z1
						y2 = y1
						d2 = d
						break
	if ha:
		break
if ha:
	cnt = n // 2 - y2 - d2
	cnt1 = y2
	cnt2 = z2
	want = z - z2
	i = 0
	while i < n:
		if c[i] and a[i]:
			if d2 > 0:
				d2 -= 1
				print(i + 1, end=' ')
		elif c[i]:
			if cnt1 > 0:
				cnt1 -= 1
				print(i + 1, end=' ')
		elif a[i]:
			if cnt2 > 0:
				cnt2 -= 1
			elif cnt > 0:
				cnt -= 1
				want -= 1
				print(i + 1, end=' ')
		elif cnt > 0 and want < cnt:
			print(i + 1, end=' ')
			cnt -= 1
		i += 1
else:
	print(-1)


x = int(input())
s1 = input()
s2 = input()
a = []
b = []
c = []
d = []
for i in range(len(s1)):
	if s1[i] == '0' and s2[i] == '0':
		a.append(i + 1)
	elif s1[i] == '1' and s2[i] == '0':
		b.append(i + 1)
	elif s1[i] == '0' and s2[i] == '1':
		c.append(i + 1)
	else:
		d.append(i + 1)
flag = 1
for i in range(len(a) + 1):
	for j in range(len(b) + 1):
		if flag == 0:
			continue
		a1 = i
		a2 = len(a) - i
		b1 = j
		b2 = len(b) - j
		c1 = a2 + b2 - a1
		if c1 < 0:
			continue
		c2 = len(c) - c1
		p = c2 - b1
		q = len(d)
		if (p + q) % 2 != 0:
			continue
		if (p + q) // 2 >= 0:
			d1 = (p + q) // 2
			d2 = q - d1
		else:
			continue
		if min(a1, a2, b1, b2, c1, c2, d1, d2) < 0:
			continue
		else:
			flag = 0
if flag == 1:
	print(-1)
else:
	ans = []
	for i in range(a1):
		ans.append(a[i])
	for i in range(b1):
		ans.append(b[i])
	for i in range(c1):
		ans.append(c[i])
	for i in range(d1):
		ans.append(d[i])
	print(*ans)


n = int(input())
c = input()
a = input()
c = [int(x) for x in c]
a = [int(x) for x in a]
res = -1
nz = 0
na = 0
nc = 0
nb = 0
for (is_c, is_a) in zip(c, a):
	if is_c and is_a:
		nb += 1
	elif is_c:
		nc += 1
	elif is_a:
		na += 1
	else:
		nz += 1
rnb1 = None
rna1 = None
rnc1 = None
rnz1 = None
for nb2 in range(nb + 1):
	nb1 = nb - nb2
	mn = max(0, nb2 - nb1)
	mx = min(nc, na + nb2 - nb1) + 1
	for nc1 in range(mn, mx):
		if nc1 + nb1 - nb2 < 0:
			continue
		na2 = nc1 + nb1 - nb2
		if na2 > na:
			continue
		na1 = na - na2
		nz1 = n // 2 - na1 - nc1 - nb1
		if nz1 < 0 or nz1 > nz:
			continue
		rnb1 = nb1
		rna1 = na1
		rnc1 = nc1
		rnz1 = nz1
		break
	else:
		continue
	break
if rnb1 is None:
	print(-1)
else:
	t = []
	for (i, (is_c, is_a)) in enumerate(zip(c, a)):
		if is_c and is_a and rnb1:
			t.append(i + 1)
			rnb1 -= 1
		elif is_c and (not is_a) and rnc1:
			t.append(i + 1)
			rnc1 -= 1
		elif not is_c and is_a and rna1:
			t.append(i + 1)
			rna1 -= 1
		elif not is_c and (not is_a) and rnz1:
			t.append(i + 1)
			rnz1 -= 1
	print(' '.join([str(x) for x in t]))


from collections import deque, Counter, OrderedDict
from heapq import nsmallest, nlargest, heapify, heappop, heappush, heapreplace
from math import ceil, floor, log, log2, sqrt, gcd, factorial, pow, pi
from bisect import bisect_left, bisect_right

def binNumber(n, size=4):
	return bin(n)[2:].zfill(size)

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

def ini():
	return int(input())

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

def sti():
	return str(input())

def par(a):
	print(' '.join(list(map(str, a))))

def tdl(outerListSize, innerListSize, defaultValue=0):
	return [[defaultValue] * innerListSize for i in range(outerListSize)]

def sts(s):
	s = list(s)
	s.sort()
	return ''.join(s)

def bis(a, x):
	i = bisect_left(a, x)
	if i != len(a) and a[i] == x:
		return [i, True]
	else:
		return [-1, False]

class pair:

	def __init__(self, f, s):
		self.fi = f
		self.se = s

	def __lt__(self, other):
		return (self.fi, self.se) < (other.fi, other.se)
n = ini()
s1 = sti()
s2 = sti()
c = [0] * 4
p = [[], [], [], []]
for i in range(n):
	if s1[i] == '0' and s2[i] == '0':
		c[0] += 1
		p[0].append(i + 1)
	if s1[i] == '0' and s2[i] == '1':
		c[1] += 1
		p[1].append(i + 1)
	if s1[i] == '1' and s2[i] == '0':
		c[2] += 1
		p[2].append(i + 1)
	if s1[i] == '1' and s2[i] == '1':
		c[3] += 1
		p[3].append(i + 1)
for a in range(c[0] + 1):
	for b in range(c[1] + 1):
		d = c[3] + c[1] - n // 2 + a
		e = n // 2 - a - b - d
		if e > c[2] or d > c[3]:
			continue
		if d >= 0 and e >= 0:
			for i in range(a):
				print(p[0][i], end=' ')
			for i in range(b):
				print(p[1][i], end=' ')
			for i in range(e):
				print(p[2][i], end=' ')
			for i in range(d):
				print(p[3][i], end=' ')
			quit()
print(-1)


import os
import sys
import math
from io import BytesIO, IOBase
from fractions import Fraction
from collections import defaultdict
from itertools import permutations
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')
n = int(input())
d = {v: [] for v in [(0, 0), (0, 1), (1, 0), (1, 1)]}
for (j, x, y) in zip(range(n), map(int, input()), map(int, input())):
	d[x, y] += [j + 1]
x = n // 2
y = len(d[0, 1]) + len(d[1, 1])
x += x - y
c = min(x, y, len(d[0, 1]) + len(d[1, 0]))
if c % 2 != y % 2:
	c -= 1
b = (y - c) // 2
a = (x - c) // 2
if a <= len(d[0, 0]) and 0 <= c and (b <= len(d[1, 1])):
	print(*d[0, 0][:a] + (d[0, 1] + d[1, 0])[:c] + d[1, 1][:b])
else:
	print(-1)


import os
import sys
from io import BytesIO, IOBase
from collections import defaultdict, deque, Counter, OrderedDict
import threading

def main():
	n = int(input())
	c = input()
	a = input()
	D = [0, 0, 0, 0]
	S = [[] for _ in range(4)]
	A = []
	for i in range(n):
		if c[i] == '0' and a[i] == '0':
			D[0] += 1
			A.append(0)
			S[3].append(i)
		if c[i] == '1' and a[i] == '0':
			D[1] += 1
			S[0].append(i)
			A.append(1)
		if c[i] == '0' and a[i] == '1':
			D[2] += 1
			S[1].append(i)
			A.append(2)
		if c[i] == '1' and a[i] == '1':
			D[3] += 1
			S[2].append(i)
			A.append(3)
	for t in range(n // 2 + 1):
		ans = []
		(x, y) = (0, D[2] + D[3])
		for i in range(len(S[2])):
			if x != t and len(ans) != n // 2 and (y > t):
				ans.append(S[2][i] + 1)
				x += 1
				y -= 1
		for i in range(len(S[0])):
			if x != t and len(ans) != n // 2:
				ans.append(S[0][i] + 1)
				x += 1
		for i in range(len(S[1])):
			if y > t and len(ans) != n // 2:
				ans.append(S[1][i] + 1)
				y -= 1
		if len(ans) != n // 2 and len(S[3]) >= n // 2 - len(ans):
			for i in range(n // 2 - len(ans)):
				ans.append(S[3][i] + 1)
		if x == t and y == t and (len(ans) == n // 2):
			print(*sorted(ans))
			exit()
	print(-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()


import sys
n = int(input())
c = [int(x) for x in input()]
a = [int(x) for x in input()]
by_diff = {i: [] for i in range(3)}
diff = [c[i] + a[i] for i in range(n)]
for i in range(n):
	by_diff[c[i] + a[i]].append(i + 1)
total_sum = sum(a)
total_count = [len(by_diff[i]) for i in range(3)]
for count2 in range(total_count[2] + 1):
	count1 = total_sum - 2 * count2
	count0 = n // 2 - count2 - count1
	if 0 <= count0 <= total_count[0] and 0 <= count1 <= total_count[1]:
		print(' '.join(map(str, by_diff[0][:count0] + by_diff[1][:count1] + by_diff[2][:count2])))
		sys.exit(0)
print(-1)


n = int(input())
c_s = input()
a_s = input()
clowns = []
acrobats = []
both = []
none = []
for i in range(n):
	if a_s[i] == '1' and c_s[i] == '1':
		both.append(i + 1)
	elif a_s[i] == '1':
		acrobats.append(i + 1)
	elif c_s[i] == '1':
		clowns.append(i + 1)
	else:
		none.append(i + 1)
nc = len(clowns)
nb = len(acrobats)
nd = len(both)
na = len(none)
found = False
for b in range(0, nb + 1):
	for c in range(0, nc + 1):
		d = nb + nd - c - b
		if d % 2 == 1:
			continue
		d = d // 2
		a = n // 2 - d - c - b
		if d < 0 or d > nd or a > na or (a < 0):
			continue
		found = True
		break
	if found:
		break
if not found:
	print(-1)
else:
	ans = []
	for i in range(a):
		ans.append(none[i])
	for i in range(b):
		ans.append(acrobats[i])
	for i in range(c):
		ans.append(clowns[i])
	for i in range(d):
		ans.append(both[i])
	print(*ans)


n = int(input())
s1 = input()
s2 = input()
count1 = 0
count2 = 0
count3 = 0
count4 = 0
l1 = set()
l2 = set()
l3 = set()
l4 = set()
for i in range(n):
	if s1[i] == '1' and s2[i] == '0':
		count1 += 1
		l1.add(i + 1)
	if s1[i] == '0' and s2[i] == '1':
		count2 += 1
		l2.add(i + 1)
	if s1[i] == '0' and s2[i] == '0':
		count3 += 1
		l3.add(i + 1)
	if s1[i] == '1' and s2[i] == '1':
		count4 += 1
		l4.add(i + 1)
ka = {}
(a, b, c, d) = (-1, -1, -1, -1)
for i in range(count3 + 1):
	for j in range(count4 + 1):
		if j - i == count4 + count2 - n // 2:
			ka[i + j] = (i, j)
for i in range(count1 + 1):
	flag = 1
	for j in range(count2 + 1):
		if n // 2 - (i + j) in ka:
			(x, y) = ka[n // 2 - (i + j)]
			flag = 0
			(a, b, c, d) = (i, j, x, y)
			break
	if not flag:
		break
if a != -1 and b != -1 and (c != -1) and (d != -1):
	ans = []
	l1 = list(l1)
	l2 = list(l2)
	l3 = list(l3)
	l4 = list(l4)
	for i in range(a):
		ans.append(l1[i])
	for i in range(b):
		ans.append(l2[i])
	for i in range(c):
		ans.append(l3[i])
	for i in range(d):
		ans.append(l4[i])
	print(*ans)
else:
	print(-1)


n = int(input())
s = input()
t = input()
(na, nb, nc, nd) = (0, 0, 0, 0)
for i in range(n):
	if s[i] == '0' and t[i] == '0':
		na += 1
	if s[i] == '0' and t[i] == '1':
		nb += 1
	if s[i] == '1' and t[i] == '0':
		nc += 1
	if s[i] == '1' and t[i] == '1':
		nd += 1
ans = []
for b in range(nb + 1):
	for c in range(nc + 1):
		if (nb + nd - b - c) % 2 == 1:
			continue
		d = (nb + nd - b - c) // 2
		if d < 0 or d > nd:
			continue
		a = n // 2 - b - c - d
		if a < 0 or a > na:
			continue
		else:
			for i in range(n):
				if s[i] == '0' and t[i] == '0' and (a > 0):
					a -= 1
					ans.append(i + 1)
				if s[i] == '0' and t[i] == '1' and (b > 0):
					b -= 1
					ans.append(i + 1)
				if s[i] == '1' and t[i] == '0' and (c > 0):
					c -= 1
					ans.append(i + 1)
				if s[i] == '1' and t[i] == '1' and (d > 0):
					d -= 1
					ans.append(i + 1)
		print(*ans)
		exit(0)
print(-1)


n = int(input())
c = input()
a = input()
c00 = c01 = c10 = c11 = 0
d00 = []
d01 = []
d10 = []
d11 = []
for i in range(n):
	if c[i] == '1' and a[i] == '1':
		c11 += 1
		d11.append(i)
	elif c[i] == '0' and a[i] == '1':
		c01 += 1
		d01.append(i)
	elif c[i] == '1' and a[i] == '0':
		c10 += 1
		d10.append(i)
	elif c[i] == '0' and a[i] == '0':
		c00 += 1
		d00.append(i)
for cc in range(n):
	nc = n // 2 - cc
	for j in range(cc + 1):
		if j > c10 or cc - j > c11:
			continue
		lc10 = c10 - j
		lc11 = c11 - (cc - j)
		if lc11 > cc:
			continue
		if lc10 + lc11 > n // 2:
			continue
		la = n // 2 - lc10 - lc11
		mn = lc11 + (la - min(la, c00))
		mx = lc11 + min(la, c01)
		if cc >= mn and cc <= mx:
			neans = []
			neans += d10[:lc10]
			neans += d11[:lc11]
			neans += d01[:cc - lc11]
			neans += d00[:n // 2 - len(neans)]
			ans = list(set(range(n)) - set(neans))
			print(' '.join([str(i + 1) for i in ans]))
			exit()
print(-1)


from sys import stdin, stdout
from math import gcd, sqrt, factorial, pi, inf
from collections import deque, defaultdict
from bisect import bisect, bisect_left
from time import time
from itertools import permutations as per
from heapq import heapify, heappush, heappop, heappushpop
input = stdin.readline
R = lambda : map(int, input().split())
I = lambda : int(input())
S = lambda : input().rstrip('\r\n')
L = lambda : list(R())
P = lambda x: stdout.write(str(x) + '\n')
lcm = lambda x, y: x * y // gcd(x, y)
nCr = lambda x, y: f[x] * inv(f[y] * f[x - y] % N) % N
inv = lambda x: pow(x, N - 2, N)
sm = lambda x: (x ** 2 + x) // 2
N = 10 ** 9 + 7
n = I()
g = {(0, 0): [], (1, 0): [], (1, 1): [], (0, 1): []}
for (i, x, y) in zip(range(n), S(), S()):
	g[int(x), int(y)] += (i + 1,)
w = len(g[0, 0])
x = len(g[0, 1])
y = len(g[1, 1])
z = len(g[1, 0])
for b in range(len(g[0, 1]) + 1):
	for d in range(len(g[1, 1]) + 1):
		c = x + y - (b + 2 * d)
		a = n // 2 - (b + d + c)
		if w >= a >= 0 and z >= c >= 0:
			print(*g[0, 0][:a] + g[1, 1][:d] + g[1, 0][:c] + g[0, 1][:b])
			exit()
print(-1)


cnt = [0] * 4
ans = [0] * 4
n = int(input())
c = [int(i) for i in input()]
an = [int(i) for i in input()]
for i in range(n):
	cnt[(c[i] & 1) << 1 | an[i] & 1] += 1
fl = 1
for d in range(cnt[3] + 1):
	a = (n >> 1) + d - cnt[1] - cnt[3]
	if a >= 0 and a <= cnt[0]:
		bc = cnt[1] + cnt[3] - 2 * d
		if bc >= 0 and bc <= cnt[1] + cnt[2]:
			ans[0] = a
			ans[3] = d
			ans[1] = min(bc, cnt[1])
			ans[2] = bc - ans[1]
			fl = 0
if fl == 1:
	exit(print(-1))
else:
	for i in range(n):
		tmp = (c[i] & 1) << 1 | an[i] & 1
		if ans[tmp]:
			print(i + 1, end=' ')
			ans[tmp] -= 1


n = int(input())
c = input()
a = input()
aCnt = 0
bCnt = 0
cCnt = 0
dCnt = 0
for i in range(n):
	if a[i] == '0' and c[i] == '0':
		aCnt += 1
	if a[i] == '0' and c[i] == '1':
		cCnt += 1
	if a[i] == '1' and c[i] == '0':
		bCnt += 1
	if a[i] == '1' and c[i] == '1':
		dCnt += 1
isDone = False
for j in range(n + 1):
	a1 = n // 2 - j
	d1 = bCnt + dCnt - j
	b1Plusc1 = j - d1
	if a1 >= 0 and d1 >= 0 and (b1Plusc1 >= 0) and (b1Plusc1 <= bCnt + cCnt) and (a1 <= aCnt) and (d1 <= dCnt):
		ans = []
		for i in range(n):
			if a[i] == '0' and c[i] == '0' and (a1 > 0):
				ans.append(str(i + 1))
				a1 -= 1
			if (a[i] == '0' and c[i] == '1' or (a[i] == '1' and c[i] == '0')) and b1Plusc1 > 0:
				ans.append(str(i + 1))
				b1Plusc1 -= 1
			if a[i] == '1' and c[i] == '1' and (d1 > 0):
				ans.append(str(i + 1))
				d1 -= 1
		isDone = True
		print(' '.join(ans))
		break
if not isDone:
	print(-1)


n = int(input())
(*c,) = zip(input(), input())
from collections import Counter
x = Counter(c)
convert = {('0', '0'): 0, ('1', '0'): 1, ('0', '1'): 2, ('1', '1'): 3}
d = [x['0', '0'], x['1', '0'], x['0', '1'], x['1', '1']]
k = n // 2
found = False
for s2 in range(min(k, d[2]) + 1):
	for s3 in range(min(k - s2, d[3]) + 1):
		s0 = s3 + k - d[2] - d[3]
		s1 = d[2] + d[3] - 2 * s3 - s2
		if 0 <= s0 <= d[0] and 0 <= s1 <= d[1]:
			the_sol = [s0, s1, s2, s3]
			found = True
if found:
	to_print = []
	for (i, x) in enumerate(c):
		if the_sol[convert[x]] != 0:
			to_print.append(i + 1)
			the_sol[convert[x]] -= 1
	print(*to_print)
else:
	print(-1)


import sys
DBG = not True
n = int(input())
cc = input()
aa = input()
c = []
a = []
for i in range(n):
	c.append(1 if cc[i] == '1' else 0)
	a.append(1 if aa[i] == '1' else 0)
e = [0, 0, 0, 0]
g = [[], [], [], []]
if DBG:
	print(c)
	print(a)
for i in range(n):
	if c[i] == 0 and a[i] == 0:
		e[0] += 1
		g[0].append(i)
	elif c[i] == 0 and a[i] == 1:
		e[1] += 1
		g[1].append(i)
	elif c[i] == 1 and a[i] == 0:
		e[2] += 1
		g[2].append(i)
	elif c[i] == 1 and a[i] == 1:
		e[3] += 1
		g[3].append(i)
for x2 in range(min(e[2], n // 2) + 1):
	for x3 in range(min(e[3], n // 2 - x2) + 1):
		y3 = e[3] - x3
		y1 = x2 + x3 - y3
		x1 = e[1] - y1
		x0 = n // 2 - x1 - x2 - x3
		if 0 <= x1 and x1 <= min(e[1], n // 2) and (0 <= x0) and (x0 <= min(e[0], n // 2)):
			for i in range(x0):
				sys.stdout.write(str(g[0][i] + 1) + ' ')
			for i in range(x1):
				sys.stdout.write(str(g[1][i] + 1) + ' ')
			for i in range(x2):
				sys.stdout.write(str(g[2][i] + 1) + ' ')
			for i in range(x3):
				sys.stdout.write(str(g[3][i] + 1) + ' ')
			print('')
			sys.exit(0)
print(-1)


n = int(input())
c = input()
a = input()
buff = [[] for i in range(4)]
for i in range(n):
	if a[i] == c[i] == '0':
		buff[0].append(i)
	elif c[i] == '1' and a[i] == '0':
		buff[1].append(i)
	elif c[i] == '0' and a[i] == '1':
		buff[2].append(i)
	else:
		buff[3].append(i)
ans = [0] * n
while buff[1] and buff[2]:
	ans[buff[1].pop()] = 1
	ans[buff[2].pop()] = 2
if buff[1] or buff[2]:
	k = 1 if len(buff[1]) != 0 else 2
	while buff[k] and buff[3]:
		if k == 1:
			ans[buff[k].pop()] = 1
			ans[buff[3].pop()] = 2
		else:
			ans[buff[3].pop()] = 1
			ans[buff[k].pop()] = 2
	if len(buff[k]) > 0:
		while buff[k] and buff[0]:
			if k == 1:
				ans[buff[0].pop()] = 1
				ans[buff[k].pop()] = 2
			else:
				ans[buff[k].pop()] = 1
				ans[buff[0].pop()] = 2
if buff[1] or buff[2]:
	ans = []
else:
	while len(buff[0]) > 1:
		ans[buff[0].pop()] = 1
		ans[buff[0].pop()] = 2
	while len(buff[3]) > 1:
		ans[buff[3].pop()] = 1
		ans[buff[3].pop()] = 2
	if buff[0] and buff[3]:
		i = 0
		while i < n:
			if c[i] == '1' and a[i] == '0':
				ans[i] = 2
				break
			i += 1
		if i == n:
			ans = []
		else:
			ans[buff[0].pop()] = 1
			ans[buff[3].pop()] = 1
if len(ans) == 0:
	print(-1)
else:
	for i in range(len(ans)):
		if ans[i] % 2:
			print('{0} '.format(i + 1), end='')