stablegradients/pie-gem5-pairs huggingface dataset:
// Slower C++ solution:
// In the name of God



#include<bits/stdc++.h>



#define F first

#define S second

#define PB push_back

#define sz(s) int((s).size())

#define bit(n,k) (((n)>>(k))&1)



using namespace std;



typedef long long ll;

typedef pair<int,int> pii;

typedef pair<ll,ll> pll;



const int maxn=1e5+10,mod=1e9+7;

const ll inf=1e18;



vector<int>v;

vector<pii>ed;



int main(){

    string s;cin>>s;

    int n=sz(s);

    bool yp=s[n-1]=='0';

    yp&=s[0]=='1';

    for(int i=0;i<n-1;i++){

	yp&=(s[i]==s[n-i-2]);

    }

    if(!yp){

	return cout<<-1<<endl,0;

    }

    for(int i=1;i<n-1;i++){

	if(s[i]=='1')

	    v.PB(i+1);

    }

    v.PB(n);

    int nw=1,C=2,SZ=1;

    for(int x:v){

	SZ++;

	int r=C++;

	ed.PB({nw,r});

	nw=r;

	while(SZ<x){

	    ed.PB({nw,C++});

	    SZ++;

	}

    }

    for(pii p:ed){

	cout<<p.F<<" "<<p.S<<endl;

    }

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.388261586920654x):
#include <cstdio>

#include <cstring>



char arr[100010];

int prv[100010];



int main() {

	scanf("%s", arr + 1);

	int n = strlen(arr + 1);

	if (arr[1] == '0' || arr[n] == '1') {

		puts("-1");

		return 0;

	}

	for (int i = n - 1; i; --i)

		if (arr[i] != arr[n - i]) {

			puts("-1");

			return 0;

		

		}

	int pos = 1;

	for (int i = 2; i < n; ++i)

		if (arr[i] == '1') {

			prv[i] = pos;

			pos = i;

		}

	int ct = 1, pp = n, cur = 1;

	for (int i = pos; i; i = prv[i]) {

		int nx = ct;

		for (int j = i; j < pp; ++j) {

			printf("%d %d\n", cur, ++ct);

		}

		cur = nx + 1;

		pp = i;

	}

	return 0;

}
// Slower C++ solution:
#include <iostream>

#include <vector>

#include <cstring>

#include <algorithm>

using namespace std;

const int maxn=1e5+5;

char s[maxn];

vector<int>G[maxn];

int last,len;

void dfs(int rt,int size){

	if (last==len) return;

	last++;

	if (s[size-1]=='1'){

		G[last].push_back(rt);

		dfs(last,size+1);

	}else{

		G[rt].push_back(last);

		dfs(rt,size+1);

	}

}

void dfs1(int rt){

	for (auto i:G[rt]){

		cout << rt << ' ' << i << '\n';

		dfs1(i);

	}

}

int main(){

	scanf("%s",&s);

	len=strlen(s);

	if (s[len-1]=='1'||s[0]=='0'||s[len-2]=='0'){

		cout << -1;

		return 0;

	}

	for (int i=1;i<len-2;i++){

		if (s[i]!=s[len-2-i]){

			cout << -1;

			return 0;

		}

	}

	last=2;

	G[2].push_back(1);

	dfs(2,2);

	dfs1(last);

}

// Faster C++ solution for the same problem (measured speedup: 18.904042726435108x):
#include <cstdio>

#include <cstring>



char arr[100010];

int prv[100010];



