/*
Problem: 1138B
Date: 22-01-2024 05:16 AM
*/
#include <iostream>
#include <set>
#include <vector>
#include <cmath>
using namespace std;
int n;
string c, a;
vector<int> s[2][2];
vector<int> f;
int main() {
cin >> n >> c >> a;
for(int i = 0; i < n; i++) {
s[c[i] - '0'][a[i] - '0'].push_back(i + 1);
}
int na = s[0][0].size(), nb = s[0][1].size(), nc = s[1][0].size(), nd = s[1][1].size();
for(int a = 0; a <= na; a++) {
for(int b = 0; b <= nb; b++) {
int d = a - n/2 + nb + nd;
int c = nb + nd - b - 2 * d;
if(0 <= c && c <= nc && 0 <= d && d <= nd) {
for(int i = 0; i < a; i++) {
cout << s[0][0][i] << " ";
}for(int i = 0; i < b; i++) {
cout << s[0][1][i] << " ";
}for(int i = 0; i < c; i++) {
cout << s[1][0][i] << " ";
}for(int i = 0; i < d; i++) {
cout << s[1][1][i] << " ";
}
return 0;
}
}
}
cout << -1 << endl;
}
791. Custom Sort String | 787. Cheapest Flights Within K Stops |
779. K-th Symbol in Grammar | 701. Insert into a Binary Search Tree |
429. N-ary Tree Level Order Traversal | 739. Daily Temperatures |
647. Palindromic Substrings | 583. Delete Operation for Two Strings |
518. Coin Change 2 | 516. Longest Palindromic Subsequence |
468. Validate IP Address | 450. Delete Node in a BST |
445. Add Two Numbers II | 442. Find All Duplicates in an Array |
437. Path Sum III | 436. Find Right Interval |
435. Non-overlapping Intervals | 406. Queue Reconstruction by Height |
380. Insert Delete GetRandom O(1) | 332. Reconstruct Itinerary |
368. Largest Divisible Subset | 377. Combination Sum IV |
322. Coin Change | 307. Range Sum Query - Mutable |
287. Find the Duplicate Number | 279. Perfect Squares |
275. H-Index II | 274. H-Index |
260. Single Number III | 240. Search a 2D Matrix II |