#include <bits/stdc++.h>
#define db1(x) cout<<#x<<"="<<x<<'\n'
#define db2(x,y) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<'\n'
#define db3(x,y,z) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<","<<#z<<"="<<z<<'\n'
#define rep(i,n) for(int i=0;i<(n);++i)
#define repA(i,a,n) for(int i=a;i<=(n);++i)
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
 
#define repD(i,a,n) for(int i=a;i>=(n);--i)
 
using namespace std;
using ll =   long long;
ll dp[5005][5005];
ll fact(ll n)
{
    if(n==0||n==1)return 1;
    else {
        ll ans = n;
        n--;
        while(n!=1)
        {
            ans *= n;
            n--;
        }
        return ans;
    }
}
set<ll> taken;
ll m;
ll a[5005];
//vector <ll> ones, zeros;
// ll solve(ll i, ll start, ll n)
// {
//     if(i==m)return 0;
//     else {
//         if(dp[i][start]!=-1)return dp[i][start];
//         //a[ones[i]] = 0;
//         ll ans = 100000000000;
//         //a[ones[i]] = 0;
//         ans = min( ans, solve(i+1,start + 1,vis1, vis2,n) + abs(ones[i]-start));
//         ans = min(ans, solve(i+1, start))
        
//         return dp[i][start] = ans;
//     }
// }
int main()
{
    ll n;
    cin>>n;
    //ll a[n];
    ll i,j;
    string s,t;
    cin>>s>>t;
    set <ll,greater<>> szero,tzero;
    for(i=0;i<n;i++)
    {
        if(s[i]=='0')
        {
            szero.insert(i);
        }
        if(t[i]=='0')
        {
            tzero.insert(i);
        }
    }
    if (tzero.size()!=szero.size()) {
      cout << -1;
      return 0;
   }
    ll f = 0;
    ll ans = 0;
    for(auto it: tzero)
    {
        if(it!=*szero.begin())
        {
            ans++;
        }
        szero.erase(szero.begin());
        
    }
    if(f)ans = -1;
        cout<<ans<<endl;
}
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for(int i = n-1; i >= 0; i--)
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  FastIO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define sz(x) ((int)(x).size())
typedef long long ll;
using P = pair<int,int>;
using VI = vector<int>;
using VVI = vector<vector<int>>;
using VL = vector<ll>;
using VVL = vector<vector<ll>>;
using VP = vector<P>;
template<typename T> void view(T e){std::cout << e << std::endl;}
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return true; } return false; }

const int inf = 1 << 30;
const ll INF = 1LL << 60;

int main(){
    int n, m;
    cin >> n >> m;
    if (n == 1 && m == 0){
        printf("%d %d\n", 1, 2);
        return 0;
    }
    if (m >= n-1 || m < 0){
        cout << -1 << endl;
        return 0;
    }
    VP ans;
    rep(i,m+1){
        if (i == 0) ans.emplace_back(2, 3);
        else ans.emplace_back(ans.back().first+2, ans.back().second+2);
    }
    ans.emplace_back(1, ans.back().second+1);
    for(int i = m+1; i <= n; i++){
        if (i == m+1) ans.emplace_back(ans.back().second+1 ,ans.back().second+2);
        else ans.emplace_back(ans.back().first+2, ans.back().second+2);
    }
    rep(i,n){
        printf("%d %d\n", ans[i].first, ans[i].second);
    }
    return 0;
}