int main() {

	scanf("%s", arr + 1);

	int n = strlen(arr + 1);

	if (arr[1] == '0' || arr[n] == '1') {

		puts("-1");

		return 0;

	}

	for (int i = n - 1; i; --i)

		if (arr[i] != arr[n - i]) {

			puts("-1");

			return 0;

		

		}

	int pos = 1;

	for (int i = 2; i < n; ++i)

		if (arr[i] == '1') {

			prv[i] = pos;

			pos = i;

		}

	int ct = 1, pp = n, cur = 1;

	for (int i = pos; i; i = prv[i]) {

		int nx = ct;

		for (int j = i; j < pp; ++j) {

			printf("%d %d\n", cur, ++ct);

		}

		cur = nx + 1;

		pp = i;

	}

	return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

const int N=200200;



void GG(){

	puts("-1");

	exit(0);

}



vector<int> qaq;



void ae(int i,int j){

	printf("%d %d\n",i,j);

}



char s[N];

int main(){

	scanf("%s",s+1);

	int n=strlen(s+1);

	if(s[n]=='1')GG();

	if(s[1]=='0'||s[n-1]=='0')GG();

	for(int i=1;i<=n-1;i++){

		if(s[i]!=s[n-i])GG();

	}



	s[n]=1;



	qaq.push_back(1);

	for(int i=2;i<=n;i++){

		if(s[i]=='0'){

			qaq.push_back(i);

		}else{

			for(vector<int>::iterator it=qaq.begin();it!=qaq.end();it++){

				ae(*it,i);

			}

			qaq.clear();

			qaq.push_back(i);

		}

	}

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.3175551222438875x):
#include <cstdio>

#include <cstring>



char arr[100010];

int prv[100010];



int main() {

	scanf("%s", arr + 1);

	int n = strlen(arr + 1);

	if (arr[1] == '0' || arr[n] == '1') {

		puts("-1");

		return 0;

	}

	for (int i = n - 1; i; --i)

		if (arr[i] != arr[n - i]) {

			puts("-1");

			return 0;

		

		}

	int pos = 1;

	for (int i = 2; i < n; ++i)

		if (arr[i] == '1') {

			prv[i] = pos;

			pos = i;

		}

	int ct = 1, pp = n, cur = 1;

	for (int i = pos; i; i = prv[i]) {

		int nx = ct;

		for (int j = i; j < pp; ++j) {

			printf("%d %d\n", cur, ++ct);

		}

		cur = nx + 1;

		pp = i;

	}

	return 0;

}
// Slower C++ solution:
#include <iostream>

#include <algorithm>

#include <cstdio>

#include <cstring>



const int MAXN = 1e5 + 7;

char s[MAXN];



int main() {

    scanf("%s", s + 1);

    int len = strlen(s + 1);

    if (s[1] == '0' || s[len] == '1') return printf("-1\n"), 0;

    for (int i = 1; i <= len / 2; i++) if (s[i] ^ s[len - i]) return printf("-1\n"), 0;

    int x = 1;

    for (int i = 2; i <= len; i++) {

        printf("%d %d\n", x, i);

        if (s[i - 1] == '1') x = i; 

    }

    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.276647667616619x):
#include <cstdio>

#include <cstring>



char arr[100010];

int prv[100010];



int main() {

	scanf("%s", arr + 1);

	int n = strlen(arr + 1);

	if (arr[1] == '0' || arr[n] == '1') {

		puts("-1");

		return 0;

	}

	for (int i = n - 1; i; --i)

		if (arr[i] != arr[n - i]) {

			puts("-1");

			return 0;

		

		}

	int pos = 1;

	for (int i = 2; i < n; ++i)

		if (arr[i] == '1') {

			prv[i] = pos;

			pos = i;

		}

	int ct = 1, pp = n, cur = 1;

	for (int i = pos; i; i = prv[i]) {

		int nx = ct;

		for (int j = i; j < pp; ++j) {

			printf("%d %d\n", cur, ++ct);

		}

		cur = nx + 1;

		pp = i;

	}

	return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>



using namespace std;



const int maxn = 1e5 + 10;

int cnt, n;

char s[maxn];

vector<int>g[maxn];

bool check()

{

	//n = strlen(s + 1);

	//cout << "!" << endl;

	if(s[1] != '1' || s[n] != '0')

		return 0;

	//cout << "!" << endl;

	int st = 1, ed = n - 1;

	while(st < ed)

	{

		if(s[st] != s[ed])

			return 0;

		st ++; ed --;

	}

	return 1;

}

struct Edge

{

	int u, v;

}e[maxn * 2];

int edge_num;

void dfs(int x, int fa)

{

	for(int i = g[x].size() - 1; i >= 0; i --)

	{

		int to = g[x][i];

		if(to == fa)

			continue;

		e[++ edge_num].u = x;

		e[edge_num].v = to;

		dfs(to, x);

	}

}

int main()

{

	//int n;

	//scanf("%d", &n);

	scanf("%s", s + 1);

	n = strlen(s + 1);

	if(!check())

	{

		cout << -1;

		return 0;

	}

	int op = ++ cnt;

	g[1].push_back(2); g[2].push_back(1);

	op = ++ cnt;

	for(int i = 2; i < n; i ++)

	{

		if(s[i] == '1')

		{

			if(s[i - 1] != '0')

			{

				++ cnt;

				g[cnt].push_back(op);

				g[op].push_back(cnt);

			}

			op = cnt;

		}

		else

		{

			if(s[i - 1] == '1')

			{

				++ cnt;

				g[cnt].push_back(op);

				g[op].push_back(cnt);

				++ cnt;

				g[cnt].push_back(op);

				g[op].push_back(cnt);

			}

			else

			{

				++ cnt;

				g[cnt].push_back(op);

				g[op].push_back(cnt);

			}

		}

	}

	dfs(1, 0);

	for(int i = 1; i < n; i ++)

		printf("%d %d\n", e[i].u, e[i].v);

	return 0;

}


// Faster C++ solution for the same problem (measured speedup: 18.904384280785962x):
#include <cstdio>

#include <cstring>



char arr[100010];

int prv[100010];



int main() {

	scanf("%s", arr + 1);

	int n = strlen(arr + 1);

	if (arr[1] == '0' || arr[n] == '1') {

		puts("-1");

		return 0;

	}

	for (int i = n - 1; i; --i)

		if (arr[i] != arr[n - i]) {

			puts("-1");

			return 0;

		

		}

	int pos = 1;

	for (int i = 2; i < n; ++i)

		if (arr[i] == '1') {

			prv[i] = pos;

			pos = i;

		}

	int ct = 1, pp = n, cur = 1;

	for (int i = pos; i; i = prv[i]) {

		int nx = ct;

		for (int j = i; j < pp; ++j) {

			printf("%d %d\n", cur, ++ct);

		}

		cur = nx + 1;

		pp = i;

	}

	return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>



#define fi first

#define se second

#define ll long long

#define pb push_back

#define mp make_pair

#define mt make_tuple



using namespace std;



int niz[100010];

vector<int> graf[100010];

vector<pair<int, int>> res;



int main()

{

    ios_base::sync_with_stdio(false);

    cin.tie(NULL);



    string s;

    cin >> s;

    int n = s.size();

    for(int i = 1; i <= n; i++)

        niz[i] = s[i-1] - '0';

    bool ok = true;

    if(niz[1] == 0 || niz[n] == 1) ok = false;

    for(int i = 1; i <= n/2; i++)

        if(niz[i] != niz[n - i]) {ok = false; break;}



    if(!ok) {cout << -1; return 0;}



    int tr = 1;

    for(int i = 1; i < n; i++)

    {

        res.pb(mp(i+1, tr));



        if(niz[i] == 1)

            tr = i + 1;

    }

    for(int i = 0; i < res.size(); i++)

        cout << res[i].fi << " " << res[i].se << "\n";





    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 19.12893955302235x):
#include <cstdio>

#include <cstring>



char arr[100010];

int prv[100010];



int main() {

	scanf("%s", arr + 1);

	int n = strlen(arr + 1);

	if (arr[1] == '0' || arr[n] == '1') {

		puts("-1");

		return 0;

	}

	for (int i = n - 1; i; --i)

		if (arr[i] != arr[n - i]) {

			puts("-1");

			return 0;

		

		}

	int pos = 1;

	for (int i = 2; i < n; ++i)

		if (arr[i] == '1') {

			prv[i] = pos;

			pos = i;

		}

	int ct = 1, pp = n, cur = 1;

	for (int i = pos; i; i = prv[i]) {

		int nx = ct;

		for (int j = i; j < pp; ++j) {

			printf("%d %d\n", cur, ++ct);

		}

		cur = nx + 1;

		pp = i;

	}

	return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

//#include<ext/rope>

//using namespace __gnu_cxx

//#include<ext/pb_ds/priority_queue.hpp>

//using namespace __gnu_pbds;

#define lowbit(x) (x&-x)

#define pb push_back

#define empb emplace_back

#define all(x) (x).begin(),(x).end()

#define clr(a,b) memset(a,b,sizeof(a))

#define caze(T) for(cin>>T;T;T--)

#define inf (1<<29)

#define Endl ('\n')

#define fi first

#define se second

#define db double

#define ldb long double

#define ll long long

#define pii pair<int,int>

#define pil pair<int,ll>

#define pli pair<ll,int>

#define pll pair<ll,ll>

#define ull unsigned long long

#define IOS ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)

inline char nc() {

	#define SZ 1000000

	static char buf[SZ], *p1, *p2;

	return p1==p2&&(p2=(p1=buf)+fread(buf,1,SZ,stdin),p1==p2)?EOF:*p1++;

}

template<typename T>

inline int scan(T &x) {

	char c, sign=1; 

	while(!isdigit(c=nc())&&c!=EOF)if(c=='-')sign*=-1;

	if(c==EOF) return EOF;

	for(x = 0; isdigit(c); c = nc())

		x = (x<<1) + (x<<3) + (c&15);

	return x *= sign, 1;

}

template<typename T, typename...Args>

inline int scan(T &x, Args&...args) {

	return scan(x), scan(args...);

}

char s[1<<17];

int main()

{

	cin>>s+1;

	int n=strlen(s+1);

	if(s[1]=='0'||s[n]=='1') return 0*puts("-1");

	for(int i=1;i<n;++i)

		if(s[i]!=s[n-i])

			return 0*puts("-1");

	int a=1;

	for(int i=2;i<=n;++i)

	{

		cout<<a<<' '<<i<<Endl;

		if(s[i-1]=='1') a=i;

	}

}

// Faster C++ solution for the same problem (measured speedup: 5.31447620476119x):
#include <cstdio>

#include <cstring>



char arr[100010];

int prv[100010];



int main() {

	scanf("%s", arr + 1);

	int n = strlen(arr + 1);

	if (arr[1] == '0' || arr[n] == '1') {

		puts("-1");

		return 0;

	}

	for (int i = n - 1; i; --i)

		if (arr[i] != arr[n - i]) {

			puts("-1");

			return 0;

		

		}

	int pos = 1;

	for (int i = 2; i < n; ++i)

		if (arr[i] == '1') {

			prv[i] = pos;

			pos = i;

		}

	int ct = 1, pp = n, cur = 1;

	for (int i = pos; i; i = prv[i]) {

		int nx = ct;

		for (int j = i; j < pp; ++j) {

			printf("%d %d\n", cur, ++ct);

		}

		cur = nx + 1;

		pp = i;

	}

	return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>



using namespace std;



const int maxn = 1e5 + 5;

char s[maxn];

int n;



bool judge() {

	for (int i = 1; i < n; ++i)

		if (s[i] != s[n-i]) return true;

	return false;

}



int main() {

	cin >> (s+1);

	for (n = 1; s[n] != '\0'; ++n);

	--n;

	if (s[n] != '0' || s[1] != '1' || judge()) puts("-1");

	else {

		int root = 1;

		printf("1 2\n");

		for (int i = 2; i < n; ++i) {

			printf("%d %d\n", root, i+1);

			if (s[i] == '1') root = i+1;

		}

	}

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.3132239816580595x):
#include <cstdio>

#include <cstring>



char arr[100010];

int prv[100010];



int main() {

	scanf("%s", arr + 1);

	int n = strlen(arr + 1);

	if (arr[1] == '0' || arr[n] == '1') {

		puts("-1");

		return 0;

	}

	for (int i = n - 1; i; --i)

		if (arr[i] != arr[n - i]) {

			puts("-1");

			return 0;

		

		}

	int pos = 1;

	for (int i = 2; i < n; ++i)

		if (arr[i] == '1') {

			prv[i] = pos;

			pos = i;

		}

	int ct = 1, pp = n, cur = 1;

	for (int i = pos; i; i = prv[i]) {

		int nx = ct;

		for (int j = i; j < pp; ++j) {

			printf("%d %d\n", cur, ++ct);

		}

		cur = nx + 1;

		pp = i;

	}

	return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>



using namespace std;



string s;

int v = 1;



int main()

{

	cin >> s;

	if(s[s.size() - 1] == '1' || s[0] == '0')

		return cout << -1 , 0;

	for(int i = 0 ; i < s.size() - 1 ; i++)

		if(s[i] != s[s.size() - 2 - i])

			return cout << -1 , 0;

	for(int i = 0 ; i < s.size() - 1 ; i++)

	{

		cout << v << " " << i + 2 << endl;

		if(s[i] == '1')

			v = i + 2;

	}

	/*

	if(s[0] == '1' && s[1] == '1')

	{

		for(int i = 1 ; i < s.size() ; i++)

			cout << i << " " << i + 1 << endl;

	}

	else

	{

		for(int i = 2 ; i <= s.size() ; i++)

			cout << 1 << " " << i << endl;

	}*/

}

// Faster C++ solution for the same problem (measured speedup: 5.370620433117707x):
#include<cstdio>

#include<cstring>

using namespace std;

const int maxn = 1e5 + 7;

char s[maxn];

int main(){

    scanf("%s", s+1);

    int len = strlen(s+1);

    if(s[1] != '1' || s[len] != '0'){

        printf("-1\n");

        return 0;

    }

    for(int i = 1; i <= len/2; ++i){

        if(s[i] != s[len-i]){

            printf("-1\n");

            return 0;

        }

    }

    int record = -1;

    for(int i = len/2; i >= 1; --i){

        if(s[i] == '1'){

            record = i;

            printf("%d %d\n", i, i+1);

            for(int j = i+2; j <= len; ++j){

                printf("%d %d\n", i+1, j);

            }

            break;

        }

    }

    for(int i = record-1; i >= 1; --i){

        printf("%d %d\n", record, i);

        if(s[i] == '1'){

            record = i;

        }

    }

}
// Slower C++ solution:
//Copyright(c)2018 Mstdream

#include<bits/stdc++.h>

using namespace std;

const int N=100010;

char s[N];

void add(int x,int y){printf("%d %d\n",x,y);}

int main(){

	scanf("%s",s+1);

	int n=strlen(s+1);

	for(int i=1;i<=n;i++)s[i]-='0';

	bool flag=1;

	if(s[1]==0||s[n-1]==0||s[n]==1)flag=0;

	for(int i=1;i<=n;i++)if(s[i]^s[n-i])flag=0;

	if(!flag)puts("-1"),exit(0);

	int p=1,pre=0;

	for(int i=2;i<=n;i++){

		if(s[i]){

			if(pre)add(pre,i);

			for(int j=pre+1;j<i;j++)add(i,j);

			pre=i;

		}

	}

	for(int i=pre+1;i<=n;i++)add(pre,i);

}


// Faster C++ solution for the same problem (measured speedup: 5.266765798429801x):
#include<cstdio>

#include<cstring>

using namespace std;

const int maxn = 1e5 + 7;

char s[maxn];

int main(){

    scanf("%s", s+1);

    int len = strlen(s+1);

    if(s[1] != '1' || s[len] != '0'){

        printf("-1\n");

        return 0;

    }

    for(int i = 1; i <= len/2; ++i){

        if(s[i] != s[len-i]){

            printf("-1\n");

            return 0;

        }

    }

    int record = -1;

    for(int i = len/2; i >= 1; --i){

        if(s[i] == '1'){

            record = i;

            printf("%d %d\n", i, i+1);

            for(int j = i+2; j <= len; ++j){

                printf("%d %d\n", i+1, j);

            }

            break;

        }

    }

    for(int i = record-1; i >= 1; --i){

        printf("%d %d\n", record, i);

        if(s[i] == '1'){

            record = i;

        }

    }

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

const int maxn=2e5+5;

const int mod=1e9+7;

//const int mod=998244353;

#define rep(i,a,n) for(int i=a;i<n;i++)

#define per(i,a,n) for(int i=n-1;i>=a;i--)

#define pb push_back

#define fi first

#define se second

#define all(x) (x).begin(),(x).end()

#define SZ(x) ((int)(x).size())

typedef long long ll;

typedef vector<int> vi;

typedef pair<int,int> pii;

ll qpow(ll a,ll b){ll ans=1;a%=mod;assert(b>=0);for(;b;b>>=1){if(b&1)ans=ans*a%mod;a=a*a%mod;}return ans;}

ll gcd(ll a,ll b){return b>0?gcd(b,a%b):a;}



int a[maxn];

char s[maxn];

int main(){

    int n,m,T;

    cin>>s+1;

	scanf("%s",s+1);

	n=(int)strlen(s+1);

	if(s[n]=='1'||s[1]=='0'||s[n-1]=='0'){

		printf("-1\n");

		return 0;

	}

	int now = 2;

	while(now<=n-now){

		if(s[now]!=s[n-now]) {

			printf("-1\n");

			return 0;

		}

		now++;

	}

	int root=2,num=1;

	now=2;

	printf("2 1\n");

	while(now<=n-now){

		if(s[now]=='1'){

			printf("%d %d\n",++now,root);

			root=now;

		}else{

			printf("%d %d\n",++now,root);

		}

		num++;

	}

	for(int i=num+1;i<n;i++){

		printf("%d %d\n",root,++now);

	}



    return 0;

}




// Faster C++ solution for the same problem (measured speedup: 5.3188899466364905x):
#include<cstdio>

#include<cstring>

using namespace std;

const int maxn = 1e5 + 7;

char s[maxn];

int main(){

    scanf("%s", s+1);

    int len = strlen(s+1);

    if(s[1] != '1' || s[len] != '0'){

        printf("-1\n");

        return 0;

    }

    for(int i = 1; i <= len/2; ++i){

        if(s[i] != s[len-i]){

            printf("-1\n");

            return 0;

        }

    }

    int record = -1;

    for(int i = len/2; i >= 1; --i){

        if(s[i] == '1'){

            record = i;

            printf("%d %d\n", i, i+1);

            for(int j = i+2; j <= len; ++j){

                printf("%d %d\n", i+1, j);

            }

            break;

        }

    }

    for(int i = record-1; i >= 1; --i){

        printf("%d %d\n", record, i);

        if(s[i] == '1'){

            record = i;

        }

    }

}
// Slower C++ solution:
#include<bits/stdc++.h>

#define N 100005

using namespace std;

char s[N];

int n,a[N],cnt=1,last=1,fa=1;

int main()

{

    scanf("%s",s+1);

    n=strlen(s+1);

    for (int i=1;i<=n;i++) a[i]=s[i]-'0';

    for (int i=1;i<=n-1;i++) if (a[i]^a[n-i]==1) {printf("-1");return 0;}

    if (a[1]==0 || a[n]==1) {printf("-1");return 0;}

    for (int i=2;i<=n/2;i++)

    {

        if (a[i]==1)

        {

            printf("%d %d\n",fa,++cnt);

            int it=cnt;

            for (int j=last+2;j<=i;j++) printf("%d %d\n",it,++cnt);

            last=i,fa=it;

        }

    }

    int it=++cnt;

    printf("%d %d\n",it,fa);

    for (int i=cnt+1;i<=n;i++)

    {

        printf("%d %d\n",it,i);

    }

    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.267696174403477x):
#include<cstdio>

#include<cstring>

using namespace std;

const int maxn = 1e5 + 7;

char s[maxn];

int main(){

    scanf("%s", s+1);

    int len = strlen(s+1);

    if(s[1] != '1' || s[len] != '0'){

        printf("-1\n");

        return 0;

    }

    for(int i = 1; i <= len/2; ++i){

        if(s[i] != s[len-i]){

            printf("-1\n");

            return 0;

        }

    }

    int record = -1;

    for(int i = len/2; i >= 1; --i){

        if(s[i] == '1'){

            record = i;

            printf("%d %d\n", i, i+1);

            for(int j = i+2; j <= len; ++j){

                printf("%d %d\n", i+1, j);

            }

            break;

        }

    }

    for(int i = record-1; i >= 1; --i){

        printf("%d %d\n", record, i);

        if(s[i] == '1'){

            record = i;

        }

    }

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;

#define N 100010

int i,j,k,m,n,x,t,y,vis[N],a[N];

char s[N];

int main() {

    scanf("%s", s + 1);

    n = strlen(s + 1);

    for (i = 1; i <= n; ++i)vis[i] = (s[i] == '1');

    if (!vis[1] || !vis[n - 1] || vis[n])return puts("-1"), 0;

    for (i = 2; i < n - 1; ++i)if (vis[i] != vis[n - i])return puts("-1"), 0;

    for (x = 0, i = 1; i <= n; ++i) {

        if (vis[i])while (x > 0)printf("%d %d\n", a[x--], i);

        if (i != n)a[++x] = i;

    }

    while (x > 0)printf("%d %d\n", a[x--], n);

}


// Faster C++ solution for the same problem (measured speedup: 5.265911332240233x):
#include<cstdio>

#include<cstring>

using namespace std;

const int maxn = 1e5 + 7;

char s[maxn];

int main(){

    scanf("%s", s+1);

    int len = strlen(s+1);

    if(s[1] != '1' || s[len] != '0'){

        printf("-1\n");

        return 0;

    }

    for(int i = 1; i <= len/2; ++i){

        if(s[i] != s[len-i]){

            printf("-1\n");

            return 0;

        }

    }

    int record = -1;

    for(int i = len/2; i >= 1; --i){

        if(s[i] == '1'){

            record = i;

            printf("%d %d\n", i, i+1);

            for(int j = i+2; j <= len; ++j){

                printf("%d %d\n", i+1, j);

            }

            break;

        }

    }

    for(int i = record-1; i >= 1; --i){

        printf("%d %d\n", record, i);

        if(s[i] == '1'){

            record = i;

        }

    }

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;



vector<int> tree[101010];

void dfs(int u, int p){

    for(int i=0;i<tree[u].size();i++){

        int v = tree[u][i];

        if(v != p){

            cout<<u<<" "<<v<<endl;

            dfs(v, u);

        }

    }

}

int main(){

    string s;

    cin>>s;

    int n = s.length();

    s = " " + s;

    if(s[1] == '0' || s[n - 1] == '0' || s[n] == '1')return cout<<-1<<endl, 0;



    int root;

    for(int i=2;i<=n;i++){

        if(i < n && s[i] != s[n - i])return cout<<-1<<endl, 0;

        if(s[i] == '1'){

            root = i;

            for(int j=i-1;j>=1;j--){

                tree[i].push_back(j);

                tree[j].push_back(i);

                if(s[j] == '1')break;

            }

        }

    }

    for(int i=1;i<=n;i++){

        if(tree[i].size() == 0){

            tree[i].push_back(root);

            tree[root].push_back(i);

        }

    }

    dfs(n, -1);

}


// Faster C++ solution for the same problem (measured speedup: 3.5449803339082644x):
#include <bits/stdc++.h>

using namespace std;

string s;

int main(){

    cin >> s;

    int n = s.size();

    s = " " + s;

    if(s[1] == '0' || s[n] == '1')return cout << -1 << endl, 0;

    for(int i = 1; i < n; i++){

        if(s[i] != s[n - i])

            return cout << -1 << endl, 0;

    }



    int cur = 1;

    for(int i = 2; i <= n; i++){

        cout << cur << " " << i << endl;

        if(s[i - 1] == '1'){

            cur = i;

        }

    }

}