AtCoder Regular Contest 103 - Tr/ee

You are given a string s of length n.
Does a tree with n vertices that satisfies the following conditions exist?
 - The vertices are numbered 1,2,..., n.
 - The edges are numbered 1,2,..., n-1, and Edge i connects Vertex u_i and v_i.
 - If the i-th character in s is 1, we can have a connected component of size i by removing one edge from the tree.
 - If the i-th character in s is 0, we cannot have a connected component of size i by removing any one edge from the tree.
If such a tree exists, construct one such tree.

-----Constraints-----
 - 2 \leq n \leq 10^5
 - s is a string of length n consisting of 0 and 1.

-----Input-----
Input is given from Standard Input in the following format:
s

-----Output-----
If a tree with n vertices that satisfies the conditions does not exist, print -1.
If a tree with n vertices that satisfies the conditions exist, print n-1 lines.
The i-th line should contain u_i and v_i with a space in between.
If there are multiple trees that satisfy the conditions, any such tree will be accepted.

-----Sample Input-----
1111

-----Sample Output-----
-1

It is impossible to have a connected component of size n after removing one edge from a tree with n vertices.

Source: atcoder | Difficulty: HARD


Solutions:
S = input()
if S[0] == '0' or S[-1] == '1':
	print(-1)
	return
n = len(S)
for i in range(n // 2):
	if S[i] != S[n - 2 - i]:
		print(-1)
		return
for i in range(2, n // 2 + 1):
	print((1, i))
bef = 1
for i in range(n // 2 + 1, n + 1):
	print((bef, i))
	if S[i - 2] == '1':
		bef = i


import sys
input = sys.stdin.readline
S = '-' + input().rstrip()
N = len(S) - 1

def solve(S):
	if S[1] == '0':
		print(-1)
		return
	if S[N] == '1':
		print(-1)
		return
	prev = 1
	graph = []
	for n in range(1, N // 2 + 1):
		if S[n] != S[N - n]:
			return None
		if S[n] == '0':
			continue
		for i in range(prev, n):
			graph.append('{} {}'.format(i, n))
		prev = n
	for i in range(prev, N):
		graph.append('{} {}'.format(i, N))
	return graph
graph = solve(S)
if graph is None:
	print(-1)
else:
	print('\n'.join(graph))


import sys, collections as cl, bisect as bs
sys.setrecursionlimit(100000)
input = sys.stdin.readline
mod = 10 ** 9 + 7
Max = sys.maxsize

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

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

def onem():
	return int(input())

def s(x):
	a = []
	if len(x) == 0:
		return []
	aa = x[0]
	su = 1
	for i in range(len(x) - 1):
		if aa != x[i + 1]:
			a.append([aa, su])
			aa = x[i + 1]
			su = 1
		else:
			su += 1
	a.append([aa, su])
	return a

def jo(x):
	return ' '.join(map(str, x))

def max2(x):
	return max(map(max, x))

def In(x, a):
	k = bs.bisect_left(a, x)
	if k != len(a) and a[k] == x:
		return True
	else:
		return False

def pow_k(x, n):
	ans = 1
	while n:
		if n % 2:
			ans *= x
		x *= x
		n >>= 1
	return ans
s = input()[:-1]
if s[0] == '1' and s[-1] == '0':
	k = (len(s) - 2) // 2
	for i in range(k):
		if s[i] != s[-(2 + i)]:
			print(-1)
			return
	else:
		la = len(s)
		for i in range(la - 2, -1, -1):
			if s[i] == '1':
				print(i + 1, la)
				la = i + 1
			else:
				print(i + 1, la)
else:
	print(-1)


S = input()
N = len(S)
S = '0' + S
if S[1] != '1':
	print('-1')
	return
for (s, rev_s) in zip(S, reversed(S)):
	if s != rev_s:
		print('-1')
		return
prev = N
for i in reversed(list(range(1, N))):
	print((i, prev))
	if S[i] == '1':
		prev = i
	else:
		pass


s = input()
n = len(s)
s2 = s[:n - 1]
if s[0] != '1' or s[-1] != '0' or s2[::-1] != s2:
	print('-1')
	exit(0)
ans = '{0} {1}'
par = n
for i in range(n - 2, -1, -1):
	print(ans.format(par, i + 1))
	if s[i] == '1':
		par = i + 1


s = input()
if s[0] == '0' or s[-1] == '1':
	print(-1)
	return
n = len(s)
if n == 2:
	if s == '10':
		print((1, 2))
		return
	else:
		print(-1)
		return
m = n // 2
tmp = m + 1
ANS = []
for i in reversed(list(range(1, m + 1))):
	j = n - i
	if s[i - 1] == '1' and s[j - 1] == '1':
		ANS.append((tmp, i))
		tmp = i
	elif s[i - 1] == '0' and s[j - 1] == '0':
		ANS.append((tmp, i))
	else:
		print(-1)
		return
for i in range(m + 2, n + 1):
	ANS.append((m + 1, i))
for (a, b) in ANS:
	print((a, b))


import sys
S = input()
N = len(S)
ss = S[:N - 1]
if S[-1] == '1' or ss != ss[::-1] or S[0] == '0':
	print(-1)
	return
tree = []
cnt = 0
for s in ss:
	if s == '1':
		tree.append(cnt)
		cnt = 0
	else:
		cnt += 1
ans = []
now = 1
for c in tree:
	for i in range(c):
		ans.append((now, now + i + 1))
	ans.append((now, now + c + 1))
	now = now + c + 1
for (a, b) in ans:
	print((a, b))


s = input()
n = len(s)
if s[0] == '0':
	print(-1)
	return
if s[-1] == '1':
	print(-1)
	return
for i in range((n - 1) // 2):
	if s[i] != s[n - i - 2]:
		print(-1)
		return
p = 1
t = 2
i = n - 2
while i >= 0:
	print(p, t)
	if s[i] == '1':
		p = t
	t += 1
	i -= 1


S = [int(a) for a in list(input())]
L = len(S)
ok = True
if S[L - 1] == 1 or S[0] == 0 or S[L - 2] == 0:
	ok = False
for i in range(L - 1):
	if S[i] != S[L - 2 - i]:
		ok = False
if not ok:
	print(-1)
else:
	graph = []
	p = 1
	go = True
	for i in range(1, L):
		if i <= L // 2:
			graph.append((p, i + 1))
			if go:
				p = i + 1
			if S[i] == 1:
				go = True
			else:
				go = False
		else:
			graph.append((p, i + 1))
	for (a, b) in graph:
		print(a, b)


S = input()
T = S[:-1]
if S[0] == '0' or S[-1] == '1' or T != T[::-1]:
	print(-1)
	return
u = 1
for v in range(2, len(S) + 1):
	print(u, v)
	if S[v - 2] == '1':
		u = v


import sys
sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep='\n')

def II():
	return int(sys.stdin.readline())

def MI():
	return map(int, sys.stdin.readline().split())

def LI():
	return list(map(int, sys.stdin.readline().split()))

def LLI(rows_number):
	return [LI() for _ in range(rows_number)]

def SI():
	return sys.stdin.readline()[:-1]

def ng():
	if s[0] == '0' or s[-1] == '1':
		return True
	for i in range(n):
		if i > n - 2 - i:
			break
		if s[i] != s[n - 2 - i]:
			return True
	return False
s = SI()
n = len(s)
if ng():
	print(-1)
	return
aa = []
for i in range(n // 2):
	if s[i] == '1':
		aa.append(i + 1)
aa.append(n)
ans = []
for i in range(len(aa) - 1):
	ans.append([i + 1, i + 2])
j = len(aa) + 1
for (i, (a0, a1)) in enumerate(zip(aa, aa[1:])):
	for _ in range(a1 - a0 - 1):
		ans.append([i + 2, j])
		j += 1
for (u, v) in ans:
	print(u, v)


s = input()
n = len(s)
comp = {i + 1: True if st == '1' else False for (i, st) in enumerate(s)}
comp[0] = False
feasible = True
for i in range(n // 2 + 1):
	if i == 1 and (not (comp[i] and comp[n - i])):
		feasible = False
		break
	elif comp[i] ^ comp[n - i]:
		feasible = False
		break
if not feasible:
	print(-1)
else:
	edge = []
	parent = n
	for i in reversed(range(1, n)):
		edge.append((i, parent))
		if comp[i]:
			parent = i
	for (u, v) in edge:
		print(u, v)


s = input()
if s[0] == '0' or s[-1] == '1' or s[:-1] != s[:-1][::-1]:
	print(-1)
	exit(0)
edges = []
head = 0
for (idx, i) in enumerate(s[:-1]):
	edges.append([head, idx + 1])
	if i == '1':
		head = idx + 1
for (i, j) in edges:
	print(i + 1, j + 1)


import sys
sys.setrecursionlimit(10 ** 7)
import math
from copy import copy, deepcopy
from copy import deepcopy as dcp
from operator import itemgetter
from bisect import bisect_left, bisect, bisect_right
from collections import deque
from collections import Counter
from itertools import accumulate, combinations, permutations
from heapq import heapify, heappop, heappush
from functools import lru_cache
from decimal import Decimal

def input():
	x = sys.stdin.readline()
	return x[:-1] if x[-1] == '\n' else x

def printl(li):
	_ = print(*li, sep='\n') if li else None

def argsort(s, return_sorted=False):
	inds = sorted(range(len(s)), key=lambda k: s[k])
	if return_sorted:
		return (inds, [s[i] for i in inds])
	return inds

def alp2num(c, cap=False):
	return ord(c) - 97 if not cap else ord(c) - 65

def num2alp(i, cap=False):
	return chr(i + 97) if not cap else chr(i + 65)

def matmat(A, B):
	(K, N, M) = (len(B), len(A), len(B[0]))
	return [[sum([A[i][k] * B[k][j] for k in range(K)]) for j in range(M)] for i in range(N)]

def matvec(M, v):
	(N, size) = (len(v), len(M))
	return [sum([M[i][j] * v[j] for j in range(N)]) for i in range(size)]

def T(M):
	(n, m) = (len(M), len(M[0]))
	return [[M[j][i] for j in range(n)] for i in range(m)]

def main():
	mod = 1000000007
	s = input()
	N = len(s)
	f = 1
	if s[-1] == '1' or s[0] == '0':
		f = 0
	for i in range(1, N // 2 + 1):
		if s[i - 1] != s[N - i - 1]:
			f = 0
			break
	if not f:
		print(-1)
		return
	il = []
	edge = []
	for i in range(1, N // 2 + 1):
		if s[i - 1] == '0':
			il.append(i)
		else:
			for j in il:
				edge.append((i, j))
			il = [i]
	i = N // 2 + 1
	for j in il:
		edge.append((i, j))
	j = i
	for i in range(N // 2 + 2, N + 1):
		edge.append((j, i))
	for e in edge:
		print(*e)

def __starting_point():
	main()
__starting_point()


import sys

def LI2():
	return list(map(int, sys.stdin.readline().rstrip()))
S = LI2()
n = len(S)
if S[-1] == 1 or S[0] == 0 or S[-2] == 0:
	print(-1)
	exit()
for i in range(n - 1):
	if S[i] != S[-2 - i]:
		print(-1)
		exit()
k = S.count(1)
for i in range(k):
	print(i + 1, i + 2)
a = 1
b = k + 2
for i in range(n - 1):
	if S[i] == 1:
		a += 1
	else:
		print(a, b)
		b += 1


def main():
	S = list(input())
	N = len(S)
	if S[0] == '0' or S[-1] == '1':
		print(-1)
		return 0
	lst = []
	for i in range((N - 1) // 2):
		if S[i] != S[N - 2 - i]:
			print(-1)
			return 0
		if S[i] == '1':
			lst.append(i + 1)
	if N % 2 == 0 and S[N // 2 - 1] == '1':
		lst.append(N // 2)
	if lst[-1] * 2 != N:
		center = lst[-1] + 1
		for x in range(lst[-1] * 2 + 2, N + 1):
			print(center, x)
		before = 1
		n = lst[-1] * 2 + 2
		tmp = 1
		for tmp in lst[1:]:
			print(before, tmp)
			print(n - before, n - tmp)
			for x in range(tmp - before - 1):
				print(before + 1 + x, tmp)
				print(n - (before + 1 + x), n - tmp)
			before = tmp
		print(tmp, center)
		print(n - tmp, center)
	if lst[-1] * 2 == N:
		before = 1
		n = lst[-1] * 2 + 1
		tmp = 1
		for tmp in lst[1:]:
			print(before, tmp)
			print(n - before, n - tmp)
			for x in range(tmp - before - 1):
				print(before + 1 + x, tmp)
				print(n - (before + 1 + x), n - tmp)
			before = tmp
		print(tmp, n - tmp)
main()


from collections import defaultdict

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

def main():
	s = list(input())
	N = len(s)
	judge = 'Yes'
	if s[0] == '0':
		judge = 'No'
	if s[N - 1] == '1':
		judge = 'No'
	for i in range(N - 2):
		if s[i] != s[N - 2 - i]:
			judge = 'No'
	if judge == 'No':
		print(-1)
		return
	c = 1
	d = N
	for i in range(N - 1):
		if s[i] == '1':
			print(c, c + 1)
			c += 1
		else:
			print(c, d)
			d -= 1

def __starting_point():
	main()
__starting_point()


def main():
	s = input()
	n = len(s)
	if s[n - 1] == '1' or s[0] == '0' or s[n - 2] == '0':
		print(-1)
		return
	for i in range(n - 1):
		if s[i] != s[n - i - 2]:
			print(-1)
			return
	conn = [[]] * (n + 1)
	children = []
	for i in range(1, n):
		if s[i - 1] == '0':
			children.append(i)
		else:
			conn[i] = children
			children = [i]
	conn[n] = [n - 1]
	for i in range(1, n + 1):
		for j in conn[i]:
			print(j, i)

def __starting_point():
	main()
__starting_point()


import sys
readline = sys.stdin.readline
read = sys.stdin.read
s = input()
n = len(s)
ok = 1
if s[-1] == '1':
	ok = 0
if any((s[i] != s[n - 2 - i] for i in range(n - 1))):
	ok = 0
if s[0] == '0':
	ok = 0
if ok == 0:
	print('-1')
	return
e = [(0, 1)]
top = 1
for i in range(1, n - 1):
	e.append((top, i + 1))
	if s[i] == '1':
		top = i + 1
for (a, b) in e:
	print(a + 1, b + 1)


import sys
sr = lambda : sys.stdin.readline().rstrip()
ir = lambda : int(sr())
lr = lambda : list(map(int, sr().split()))
S = '-' + sr()
N = len(S) - 1

def solve(S):
	if S[1] == '0' or S[N] == '1':
		return None
	prev = 1
	graph = []
	for i in range(1, N // 2 + 1):
		if S[i] != S[N - i]:
			return None
		if S[i] == '0':
			continue
		for x in range(prev, i):
			graph.append('{} {}'.format(x, i))
		prev = i
	for x in range(prev, N):
		graph.append('{} {}'.format(x, N))
	return graph
graph = solve(S)
if graph is None:
	print(-1)
else:
	print('\n'.join(graph))


s = input()
n = len(s)
if s[0] == '0' or s[-1] == '1':
	print(-1)
	return
for i in range(n - 1):
	if s[i] != s[-i - 2]:
		print(-1)
		return
b = []
for i in range(n - 1):
	if s[i] == '1':
		for j in b:
			print(j + 1, i + 1)
		b = []
	b.append(i)
for j in b:
	print(j + 1, n)


s = input()
if s[-1] == '1':
	print(-1)
	exit()
if s[0] == '0':
	print(-1)
	exit()
for i in range(len(s) // 2):
	if s[i] != s[-i - 2]:
		print(-1)
		exit()
print(1, 2)
top = 2
for i in range(1, len(s) - 1):
	print(top, i + 2)
	if s[i] == '1':
		top = i + 2


s = input()
n = len(s)
if s[n - 1] == '1':
	print(-1)
	exit(0)
if s[0] == '0' or s[n - 2] == '0':
	print(-1)
	exit(0)
for i in range(n - 1):
	if s[i] != s[n - 2 - i]:
		print(-1)
		exit(0)
ss = []
for i in range(n - 1, -1, -1):
	if s[i] == '1':
		ss.append(i + 1)
now_no = 1
now_siz = n
for siz in ss:
	others = now_siz - siz - 1
	for i in range(1, others + 1):
		print(now_no, now_no + i)
	print(now_no, now_no + others + 1)
	now_no += others + 1
	now_siz = siz


s = '0'
s += input()

def isPara(string, l, r):
	while l <= r:
		if s[l] != s[r]:
			return False
		l += 1
		r -= 1
	return True

def solve():
	N = len(s) - 1
	if s[N] == '1' or s[1] == '0':
		print(-1)
		return
	if isPara(s, 1, N - 1) == False:
		print(-1)
		return
	sz = 1
	while sz < N:
		if s[sz] == '1':
			sz += 1
		else:
			break
	sz -= 1
	now = 1
	for i in range(2, N + 1):
		print(str(now) + ' ' + str(i))
		if s[i - 1] == '1':
			now = i
solve()


def Tree():
	S = input()
	N = len(S)
	if S[0] == '0' or S[-1] == '1':
		return []
	for i in range(N - 1):
		if S[i] != S[N - i - 2]:
			return []
	res = []
	path = S.count('1')
	for i in range(1, path + 1):
		res.append((i, i + 1))
	u = len(res) + 1
	v = 1
	for s in S[:-1]:
		if s == '1':
			v += 1
		else:
			u += 1
			res.append((v, u))
	return res

def __starting_point():
	tree = Tree()
	if tree:
		for (x, y) in tree:
			print(x, y)
	else:
		print(-1)
__starting_point()


from sys import stdin
import sys
import math
from functools import reduce
import functools
import itertools
from collections import deque, Counter, defaultdict
from operator import mul
import copy
import heapq
sys.setrecursionlimit(10 ** 6)
INF = float('inf')
import bisect
s = input()
n = len(s)
if s[n - 1] == '1' or s[0] == '0':
	print(-1)
	sys.exit()
for i in range((n - 1) // 2):
	if s[i] != s[n - 2 - i]:
		print(-1)
		sys.exit()
j = 0
for i in range(1, n):
	if s[i] == '1':
		for k in range(j, i):
			print(k + 1, i + 1)
		j = i
for k in range(j + 1, n):
	print(j + 1, k + 1)


s = input()
if s[0] == '0' or s[-1] == '1' or s[:-1] != s[:-1][::-1]:
	print(-1)
	exit(0)
e = []
bi = 0
for (i, j) in enumerate(s[:-1]):
	e.append([bi, i + 1])
	if j == '1':
		bi = i + 1
for (i, j) in e:
	print(i + 1, j + 1)


s = input()
n = len(s)
flag = False
for i in range(n // 2):
	if s[i] != s[-i - 2]:
		flag = True
		break
if flag or s[0] == '0' or s[-1] == '1':
	print(-1)
elif n == 2:
	print('2 1')
elif n == 3:
	print('2 1')
	print('3 2')
else:
	print('2 1')
	head = 2
	for i in range(3, n // 2 + 2):
		print(str(i) + ' ' + str(head))
		if s[i - 2] == '1':
			head = i
	i += 1
	while i <= n:
		print(str(i) + ' ' + str(head))
		i += 1


a = input()
b = a[:-1]
if a[0] == '0' or a[-1] == '1' or b != b[::-1]:
	print(-1)
	exit()
p = 1
for i in range(2, len(a) + 1):
	print(p, i)
	if a[i - 2] == '1':
		p = i


import sys
readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)

def main():
	S = '*' + input()
	N = len(S) - 1
	if S[N] == '1':
		return print(-1)
	if S[1] == '0':
		return print(-1)
	edge = []
	cur_u = 1
	cur_v = 2
	for i in range(1, N // 2 + 1):
		if S[i] != S[N - i]:
			return print(-1)
		edge.append([cur_u, cur_v])
		if S[i] == '1':
			cur_u = cur_v
		cur_v += 1
	for i in range(cur_v, N + 1):
		edge.append([cur_u, i])
	for i in range(N - 1):
		print(*edge[i])

def __starting_point():
	main()
__starting_point()


def f(s):
	n = len(s)
	if s[-1] == '1' or s[-2] == '0' or s[0] == '0':
		print(-1)
		return
	(i, j) = (0, n - 2)
	while i < j:
		if s[i] != s[j]:
			print(-1)
			return
		i += 1
		j -= 1
	e = []
	k = 0
	for (i, c) in enumerate(s):
		if c == '1':
			if i == 0:
				k = 0
				continue
			for j in range(k + 1):
				e.append((i - k + j, i + 1))
			k = 0
		else:
			k += 1
	e.append((n - k, n))
	for (u, v) in e:
		print(u, v)
f(input())


import sys
input = sys.stdin.readline
s = list(map(int, list(input())[:-1]))
if s[0] == 0 or s[-1] == 1:
	print(-1)
	return
n = len(s)
for i in range(n - 1):
	if s[i] != s[-2 - i]:
		print(-1)
		return
res = []
temp = []
s[-1] = 1
for i in range(n):
	if s[i] == 0 or i == 0:
		temp.append(i + 1)
	else:
		if len(res):
			p = res[-1][0]
			res.append((i + 1, p))
		if len(temp):
			while len(temp):
				res.append((i + 1, temp.pop()))
for _ in range(len(res)):
	print(*res.pop())


S = input()
N = len(S)
if S[0] == '0' or S[-1] == '1' or any((S[i] != S[N - i - 2] for i in range((N - 1) // 2))):
	print(-1)
	return
head = 0
edges = []
for i in range(N - 1):
	edges.append((head, i + 1))
	if S[i] == '1':
		head = i + 1
[print(f + 1, t + 1) for (f, t) in edges]


s = input()
n = len(s)
if s[0] == '1' and s[-1] == '0' and (s[:n // 2] == s[(n - 1) // 2:-1][::-1]):
	q = []
	now = 0
	for i in range(n):
		m = s[i]
		if m == '1':
			now = str(i + 1)
			while q:
				print(q.pop() + ' ' + now)
		q.append(str(i + 1))
	while q:
		a = q.pop()
		if now != a:
			print(a + ' ' + now)
else:
	print(-1)


printn = lambda x: print(x, end='')
inn = lambda : int(input())
inl = lambda : list(map(int, input().split()))
inm = lambda : map(int, input().split())
ins = lambda : input().strip()
DBG = True
BIG = 10 ** 18
R = 10 ** 9 + 7

def ddprint(x):
	if DBG:
		print(x)
s = ins()
n = len(s)
s = '0' + s
if s[1] == '0' or s[n] == '1':
	print(-1)
	return
for i in range(1, n):
	if s[i] != s[n - i]:
		print(-1)
		return
e = []
p = 1
for i in range(2, n + 1):
	if s[i] == '1' or i == n:
		for j in range(p, i):
			e.append((j, i))
		p = i
for z in e:
	print('{} {}'.format(z[0], z[1]))


s = [int(i) for i in input()]
if s[0] == 0 or s[-1] == 1:
	print(-1)
else:
	s.pop()
	if s != s[::-1]:
		print(-1)
	else:
		org = 1
		for i in range((len(s) + 1) // 2):
			if s[i] == 1:
				for j in range(org + 1, i + 3):
					print(org, j)
				org = i + 2
		for i in range(org + 1, len(s) + 2):
			print(org, i)


n = input()
n = '0' + n
l = len(n)
flag = 0
if n != n[::-1]:
	flag = 1
if n[1] == '0':
	flag = 1
if flag == 0:
	print(1, 2)
	c = 1
	for i in range(1, l - 2):
		if n[i] == '1':
			print(i + 1, i + 2)
			c = i + 1
		else:
			print(c, i + 2)
else:
	print(-1)


s = input()
S = '0' + s
N = len(s)

def f():
	res = []
	r = 1
	C = []
	for i in range(2, N + 1):
		if S[i] == '0':
			C.append(i)
		else:
			res.append((r, i))
			r = i
			for c in C:
				res.append((r, c))
			C = []
	for c in C:
		res.append((r, c))
	return res
ans = '-1' if S[1] == '0' or S[N] == '1' or any((S[i] != S[N - i] for i in range(1, N))) else '\n'.join(('{} {}'.format(u, v) for (u, v) in f()))
print(ans)


import sys
sys.setrecursionlimit(10000000)
MOD = 10 ** 9 + 7
INF = 10 ** 15

def main():
	S = input()
	N = len(S)
	if S[0] == '0' or S[-1] == '1':
		print(-1)
		return
	cnt = 0
	flag = True
	for i in range(N - 1):
		if S[i] != S[N - i - 2]:
			flag = False
			break
		if S[i] == '1':
			cnt += 1
	if not flag:
		print(-1)
		return
	edge = []
	for i in range(cnt):
		edge.append((i + 1, i + 2))
	extend = 0
	now = cnt + 2
	vertex = 2
	for i in range(1, N - 1):
		if S[i] == '0':
			extend += 1
		else:
			for _ in range(extend):
				edge.append((vertex, now))
				now += 1
			extend = 0
			vertex += 1
	if now == N + 1:
		print('\n'.join((' '.join(map(str, a)) for a in edge)))
	else:
		print(-1)

def __starting_point():
	main()
__starting_point()


def solve():
	s = input()
	n = len(s)
	if s[0] != '1' or s[-1] != '0':
		print(-1)
		return
	for i in range(n // 2):
		if s[i] != s[-(i + 2)]:
			print(-1)
			return
	v = [i + 1 if c == '1' else 0 for (i, c) in enumerate(s)]
	v[-1] = n
	last = n
	for (i, x) in reversed(list(enumerate(v))):
		if x != 0:
			v[i] = last
			last = x
		else:
			v[i] = last
	for (i, x) in enumerate(v[:-1]):
		print(i + 1, x)
solve()


from sys import exit, setrecursionlimit, stderr
from functools import reduce
from itertools import *
from collections import defaultdict
from bisect import bisect

def read():
	return int(input())

def reads():
	return [int(x) for x in input().split()]
s = input()
n = len(s)

def valid(s):
	s = 'x' + s
	return s[1] == '1' and s[n] == '0' and all((s[i] == s[n - i] for i in range(1, n)))
if not valid(s):
	print(-1)
	exit()
top = 1
for i in range(n - 1):
	v = i + 2
	print(top, v)
	if s[i] == '1':
		top = v


s = input()
cnt = 0
if s[-1] == '1' or s[0] == '0':
	print(-1)
	exit()
li = []
for i in range(1, len(s) // 2):
	if s[i] != s[-i - 2]:
		print(-1)
		exit()
	if s[i] == '1':
		li.append(i + 1)
tree = []
j = 1
for _ in range(len(li)):
	tree.append((j, j + 1))
	j += 1
li.append(len(s))
cnt = 0
for i in range(len(li)):
	cnt += 1
	while cnt < li[i]:
		tree.append((i + 1, j + 1))
		j += 1
		cnt += 1
for edge in tree:
	print(*edge)


s = '0'
s += input()

def isPara(string, l, r):
	while l <= r:
		if s[l] != s[r]:
			return False
		l += 1
		r -= 1
	return True

def solve():
	N = len(s) - 1
	if s[N] == '1' or s[1] == '0':
		print(-1)
		return
	if isPara(s, 1, N - 1) == False:
		print(-1)
		return
	root = 1
	for i in range(2, N + 1):
		print(str(root) + ' ' + str(i))
		if s[i - 1] == '1':
			root = i
solve()


from collections import deque
s = list(input())
n = len(s)
if s[0] == '0' or s[n - 1] == '1' or any((s[i - 1] != s[n - 1 - i] for i in range(1, n - 1))):
	print(-1)
	exit()
s[n - 1] = '1'
one = deque([])
for i in range(n):
	if s[i] == '1':
		one.append(i)
for i in range(n - 1):
	if s[i] == '0':
		print(i + 1, one[0] + 1)
	else:
		a = one.popleft()
		print(a + 1, one[0] + 1)


s = input()
if s[-1] == '1':
	print(-1)
	return
if s[-2] == '0':
	print(-1)
	return
t = s[:-1]
D = []
for i in range((len(t) + 1) // 2):
	if t[i] != t[-1 - i]:
		print(-1)
		return
m = 1
A = []
for i in range(1, len(s) // 2 + 1):
	A.append((m, i + 1))
	if s[i - 1] == '1':
		m = i + 1
for i in range(len(s) // 2 + 2, len(s) + 1):
	A.append((m, i))
for i in A:
	print(*i)


S = input()
N = len(S)
if S[-1] == '1':
	print(-1)
	return
if S[0] == '0':
	print(-1)
	return
if S[-2] == '0':
	print(-1)
	return
for i in range(N - 1):
	if S[i] != S[N - 2 - i]:
		print(-1)
		return
ans = []
nowzero = 0
for i in range(N):
	if S[i] == '0':
		break
	nowzero += 1
if nowzero == N - 1:
	for i in range(1, N):
		print(i, i + 1)
	return
ans.append((1, 2))
for i in range(N - 2):
	if S[i] == '1':
		if i != N - 2 and S[i + 1] == '0':
			nowzero = i + 2
		ans.append((i + 2, i + 3))
	else:
		ans.append((nowzero, i + 3))
for line in ans:
	print(line[0], line[1])


s = input()
n = len(s)
if s[0] == '0' or s[-1] == '1':
	print(-1)
	exit()
for i in range(n - 1):
	if s[i] != s[-2 - i]:
		print(-1)
		exit()
path = {1: [v for v in range(2, n + 1)]}
ans = []
(u_cur, v_cur) = (1, 2)
n_prev = 0
for i in range(1, n // 2):
	if s[i] == '1':
		for _ in range(i - n_prev):
			ans.append((u_cur, v_cur))
			v_cur += 1
		ans.append((v_cur, u_cur))
		(u_cur, v_cur) = (v_cur, v_cur + 1)
		n_prev = i + 1
for v in range(v_cur, n + 1):
	ans.append((v_cur - 1, v))
for a in ans:
	print(*a)


s = input().strip()
n = len(s)
s = '0' + s
flag = 0
if s[n] == '1' or s[1] == '0':
	flag = 1
else:
	for i in range(1, n):
		if s[i] != s[n - i]:
			flag = 1
			break
if flag == 1:
	print(-1)
else:
	A = [1]
	for i in range(2, n):
		if s[i] == '1':
			while A:
				print((A.pop(), i))
			A = [i]
		else:
			A.append(i)
	print((n - 1, n))


import sys

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

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

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

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

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

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

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

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

def Yes():
	print('Yes')

def No():
	print('No')

def YES():
	print('YES')

def NO():
	print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 10 ** 9 + 7
S = input()
N = len(S)
S = '0' + S
if S[1] == '0' or S[N] == '1' or S != S[::-1]:
	print(-1)
	exit()
edges = []
base = 1
for i in range(1, N):
	edges.append((base, i + 1))
	if S[i] == '1':
		base = i + 1
[print(*edge) for edge in edges]


def solve(s):
	if s[-1] == '1':
		return False
	if s[0] == '0':
		return False
	half = s[:len(s) // 2]
	if half != s[-2:(len(s) - 3) // 2:-1]:
		return False
	head = 1
	master = 1
	buf = []
	for (i, c) in enumerate(half):
		if c == '0':
			buf.append('{} {}'.format(master, i + 2))
		else:
			buf.append('{} {}'.format(head, i + 2))
			head = master = i + 2
	for i in range(len(half), len(s) - 1):
		buf.append('{} {}'.format(master, i + 2))
	return buf
res = solve(input())
if res == False:
	print(-1)
else:
	print('\n'.join(res))


def solve():
	S = [0] + [int(c) for c in input()]
	N = len(S) - 1
	if S[1] == 0:
		return -1
	for n in range(N // 2 + 1):
		if S[n] != S[N - n]:
			return -1
		if S[n] == 1:
			k = n
	E = []
	Q = []
	for n in range(1, k + 1):
		if S[n] == 1:
			for q in Q:
				E.append((q, n))
			Q = []
		Q.append(n)
	E.append((k, k + 1))
	for n in range(k + 2, N + 1):
		E.append((k + 1, n))
	return '\n'.join([' '.join(map(str, e)) for e in E])
print(solve())


s = input()
if s[0] == '0' or s[-1] == '1':
	print(-1)
	exit()
for i in range(len(s) // 2 + len(s) % 2):
	if s[i] != s[-i - 2]:
		print(-1)
		exit()
par = len(s)
for i in range(len(s) - 2, -1, -1):
	if s[i] == '1':
		print(i + 1, par)
		par = i + 1
	else:
		print(i + 1, par)


import sys
sr = lambda : sys.stdin.readline().rstrip()
ir = lambda : int(sr())
lr = lambda : list(map(int, sr().split()))
S = list(sr())
N = len(S)
if S[-1] == '1' or S[0] == '0' or S[:-1] != S[:-1][::-1]:
	print(-1)
	exit()
S = ['-'] + S

def solve(S):
	prev = 1
	graph = []
	for i in range(1, N // 2 + 1):
		if S[i] == '0':
			continue
		for x in range(prev, i):
			print(x, i)
		prev = i
	for x in range(prev, N):
		print(x, N)
graph = solve(S)


s = input()
n = len(s)
if s[-1] == '1':
	print(-1)
	exit()
t = s[:-1]
if t[::-1] != t:
	print(-1)
	exit()
if s[0] == '0':
	print(-1)
	exit()
print(0 + 1, 1 + 1)
now = 0
for i in range(2, n):
	print(now + 1, i + 1)
	if s[i - 1] == '1':
		now = i


s = list(map(int, input()))
n = len(s)
if s[0] == 0 or s[-1] == 1 or any((s[i] != s[i] for i in range(n // 2))):
	print(-1)
	exit()
G = [[] for i in range(n)]
cur = 0
for i in range(n - 1):
	G[cur].append(i + 1)
	G[i + 1].append(cur)
	if s[i]:
		cur = i + 1
root = n // 2
from collections import deque
size = [1] * n
ans = [0] * n
edges = []

def bfs1(root):
	rev = [(root, -1)]
	for i in range(n):
		(cur, par) = rev[i]
		for to in G[cur]:
			if to != par:
				rev.append((to, cur))
	for i in reversed(range(1, n)):
		(cur, par) = rev[i]
		size[par] += size[cur]
		ans[size[cur]] = 1
		ans[n - size[cur]] = 1
		edges.append([cur + 1, par + 1])
bfs1(0)
if any((ans[i + 1] != s[i] for i in range(n - 1))):
	print(-1)
	exit()
for i in edges:
	print(*i)


s = list(input())
n = len(s)
if s[-1] == '1':
	print(-1)
	exit()
if s[:-1] != s[:-1][::-1]:
	print(-1)
	exit()
if s[0] == '0':
	print(-1)
	exit()
before = -1
for i in range(n // 2):
	if s[i] == '1':
		num = i - before
		for j in range(num):
			print(before + 2, i + 2 - j)
		before = i
for j in range(n - 2 - before):
	print(before + 2, before + 3 + j)


s = list(map(int, list(input())))

def main(s):
	n = len(s)
	if s[0] != 1 or s[-1] != 0:
		return [[-1]]
	for k in range(n // 2 - 1):
		if s[k] != s[n - k - 2]:
			return [[-1]]
	uv = [(1, 2)]
	t = 2
	i = 3
	for x in s[1:-1]:
		uv.append((t, i))
		if x == 1:
			t = i
		i += 1
	return uv
for x in main(s):
	print(*x, sep=' ')


import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 6)
s = input().rstrip()
N = len(s)
if s[0] == '0' or s[-1] == '1' or s[:-1] != s[:-1][::-1]:
	print(-1)
	exit()
subtree = [[] for _ in range(N + 1)]
prev = 1
for i in range(2, N + 1):
	if s[i - 1] == '1' or i == N:
		subtree[i] = [prev] + [1] * (i - prev - 1)
		prev = i
i = 1

def dfs(size):
	global i
	v = i
	for c in subtree[size]:
		i += 1
		print(v, i)
		dfs(c)
dfs(N)


import sys
input = sys.stdin.readline
sys.setrecursionlimit(pow(10, 6))
from collections import deque

def main():
	s = input().strip()
	if s[-1] == '1' or s[0] == '0':
		print(-1)
	else:
		edges = deque([])
		for i in range(len(s) - 1):
			if s[i] != s[len(s) - i - 2]:
				print(-1)
				return
			elif s[i] == '1':
				edges.append(i)
		edges.append(len(s) - 1)
		for i in range(len(s) - 1):
			if edges[0] == i:
				edges.popleft()
			print(i + 1, edges[0] + 1)
main()


s = list(input())
if s[0] != '1' or s[-1] != '0':
	print(-1)
	return
l = 0
r = len(s) - 2
while l <= r:
	if s[l] != s[r]:
		print(-1)
		return
	l += 1
	r -= 1
oya = 1
ans = [[1, 2]]
for i in range(1, len(s) - 1):
	node = i + 2
	if s[i] == '0':
		s[len(s) - i - 1] = '?'
		ans.append([oya, node])
	elif s[i] == '1':
		ans.append([oya, node])
		oya = node
		s[len(s) - i - 1] = '?'
	else:
		ans.append([oya, node])
for i in ans:
	print(*i, sep=' ')


S = input()
n = len(S)
m = n // 2
if S[0] == '0' or S[-1] == '1':
	print(-1)
	quit()
ans = [[1, 2]]
node = 1
now = 3
for i in range(m):
	if S[i] != S[n - i - 2]:
		print(-1)
		quit()
	else:
		if i == 0:
			continue
		ans.append([node, now])
		if S[i] == '0':
			now += 1
		else:
			node = now
			now += 1
for i in range(now, n + 1):
	ans.append([node, i])
for a in ans:
	print(*a)


S = input()
N = len(S)
if S[0] == '0' or S[-1] == '1' or S[:-1] != S[-2::-1]:
	print(-1)
	return
cur_node = 1
for i in range(N - 1):
	print((cur_node, i + 2))
	if S[i] == '1':
		cur_node = i + 2


s = input()
n = len(s)
if s[-1] == '1' or s[0] == '0':
	print(-1)
	exit()
for i in range(n - 1):
	if s[i] != s[-i - 2]:
		print(-1)
		exit()
edges = []
par = n
for i in range(n - 1, 0, -1):
	print(i, par)
	if s[i - 1] == '1':
		par = i


S = input()
N = len(S)
S = '0' + S
if S[:2] == '01' and S == S[::-1]:
	before = 1
	for i in range(2, N + 1):
		print((before, i))
		if S[i - 1] == '1' and i < (N + 1) // 2 + 2:
			before = i
else:
	print(-1)


S = input()
if S[-1] == '1' or S[0] == '0':
	print(-1)
else:
	flag = True
	for i in range((len(S) - 1) // 2):
		if S[-i - 2] != S[i]:
			flag = False
			print(-1)
			break
	if flag:
		ans = []
		now = 1
		nxt = 2
		for i in range(len(S) // 2):
			ans.append((now, nxt))
			if S[i] == '1':
				now = nxt
				nxt += 1
			else:
				nxt += 1
		ans.append((now, nxt))
		for i in range(nxt + 1, len(S) + 1):
			ans.append((now, i))
		for a in ans:
			print(*a)


s = input()
if not (s[0] == '1' and s[-1] == '0' and (s[-2::-1] == s[:-1])):
	print(-1)
	return ()
c = 1
for i in range(len(s) - 1):
	print(c, i + 2)
	if s[i] == '1':
		c = i + 2


import os
import sys
if os.getenv('LOCAL'):
	sys.stdin = open('_in.txt', 'r')
sys.setrecursionlimit(2147483647)
INF = float('inf')
IINF = 10 ** 18
MOD = 10 ** 9 + 7
S = sys.stdin.readline().rstrip()

def solve(S: str):
	if S[-1] == '1':
		return None
	S = S[:-1]
	if S[::-1] != S:
		return None
	if S[0] == '0':
		return None
	ret = [(1, 2)]
	v = 2
	for i in range(1, (len(S) + 1) // 2):
		ret.append((v, i + 2))
		if S[i] == '1':
			v = i + 2
	for i in range((len(S) + 1) // 2, len(S)):
		ret.append((v, i + 2))
	return ret
ans = solve(S)
if ans:
	for r in ans:
		print(*r)
else:
	print(-1)


import math
import sys
DEBUG = False

def inp():
	return sys.stdin.readline().rstrip()

def dprint(*value, sep=' ', end='\n'):
	if DEBUG:
		print(*value, sep=sep, end=end)

def solve(S):
	N = len(S)
	if S[0] == '0' or S[-1] == '1':
		return None
	for i in range((N - 1) // 2):
		if S[i] != S[-2 - i]:
			return None
	mxsz = 1
	for i in range((N - 2) // 2):
		if S[i + 1] == '1':
			mxsz = i + 2
	G = []
	root = mxsz + 1
	croot = root
	for i in range(root - 1, 0, -1):
		G.append((croot, i))
		if S[i - 1] == '1':
			croot = i
	for i in range(mxsz + 2, N + 1):
		G.append((root, i))
	return G

def main():
	ans = solve(inp())
	if ans is None:
		print('-1')
		return
	for (p, q) in ans:
		print(p, q)
main()


A = list(input())
N = len(A)
if A[-1] == '1':
	print(-1)
elif A[0] != '1' or A[-2] != '1':
	print(-1)
else:
	for i in range(N - 1):
		if A[i] != A[N - 2 - i]:
			print(-1)
			exit()
	X = 1
	Y = 0
	for i in range(N - 1):
		if A[i] == '1':
			print(Y + 1, X + 1)
			Y = X
			X += 1
		else:
			print(X + 1, Y + 1)
			X += 1


s = input()
n = len(s)
ok = s[0] == '1' and s[n - 1] == '0'
for i in range(n - 1):
	ok = ok and s[i] == s[n - 2 - i]
if not ok:
	print(-1)
	return
s2 = s[:n // 2]
i = s2.rindex('1')
for k in range(i, n - 1):
	print((n, k + 1))
while i > 0:
	j = i - 1
	while s[j] != '1':
		j -= 1
	for k in range(j, i):
		print((i + 1, k + 1))
	i = j


import sys
import math
from collections import defaultdict
from bisect import bisect_left, bisect_right
sys.setrecursionlimit(10 ** 7)

def input():
	return sys.stdin.readline()[:-1]
mod = 10 ** 9 + 7

def I():
	return int(input())

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

def LIR(row, col):
	if row <= 0:
		return [[] for _ in range(col)]
	elif col == 1:
		return [I() for _ in range(row)]
	else:
		read_all = [LI() for _ in range(row)]
		return map(list, zip(*read_all))
s = list(input())
n = len(s)
for i in range((n - 1) // 2 + 1):
	if s[i] != s[n - 2 - i]:
		print(-1)
		return
if s[0] == '0':
	print(-1)
	return
if s[n - 1] == '1':
	print(-1)
	return
from_ = 1
to_ = 2
ans = []
for i in range(n - 1):
	ans.append((from_, to_))
	if s[i] == '1':
		from_ = to_
		to_ += 1
	else:
		to_ += 1
for a in ans:
	print(*a)


import sys
s = input()
n = len(s)
if s[-1] == '1':
	print(-1)
	return
if s[0] == '0':
	print(-1)
	return
for i in range(n - 1):
	if s[i] != s[n - 2 - i]:
		print(-1)
		return
ans = ['1', '2']
print(' '.join(ans))
current = 2
for i in range(1, n - 1):
	ans = []
	ans.append(str(current))
	ans.append(str(i + 2))
	print(' '.join(ans))
	if s[i] == '1':
		current = i + 2


s = input()
n = len(s)
f = 1
if s[-1] == '1':
	f = 0
if s[0] == '0':
	f = 0
for i in range(n - 1):
	if s[i] != s[-2 - i]:
		f = 0
		break
s = s[:-1] + '1'
if f:
	k = 0
	for i in range(n):
		if s[i] == '1':
			for j in range(k, i):
				print(j + 1, i + 1)
			k = i
else:
	print(-1)


def main():
	s = input()
	n = len(s)
	res = []
	if s[0] == '0' or s[-1] == '1':
		print(-1)
		return 1
	m = n // 2
	t = m
	for i in range(m, 0, -1):
		if s[i - 1] != s[n - i - 1]:
			print(-1)
			return 1
		if i == m:
			if s[i - 1] == '1':
				res.append([m, m + 1])
				for j in range(m + 2, n + 1):
					res.append([m + 1, j])
			else:
				for j in range(m + 1, n + 1):
					res.append([m, j])
		elif s[i - 1] == '1':
			res.append([t, i])
			t = i
		else:
			res.append([t, i])
	for sres in res:
		print(' '.join(map(str, sres)))
main()


import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub
sys.setrecursionlimit(100000)
input = sys.stdin.readline
INF = 2 ** 62 - 1

def read_int():
	return int(input())

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

def read_float():
	return float(input())

def read_float_n():
	return list(map(float, input().split()))

def read_str():
	return input().strip()

def read_str_n():
	return list(map(str, input().split()))

def error_print(*args):
	print(*args, file=sys.stderr)

def mt(f):
	import time

	def wrap(*args, **kwargs):
		s = time.time()
		ret = f(*args, **kwargs)
		e = time.time()
		error_print(e - s, 'sec')
		return ret
	return wrap

@mt
def slv(S):
	N = len(S)
	if S[N - 1] == '1':
		print(-1)
		return -1
	if S[0] != '1':
		print(-1)
		return -1
	if S[N - 2] != '1':
		print(-1)
		return -1
	for i in range(N // 2):
		if S[i] != S[N - 2 - i]:
			print(-1)
			return -1
	p = [N]
	for i in range(N, 0, -1):
		if S[i - 1] == '1':
			p.append(i)
		else:
			p.append(p[-1])
	p.reverse()
	e = []
	for i in range(1, N):
		e.append((i, p[i]))
	for (u, v) in e:
		print(u, v)

def main():
	S = read_str()
	slv(S)

def __starting_point():
	main()
__starting_point()


import sys

def main():
	s = list(input())
	l = len(s)
	if s[0] != '1' or s[-1] != '0':
		print(-1)
	else:
		for i in range(l // 2):
			if s[i] != s[l - i - 2]:
				print(-1)
				exit()
		s = s[::-1]
		s[0] = '1'
		now = 0
		ans = []
		while now < l - 1:
			c = 1
			ans.append((l - now, l - (now + c)))
			while s[now + c] == '0':
				c += 1
				ans.append((l - now, l - (now + c)))
			now += c
		for (x, y) in ans:
			print(x, y)
main()


S = input()
eda = []
flag = False
N = len(S)
if S[-1] == '1':
	flag = True
if S[0] == '0':
	flag = True
if S[-2] == '0':
	flag = True
for k in range((N - 1) // 2):
	if S[k] != S[-k - 2]:
		flag = True
	if S[k] == '1':
		eda.append(k + 1)
if N % 2 == 0:
	if S[N // 2 - 1] == '1':
		eda.append(N // 2)
if flag:
	print(-1)
	return
ans = []
eda.reverse()
before = eda.pop()
while eda:
	after = eda.pop()
	for k in range(before, after):
		ans.append((k, after))
	before = after
ans.append((before, before + 1))
for k in range(before + 2, N + 1):
	ans.append((before + 1, k))
while ans:
	item = ans.pop()
	print((item[0], item[1]))


s = input()
if s[0] == '0':
	print(-1)
elif s[-1] == '1':
	print(-1)
else:
	l = len(s)
	for i in range(l - 1):
		if s[i] != s[l - i - 2]:
			print(-1)
			exit()
	ans = []
	base = 1
	for i in range(l - 1):
		if s[i] == '1':
			print(base, i + 2)
			base = i + 2
		else:
			print(base, i + 2)


def solve(s):
	n = len(s)
	if s[0] != '1':
		print(-1)
		return
	if s[-1] != '0':
		print(-1)
		return
	for i in range((n - 1) // 2):
		if s[i] != s[n - 2 - i]:
			print(-1)
			return
	edges = [(1, 2)]
	s = s[:n // 2]
	p = 1
	if 3 < n and s[1] == '1':
		p = 2
	for i in range(1, n // 2):
		edges.append((p, i + 2))
		if s[i] == '1':
			p = i + 2
	for i in range(n // 2 + 1, n):
		edges.append((p, i + 1))
	for uv in edges:
		(u, v) = uv
		print('{} {}'.format(u, v))

def main():
	s = input()
	solve(s)
main()


import sys
s = input()
n = len(s)
if s[0] == '0' or s[-1] == '1':
	print(-1)
	sys.exit()
possible = []
for i in range(n // 2):
	if s[i] != s[n - i - 2]:
		print(-1)
		sys.exit()
	if i > 0 and s[i] == '1':
		possible.append(i + 1)
l = len(possible)
edges = []
cnt = 0
for i in range(l):
	for j in range(cnt + 1, possible[i]):
		edges.append([j, possible[i]])
	if i != l - 1:
		edges.append([possible[i], possible[i + 1]])
	else:
		edges.append([possible[i], possible[i] + 1])
	cnt = possible[i]
for i in range(cnt + 2, n + 1):
	edges.append([cnt + 1, i])
for e in edges:
	print(*e)


s = input()
if s[0] == '0' or s[-2] == '0' or s[-1] == '1':
	print(-1)
elif s[:-1] != s[-2::-1]:
	print(-1)
else:
	half = len(s) // 2
	one_indices = [i + 1 for i in range(1, half) if s[i] == '1']
	parents = [0] * (len(s) + 1)
	parent_index = 1
	for index in one_indices:
		for i in range(parent_index, index):
			parents[i] = index
		parent_index = index
	root = parent_index + 1
	parents[parent_index] = root
	for index in range(root + 1, len(s) + 1):
		parents[index] = root
	for (node, parent) in enumerate(parents):
		if parent == 0:
			continue
		print(node, parent)


import sys
input = sys.stdin.readline
sys.setrecursionlimit(1000000)
import math
import bisect
import heapq
from collections import defaultdict
from collections import deque
from collections import Counter
from functools import lru_cache
MOD = 10 ** 9 + 7
INF = float('inf')
AZ = 'abcdefghijklmnopqrstuvwxyz'

def I():
	return int(input().strip())

def S():
	return input().strip()

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

def SL():
	return list(map(str, input().split()))

def ILs(n):
	return list((int(input()) for _ in range(n)))

def SLs(n):
	return list((input().strip() for _ in range(n)))

def ILL(n):
	return [list(map(int, input().split())) for _ in range(n)]

def SLL(n):
	return [list(map(str, input().split())) for _ in range(n)]

def DD(arg):
	return defaultdict(arg)

def inv(n):
	return pow(n, MOD - 2, MOD)
kaijo_memo = []

def kaijo(n):
	if len(kaijo_memo) > n:
		return kaijo_memo[n]
	if len(kaijo_memo) == 0:
		kaijo_memo.append(1)
	while len(kaijo_memo) <= n:
		kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
	return kaijo_memo[n]
gyaku_kaijo_memo = []

def gyaku_kaijo(n):
	if len(gyaku_kaijo_memo) > n:
		return gyaku_kaijo_memo[n]
	if len(gyaku_kaijo_memo) == 0:
		gyaku_kaijo_memo.append(1)
	while len(gyaku_kaijo_memo) <= n:
		gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo), MOD - 2, MOD) % MOD)
	return gyaku_kaijo_memo[n]

def nCr(n, r):
	if n == r:
		return 1
	if n < r or r < 0:
		return 0
	ret = 1
	ret = ret * kaijo(n) % MOD
	ret = ret * gyaku_kaijo(r) % MOD
	ret = ret * gyaku_kaijo(n - r) % MOD
	return ret

def factorization(n):
	arr = []
	temp = n
	for i in range(2, int(-(-n ** 0.5 // 1)) + 1):
		if temp % i == 0:
			cnt = 0
			while temp % i == 0:
				cnt += 1
				temp //= i
			arr.append([i, cnt])
	if temp != 1:
		arr.append([temp, 1])
	if arr == []:
		arr.append([n, 1])
	return arr

def make_divisors(n):
	divisors = []
	for i in range(1, int(n ** 0.5) + 1):
		if n % i == 0:
			divisors.append(i)
			if i != n // i:
				divisors.append(n // i)
	return divisors

def make_primes(N):
	max = int(math.sqrt(N))
	seachList = [i for i in range(2, N + 1)]
	primeNum = []
	while seachList[0] <= max:
		primeNum.append(seachList[0])
		tmp = seachList[0]
		seachList = [i for i in seachList if i % tmp != 0]
	primeNum.extend(seachList)
	return primeNum

def gcd(a, b):
	while b:
		(a, b) = (b, a % b)
	return a

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

def count_bit(n):
	count = 0
	while n:
		n &= n - 1
		count += 1
	return count

def base_10_to_n(X, n):
	if X // n:
		return base_10_to_n(X // n, n) + [X % n]
	return [X % n]

def base_n_to_10(X, n):
	return sum((int(str(X)[-i - 1]) * n ** i for i in range(len(str(X)))))

def base_10_to_n_without_0(X, n):
	X -= 1
	if X // n:
		return base_10_to_n_without_0(X // n, n) + [X % n]
	return [X % n]

def int_log(a, n):
	count = 0
	while n >= a:
		n //= a
		count += 1
	return count
S = S()
N = len(S)
S = [int(s) for s in S]
M = N // 2
if S[-1] != 0 or S[0] != 1:
	print(-1)
	return
for i in range(M):
	if S[i] != S[N - 2 - i]:
		print(-1)
		return
for i in range(M)[::-1]:
	if S[i] != 0:
		start = i
		break
print(1, 2)
for i in range(N - start - 2):
	print(2, i + 3)
now = 1
for i in range(1, start)[::-1]:
	if S[i] == 1:
		print(now, N - i)
		now = N - i
	else:
		print(now, N - i)
if start != 0:
	print(now, N)


import math
s = input()
N = len(s)
s = '#' + s
possible = 1
if s[-1] == '1' or s[1] == '0':
	possible = 0
for i in range(1, math.floor(N / 2)):
	if s[i] != s[N - i]:
		possible = 0
if not possible:
	print(-1)
elif N == 2:
	if s[1] == '1' and s[2] == '0':
		print(1, 2)
	else:
		print(-1)
elif N == 3:
	if s[1] == '1' and s[2] == '1':
		print(1, 2)
		print(2, 3)
	else:
		print(-1)
else:
	destination = [1] * (N + 1)
	dest_change = [0] * (N + 1)
	root = 2
	max_bit = math.floor(N / 2)
	for i in range(max_bit, -1, -1):
		if s[i] == '1':
			dest_change[root + 1] = dest_change[root + 1] + 1
			dest_change[root + i] = dest_change[root + i] - 1
			root += 1
	for i in range(1, N + 1):
		destination[i] = destination[i - 1] + dest_change[i]
	for i in range(2, N + 1):
		print(i, destination[i])


from bisect import bisect_right
s = list(map(int, list(input())))
s.insert(0, -1)
n = len(s) - 1
flag = 0
if s[n] == 1 or s[1] == 0 or s[n - 1] == 0:
	flag = 1
else:
	for i in range(2, n - 1):
		if s[i] != s[n - i]:
			flag = 1
			break
if flag == 1:
	print(-1)
else:
	print(n, n - 1)
	A = [1, n - 1]
	cur = 1
	for i in range(2, n - 1):
		if s[i] == 1:
			print(cur, i)
			cur = i
			A.append(i)
	print(cur, n - 1)
	A = sorted(A)
	for i in range(2, n - 1):
		if s[i] == 0:
			ind = bisect_right(A, i)
			print(i, A[ind])


import sys
s = list(map(int, input()))
n = len(s)
if s[0] == 0 or s[-1] == 1:
	print(-1)
	return
for i in range(n):
	if s[i] != s[n - i - 2]:
		print(-1)
		return
cur_children = [0]
ans = []
for i in range(1, n - 1):
	if s[i] == 1:
		while len(cur_children) > 0:
			j = cur_children.pop()
			ans.append((i + 1, j + 1))
	cur_children.append(i)
while len(cur_children) > 0:
	j = cur_children.pop()
	ans.append((n, j + 1))
for (i, j) in ans:
	print((i, j))


def main():
	S = input()
	N = len(S)
	ok = True
	if S[0] == '0' or S[N - 1] == '1':
		ok = False
	for i in range(N - 1):
		if S[i] != S[N - 2 - i]:
			ok = False
	if not ok:
		print(-1)
		return
	prev = 1
	for i in range(2, N + 1):
		print(prev, i)
		if S[i - 2] == '1':
			prev = i
main()


import sys
s = input()
num = len(s)
if s[-1] == '1' or s[0] == '0':
	print(-1)
	return
s = s[:-1]
for i in range(num // 2):
	if s[i] != s[-1 - i]:
		print(-1)
		return
lis = []
ans = []
for i in range(num - 1):
	if i != 0 and s[i] == '1':
		lis.append(i + 1)
now = 1
for i in range(len(lis)):
	while now < lis[i]:
		ans.append([now, lis[i]])
		now += 1
	if i != len(lis) - 1:
		ans.append([lis[i], lis[i + 1]])
		now += 1
ans.append([num - 1, num])
for i in ans:
	print((i[0], i[1]))


s = input()
N = len(s)
if s[0] == '0' or s[-1] == '1':
	print(-1)
	exit()
Ans = []
q = [0]
for i in range(1, N // 2):
	(c, cr) = (s[i], s[-2 - i])
	if c != cr:
		print(-1)
		exit()
	elif c == '1':
		for u in q:
			Ans.append([u, i])
		q = [i]
	else:
		q.append(i)
i = N // 2
if N % 2 == 1:
	for u in q:
		Ans.append([u, i])
	for ans in Ans:
		print(ans[0] + 1, ans[1] + 1)
		print(N - ans[0], N - ans[1])
elif len(q) == 1:
	print(i, i + 1)
	for ans in Ans:
		print(ans[0] + 1, ans[1] + 1)
		print(N - ans[0], N - ans[1])
else:
	v = q.pop()
	for u in q:
		print(v + 1, u + 1)
		print(v + 1, N - u)
	print(i, i + 1)
	for ans in Ans:
		print(ans[0] + 1, ans[1] + 1)
		print(N - ans[0], N - ans[1])


import sys
s = input()
N = len(s)
if s[-1] == '1' or s[0] == '0':
	print(-1)
	return
for i in range(N // 2):
	if s[i] != s[-i - 2]:
		print(-1)
		return
tmp = 1
for i in range(N - 1):
	print((tmp, i + 2))
	if s[i] == '1':
		tmp = i + 2


s = list(input())
n = len(s)
if s[0] == '0' or s[-1] == '1':
	print(-1)
else:
	s.pop()
	sr = s.copy()
	sr.reverse()
	if s != sr:
		print(-1)
	else:
		ans = []
		now = 1
		cnt = 1
		for x in s:
			if x == '1':
				ans.append([now, now + cnt])
				now += cnt
				cnt = 1
			else:
				ans.append([now, now + cnt])
				cnt += 1
		for x in ans:
			print(x[0], x[1])


s = input().rstrip()
n = len(s)
if s[0] == '0' or s[-1] == '1':
	print(-1)
	exit()
for (fs, bs) in zip(s[:-1], s[:-1][::-1]):
	if fs != bs:
		print(-1)
		exit()
made = set()
node_num = 0
base = 0
for (i, ch) in enumerate(s[:-1]):
	if ch == '1' and i + 1 not in made:
		node_num += 1
		print(node_num + 1, base + 1)
		base = node_num
		made.add(i + 1)
		made.add(n - i - 1)
	else:
		node_num += 1
		print(base + 1, node_num + 1)


s = list(input())
N = len(s)
res = True
if s[0] == '0' or s[N - 1] == '1':
	res = False
for i in range(N - 1):
	if s[i] != s[N - 2 - i]:
		res = False
if res == False:
	print(-1)
else:
	k = 1
	for i in range(N - 1):
		if s[i] == '1':
			while k < i + 1:
				print(str(k) + ' ' + str(i + 1))
				k += 1
	while k < N:
		print(str(k) + ' ' + str(N))
		k += 1


S = input()
N = len(S)
if S[-1] == '1' or S[0] == '0':
	print(-1)
else:
	for i in range(N - 1):
		if S[i] != S[N - 2 - i]:
			print(-1)
			break
	else:
		tmp = 1
		for i in range(N - 1):
			if S[i] == '1':
				print(tmp, i + 2)
				tmp = i + 2
			else:
				print(tmp, i + 2)


import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10 ** 9))
write = lambda x: sys.stdout.write(x + '\n')
s = input()
n = len(s)
if s[0] == '0' or s[-2] == '0' or s[-1] == '1':
	print('-1')
elif any((s[i] != s[-2 - i] for i in range(n - 1))):
	print('-1')
else:
	i = 1
	ps = set([i])
	es = []
	for c in s[1:]:
		i += 1
		if c == '0':
			ps.add(i)
		else:
			for u in ps:
				es.append('%s %s' % (u, i))
			ps = set([i])
	for u in ps:
		if u != n:
			es.append('%s %s' % (u, n))
	write('\n'.join(es))


s = input()
n = len(s)
if s[0] == '0' or s[-1] == '1':
	print(-1)
	return
for i in range(n - 1):
	if s[i] != s[-2 - i]:
		print(-1)
		return
now = 1
for i in range(n - 1):
	if s[i] == '0':
		print((now, i + 2))
	else:
		print((now, i + 2))
		now = i + 2


S = input()
N = len(S)
if S[0] == '0' or S[-1] == '1':
	print(-1)
	exit()
mem = []
for i in range(N // 2):
	if S[i] != S[-2 - i]:
		print(-1)
		exit()
	if S[i] == '1':
		mem.append(i)
if len(mem) == 0:
	print(-1)
	exit()
ans = []
for i in range(1, len(mem) + 1):
	ans.append((i, i + 1))
last_v = len(mem) + 1
for i in range(mem[0]):
	last_v += 1
	ans.append((1, last_v))
for (i, (a, b)) in enumerate(zip(mem, mem[1:])):
	n = i + 2
	k = b - a - 1
	for _ in range(k):
		last_v += 1
		ans.append((n, last_v))
n = len(mem) + 1
for _ in range(N):
	last_v += 1
	if last_v > N:
		break
	ans.append((n, last_v))
for row in ans:
	print(*row)


s = input()
ans = []
n = len(s)
a = 1
if s[0] == '0' or s[-1] == '1':
	print(-1)
	exit()
for i in range(n - 1):
	if s[i] != s[n - i - 2]:
		print(-1)
		exit()
oya = n
for i in range(n - 1, 0, -1):
	ans.append([oya, i])
	if s[i - 1] == '1':
		oya = i
for i in ans:
	print(*i)


def check(S):
	size = len(S)
	if S[0] == '0' or S[-1] == '1':
		return False
	else:
		for i in range(size - 1):
			(a, b) = (i, size - i - 2)
			if S[a] == '1' and S[b] == '0' or (S[a] == '0' and S[b] == '1'):
				return False
		return True
S = input()
if check(S):
	N = len(S)
	l = [1]
	p = False
	for i in range(2, N + 1):
		if p:
			l.append(i)
		else:
			print((l[-1], i))
		p = S[i - 1] == '1'
	for i in range(len(l) - 1):
		print((l[i], l[i + 1]))
else:
	print(-1)


S = input()
L = len(S)
if S[0] == '0' or S[-1] == '1':
	print(-1)
	exit()
for i in range(L - 2):
	if S[i] != S[L - 2 - i]:
		print(-1)
		exit()
pv = 1
for i in range(L - 1):
	nv = i + 2
	if S[i] == '1':
		print(pv, nv)
		pv = nv
	else:
		print(pv, nv)


s = input()
n = len(s)
for i in range(n - 1):
	if s[i] != s[n - 2 - i]:
		print(-1)
		exit()
if s[-1] == '1' or s[0] == '0':
	print(-1)
	exit()
G = []
p = n - 1
for i in range(n - 1)[::-1]:
	G.append([i + 1, p + 1])
	if s[i] == '1':
		p = i
for i in range(n - 1):
	print(G[i][0], G[i][1])


s = input()
n = len(s)
if s[0] == '0' or s[-1] == '1' or any((s[i] != s[n - i - 2] for i in range(n - 1))):
	print(-1)
	exit()
ans = []
now = 0
for (i, c) in enumerate(s[:-1]):
	if c == '1':
		ans.append('{} {}'.format(now + 1, i + 2))
		now = i + 1
	else:
		ans.append('{} {}'.format(now + 1, i + 2))
print(*ans, sep='\n')


import sys
s = list(map(int, list(input())))
n = len(s)
if s[0] == 0 or s[-1] == 1:
	print(-1)
	sys.exit()
for i in range(n // 2):
	if s[i] == s[n - 2 - i]:
		continue
	else:
		print(-1)
		sys.exit()
ans = [[1, 2]]
last_edge = 2
for i in range(3, n + 1):
	ans.append([last_edge, i])
	if s[i - 2] == 1:
		last_edge = i
for u in ans:
	print(*u)


def main():
	s = input()
	n = len(s)
	if s[n - 1] == '1' or s[0] == '0':
		print(-1)
		return 0
	for i in range(n // 2):
		if s[i] != s[n - i - 2]:
			print(-1)
			return 0
	t = []
	now = 1
	for i in range(n // 2 - 1):
		t.append([now, i + 2])
		if s[i] == '1':
			now = i + 2
	t2 = [[i + n // 2, j + n // 2] for (i, j) in t]
	if s[n // 2 - 1] == '1':
		t.append([now, now + n // 2])
	else:
		for i in range(len(t2)):
			if t2[i][0] == now + n // 2:
				t2[i][0] = now
			if t2[i][1] == now + n // 2:
				t2[i][1] = now
		t.append([now, now + n // 2])
	if n % 2 == 1:
		t.append([now, n])
	t += t2
	for (i, j) in t:
		print(i, j)
main()


import array
from bisect import *
from collections import *
import fractions
import heapq
from itertools import *
import math
import random
import re
import string
import sys

def solve(S):
	if S[-1] == '1':
		return -1
	if S[0] == '0':
		return -1
	size = len(S)
	i = 0
	j = size - 2
	while i < j:
		if S[i] != S[j]:
			return -1
		i += 1
		j -= 1
	edges = []
	top = 0
	for i in range(size - 1):
		edges.append((top, i + 1))
		if S[i] == '1':
			top = i + 1
	return edges
S = input()
ans = solve(S)
if ans == -1:
	print(ans)
else:
	for e in ans:
		print('{} {}'.format(e[0] + 1, e[1] + 1))


S = input()
if S[-1] == '1' or S[0] == '0':
	print('-1')
	exit()
for i in range(len(S) // 2):
	if S[i] != S[-2 - i]:
		print('-1')
		exit()
print('1 2')
current_root = 1
for i in range(1, len(S) - 1):
	print('{:d} {:d}'.format(i + 2, current_root + 1))
	if i << len(S) // 2 and S[i] == '1':
		current_root = i + 1


s = input()
n = len(s)
if s[n - 1] == '1' or s[0] == '0':
	print(-1)
	exit()
for i in range(n):
	if s[i] != s[n - i - 2]:
		print(-1)
		exit()
cur_s = 2
cur_p = 2
print(1, 2)
for i in range(n - 2):
	if s[i + 1] == '1':
		print(cur_s + 1, cur_p)
		cur_p = cur_s + 1
	else:
		print(cur_s + 1, cur_p)
	cur_s += 1


s = input()
n = len(s)
if s[-1] == '1':
	print(-1)
	exit()
if s[0] == '0':
	print(-1)
	exit()
data = []
for i in range(0, n - 1):
	if s[i] == '1':
		data.append(i + 1)
		if s[n - 2 - i] == '0':
			print(-1)
			exit()
m = len(data)
edge = []
for i in range(1, m):
	edge.append((i, i + 1))
index = m + 1
for i in range(1, m):
	if i != 1:
		size = data[-i]
		nextsize = data[-i - 1]
		E = size - 1 - nextsize
		count = 0
		while E > count:
			edge.append((i, index))
			index += 1
			count += 1
	else:
		size = n
		nextsize = data[-2]
		E = size - 1 - nextsize
		count = 0
		while E > count:
			edge.append((i, index))
			index += 1
			count += 1
for i in range(n - 1):
	(u, v) = edge[i]
	print(u, v)


import sys
s = input()
N = len(s)
if s[-1] == '1':
	print(-1)
	sys.exit()
if s[0] == '0':
	print(-1)
	sys.exit()
t = s[:N - 1]
t = t[::-1]
if s[:N - 1] != t:
	print(-1)
	sys.exit()
u = s[:N - 1]
ans = []
x = 1
y = 1
for i in range(N - 1):
	if u[i] == '0':
		y += 1
		ans.append((x, y))
	else:
		y += 1
		ans.append((x, y))
		x = y
for (x, y) in ans:
	print(x, y)


s = input()
if s[-1] == '1':
	print(-1)
	return
s = s[:-1]
if s != s[::-1] or s[0] == '0':
	print(-1)
	return
s += '1'
n = len(s)
now = 1
for (i, t) in enumerate(s, 1):
	if t == '1':
		for j in range(now, i):
			print(j, i)
			now = i


import sys
sys.setrecursionlimit(2147483647)
INF = float('inf')
MOD = 10 ** 9 + 7
input = lambda : sys.stdin.readline().rstrip()

def resolve():
	S = [None] + list(map(int, input()))
	n = len(S) - 1
	if not (S[1] == 1 and S[n - 1] == 1):
		print(-1)
		return
	if S[n] == 1:
		print(-1)
		return
	if any((S[i] != S[n - i] for i in range(1, n - 1))):
		print(-1)
		return
	v = 1
	nv = 2
	for i in range(n - 1, 0, -1):
		print(v, nv)
		nv += 1
		if S[i] == 1:
			v = nv - 1
resolve()


def ex():
	print(-1)
	exit()
s = input()
N = len(s)
if not (s[0] == '1' and s[-1] == '0'):
	ex()
for i in range(N // 2):
	if s[i] != s[N - i - 2]:
		ex()
ans = []
m = 1
for i in range(1, N // 2 + 1):
	ans.append((m, i + 1))
	if s[i - 1] == '1':
		m = i + 1
for i in range(N // 2 + 2, N + 1):
	ans.append((m, i))
for t in ans:
	print(*t)


S = input()

def is_asynmetric(S):
	for i in range(len(S) // 2):
		if S[i] != S[-(i + 2)]:
			return True
	else:
		return False
if S[0] != '1' or S[-2:] != '10':
	print(-1)
elif is_asynmetric(S):
	print(-1)
else:
	print('1 2')
	edge = 2
	for (i, s) in enumerate(S[1:-1], 3):
		print(edge, i)
		edge = edge if s == '0' else i


S = [int(c) for c in input()]
N = len(S)
r = all([S[i] == S[N - i - 2] for i in range(N // 2)]) and S[0] and (not S[-1])
t = [(1, 2)]
e = 2
for i in range(1, (N - 1) // 2):
	t.append((e, i + 2))
	if S[i]:
		e = i + 2
f = 1
if N % 2 == 0:
	t.append((e, N - e + 1))
	if S[N // 2 - 1]:
		f = 0
for i in range(0, (N - 1) // 2):
	t.append([e if t[i][j] == e and f else N - e + 1 if t[i][j] == N - t[i][j] + 1 and f else N - t[i][j] + 1 for j in range(2)])
if r:
	print(*[str(l[0]) + ' ' + str(l[1]) for l in t], sep='\n')
else:
	print(-1)


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, copy, functools
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
eps = 1.0 / 10 ** 13
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return [int(x) for x in sys.stdin.readline().split()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def pf(s):
	return print(s, flush=True)

def main():
	s = [int(c) for c in S()]
	if s[0] != 1 or s[-1] == 1:
		return -1
	n = len(s)
	for i in range(1, n):
		if s[i - 1] != s[n - i - 1]:
			return -1
	q = collections.deque()
	for i in range(1, n):
		if s[i] == 1:
			q.append(i + 1)
	q.append(n)
	c = 1
	r = []
	for i in range(1, n):
		if c == i:
			c = q.popleft()
		r.append('{} {}'.format(i, c))
	return '\n'.join(r)
print(main())


x = input()
n = len(x)
ret = []
if x[n - 1] == '1' or x[0] == '0' or x[:-1] != x[-2::-1]:
	print(-1)
else:
	a = 1
	for i in range(n - 1):
		print('{0} {1}'.format(a, i + 2))
		if x[i] == '1':
			a = i + 2


s = input()
n = len(s)
if s[-1] == '0' and s[0] == '1' and (s[n - 2] == '1') and (s[:n - 1] == s[n - 2::-1]):
	i = 0
	j = 1
	while j <= n - 2:
		if s[j] == '1':
			for k in range(i, j):
				print(k + 1, j + 1)
			i = j
			j = j + 1
		else:
			j += 1
	print(n - 1, n)
else:
	print(-1)


def no():
	print(-1)
	return
s = input()
n = len(s)
if s[-1] == '1':
	no()
s = s[:-1]
if s != s[::-1]:
	no()
if s[0] == '0':
	no()
li = [0]
adj = [[] for _ in range(n + 1)]
for (v, e) in enumerate(s, 1):
	if e == '1':
		for u in li:
			adj[u].append(v)
		li = []
	li.append(v)
adj[n - 1].append(n)
for (u, vs) in enumerate(adj[1:], 1):
	for v in vs:
		print((u, v))


ss = input()
n = len(ss)
if ss[0] == '0' or ss[-1] == '1':
	print(-1)
	exit()
else:
	for (s1, s2) in zip(ss[:n // 2], ss[n // 2 - 1:-1][::-1]):
		if s1 != s2:
			print(-1)
			exit()
(vMin, vMax) = (1, n)
iPrev = 0
for (i, s) in enumerate(ss, 1):
	if s == '0':
		continue
	print(vMin, vMin + 1)
	for j in range(i - iPrev - 1):
		print(vMin, vMax)
		vMax -= 1
	vMin += 1
	iPrev = i


def main():
	s = input()
	if s[-1] == '1' or s[0] == '0':
		print(-1)
		return
	if s[0:-1][::-1] != s[:-1]:
		print(-1)
		return
	temp = 1
	init = []
	for i in range(1, int((len(s) + 1) / 2)):
		if s[i] == '1':
			for j in range(temp + 1, i + 2):
				print(temp, j, sep=' ')
			init += [temp]
			temp = i + 2
	if temp != len(s):
		for j in range(temp + 1, len(s) + 1):
			print(temp, j, sep=' ')
	init += [temp]
	for i in range(len(init) - 1):
		print(init[i], init[i + 1], sep=' ')
main()


import bisect, copy, heapq, math, sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product

def input():
	return sys.stdin.readline()[:-1]

def ruiseki(lst):
	return [0] + list(accumulate(lst))

def celi(a, b):
	return -(-a // b)
sys.setrecursionlimit(5000000)
mod = pow(10, 9) + 7
al = [chr(ord('a') + i) for i in range(26)]
direction = [[1, 0], [0, 1], [-1, 0], [0, -1]]
s = list(map(int, list(input())))
n = len(s)
if s[-1] == 1 or s[0] == 0:
	print(-1)
	quit()
for i in range(n - 1):
	if s[i] != s[-2 - i]:
		print(-1)
		quit()
s[-1] = 1
now = n
for i in range(n - 1)[::-1]:
	print(i + 1, now)
	if s[i] == 1:
		now = i + 1


s = list(input())
n = len(s)
if s[n - 1] == '1' or s[0] == '0':
	print(-1)
	return
for i in range((n - 1) // 2):
	if not s[i] == s[n - 2 - i]:
		print(-1)
		return
l = n - s.count('0') + 1
x = [0] * l
j = 0
for i in range(n // 2):
	if s[i] == '1':
		j += 1
	else:
		x[j] += 1
		x[l - 1 - j] += 1
		if j == l - 1 - j and n % 2 == 0 and (i == (n - 1) // 2):
			x[j] -= 1
for i in range(l - 1):
	print(i + 1, i + 2)
k = n - s.count('0') + 2
for i in range(l):
	for _ in range(x[i]):
		print(i + 1, k)
		k += 1


import sys
stdin = sys.stdin

def li():
	return map(int, stdin.readline().split())

def li_():
	return map(lambda x: int(x) - 1, stdin.readline().split())

def lf():
	return map(float, stdin.readline().split())

def ls():
	return stdin.readline().split()

def ns():
	return stdin.readline().rstrip()

def lc():
	return list(ns())

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

def nf():
	return float(stdin.readline())
s = lc()
n = len(s)
if s[0] == '0' or s[-1] == '1' or s[-2] == '0':
	print(-1)
elif s[:(n - 1) // 2] != s[n - 2:n // 2 - 1:-1]:
	print(-1)
else:
	par = n
	cur = n - 1
	print(n, n - 1)
	if n > 2:
		for si in s[-3::-1]:
			cur -= 1
			print(par, cur)
			if si == '1':
				par = cur


s = input().strip()
n = len(s)
s = {i + 1 for i in range(n) if s[i] == '1'}
if n in s or 1 not in s or any((n - x not in s for x in s)):
	print(-1)
else:
	s = sorted(s)
	c = 1
	e = []
	for i in range(1, len(s)):
		while c < s[i]:
			e.append((c, s[i]))
			c += 1
	e.append((c, n))
	e = [str(u) + ' ' + str(v) for (u, v) in e]
	print(*e, sep='\n')


s = input()
n = len(s)
if s[0] != '1' or s[n - 1] != '0':
	print('-1')
	exit()
for i in range(n):
	if s[i] != s[n - 2 - i]:
		print('-1')
		exit()
x = 1
for i in range(1, n):
	print(x, i + 1)
	if s[i - 1] == '1':
		x = i + 1


s = input()
if s[0] == '0':
	print(-1)
	return ()
if s[-1] == '1':
	print(-1)
	return ()
for i in range(len(s) - 1):
	if s[i] != s[len(s) - 1 - (i + 1)]:
		print(-1)
		return ()
ans = []
for i in range(len(s) - 1):
	if s[i] == '1':
		for j in ans:
			print(j + 1, i + 1)
		ans = []
	ans.append(i)
for j in ans:
	print(j + 1, len(s))


vs = [int(i) for i in input().strip()]
n = (len(vs) - 2) // 2

def main(vs):
	if vs[0] != 1:
		print(-1)
		return -1
	if vs[-1] != 0:
		print(-1)
		return -1
	if vs[-2] != 1:
		print(-1)
		return -1
	for i in range(n):
		if vs[i + 1] != vs[-2 - i - 1]:
			print(-1)
			return
	temp = 1
	for i in range(n + 1 if len(vs) % 2 == 0 else n + 2):
		print(1, temp + 1)
		temp += 1
	temptemp = temp
	temp = 1
	for i in range(n):
		x = 1 + n - i
		if vs[n - i] == 1:
			print(temptemp, temptemp + 1)
			temp = temptemp
			temptemp += 1
		else:
			print(temp, temptemp + 1)
			temptemp += 1
main(vs)


s = input()
if (s[0] == '0') | (s[-1] == '1'):
	print(-1)
	exit()
n = len(s)
size = []
for i in range(1, n // 2):
	sl = s[i]
	sr = s[n - 2 - i]
	if sl != sr:
		print(-1)
		exit()
	if sl == '1':
		size.append(i + 1)
size.append(n - 1)
ans = []
now = 1
for si in size:
	for j in range(now + 1, si + 2):
		ans.append(' '.join(map(str, [now, j])))
	now = si + 1
print('\n'.join(ans))


import sys
import socket
if socket.gethostname() in ['N551J', 'F551C']:
	sys.stdin = open('e1.in')

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

def read_int():
	return int(input())

def read_str_list():
	return input().split()

def read_str():
	return input()

def solve():
	s = list(map(int, read_str()))
	n = len(s)
	if s[0] != 1:
		return -1
	if s[n - 1] != 0:
		return -1
	for i in range(n - 1):
		if s[i] != s[n - 2 - i]:
			return -1
	x = [i for i in range(n) if s[i] == 1]
	k = len(x)
	body = list(range(1, k + 2))
	res = [[body[i], body[i + 1]] for i in range(k)]
	p = k + 2
	for j in range(1, k):
		for l in range(x[j] - x[j - 1] - 1):
			edge = [body[j], p]
			p += 1
			res.append(edge)
	return res

def main():
	res = solve()
	if res == -1:
		print(res)
		return
	for edge in res:
		print(*edge)
main()


s = input()
n = len(s)

def check():
	if s[0] == '0' or s[-1] == '1':
		return False
	for i in range(n):
		if s[i] != s[n - i - 2]:
			return False
	return True
if not check():
	print(-1)
	return
now = 1
for i in range(n - 1):
	print(now, i + 2)
	if s[i] == '1':
		now = i + 2


import bisect
s = input()
if s[-1] == '1' or s[0] == '0':
	print(-1)
	exit()
for i in range((len(s) - 1) // 2):
	if s[i] != s[len(s) - i - 2]:
		print(-1)
		exit()
sd = s[:-1] + '1'
plist = [i for (i, v) in enumerate(sd) if v == '1']
for (i, v) in enumerate(s[:-1]):
	r = bisect.bisect(plist, i)
	print(i + 1, plist[r] + 1)


S = input()
if S[0] == '0' or S[-1] == '1':
	print(-1)
	exit()
flag = True
for i in range((len(S) - 1) // 2):
	if S[i] != S[-2 - i]:
		flag = False
		break
if not flag:
	print(-1)
	exit()
ans = []
now = 1
sub = 0
for c in S[:-1]:
	if c == '1':
		ans.append((now, now + sub + 1))
		now += sub + 1
		sub = 0
	else:
		sub += 1
		ans.append((now, now + sub))
for elem in ans:
	print(str(elem[0]) + ' ' + str(elem[1]))


S = input()
N = len(S)
if S[0] == '0' or S[-1] == '1':
	print(-1)
	exit()
D = {}
for i in range(N - 1):
	D[i + 1] = S[i]
for i in range(1, N):
	if D[i] != D[N - i]:
		print(-1)
		exit()
T = [[] for i in range(N)]
next = 1
mark = 0
for i in range(N):
	child = mark + 1
	if S[i] == '0':
		next += 1
	else:
		for n in range(next):
			T[mark].append(child)
			child += 1
		next = 1
		mark = child - 1
for i in range(N):
	for t in T[i]:
		print(i + 1, t + 1)


def main():
	s = '0' + input()
	ans = []
	f = True
	for i in range(len(s) // 2):
		if s[i] != s[len(s) - 1 - i]:
			f = False
			break
	if s[1] == '0' or s[-2] == '0':
		f = False
	if f:
		ans = []
		p = len(s) - 1
		for i in reversed(range(1, len(s) - 1)):
			c = s[i]
			ans.append([i, p])
			if c == '1':
				p = i
		for (u, v) in ans:
			print(u, v)
	else:
		print(-1)

def __starting_point():
	main()
__starting_point()


S = [int(x) for x in input()]
N = len(S)
if S[0] == 0 or S[-1] == 1 or any((S[i] != S[-i - 2] for i in range(N - 1))):
	print(-1)
	quit()
edge = [(1, 2)]
(root, now) = (2, 3)
for i in range(1, N // 2 + 1):
	edge.append((root, now))
	if S[i] == 1:
		root = now
	now += 1
while now <= N:
	edge.append((root, now))
	now += 1
for (s, t) in edge:
	print(s, t)


s = list(input())
n = len(s)
if s[0] == '0' or s[n - 1] == '1':
	print(-1)
	exit()
for i in range(n - 1):
	if s[i] != s[n - 2 - i]:
		print(-1)
		exit()
p = n
for i in range(n - 2, -1, -1):
	print(p, i + 1)
	if s[i] == '1':
		p = i + 1


s = input()
l = len(s)
if s[0] != '1' or s[-2] != '1' or s[-1] != '0':
	print('-1')
	exit()
if s[:-1] != s[:-1][::-1]:
	print('-1')
	exit()
e = [l] + [-1] * (l - 1)
now = 0
h = (l - 1) // 2
for i in range(h, 0, -1):
	c = s[i]
	if c == '0':
		continue
	e[now] = l - i
	e[l - i - 1] = l
	now = l - i - 1
for (i, a) in enumerate(e):
	for j in range(i + 2, a + 1):
		print(i + 1, j)


from sys import stdin
s_in = lambda : stdin.readline()[:-1]
d_in = lambda : int(stdin.readline())
ds_in = lambda : list(map(int, stdin.readline().split()))
S = s_in()
N = len(S)
if S[0] == '0':
	print(-1)
	exit()
elif S[-1] == '1':
	print(-1)
	exit()
for i in range((N - 1) // 2):
	if S[i] != S[-i - 2]:
		print(-1)
		exit()
parent = N
for i in range(N - 1, 0, -1):
	s = S[i - 1]
	if s == '1':
		print(i, parent)
		parent = i
	else:
		print(i, parent)


def I():
	return int(input())

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

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

def main():
	mod = 10 ** 9 + 7
	S = input()
	N = len(S)
	if S[0] == '0' or S[-1] == '1':
		print(-1)
		return
	S = S[:-1]
	flag = 1
	for i in range(N - 1):
		if S[i] != S[-1 - i]:
			flag = 0
	if flag == 0:
		print(-1)
		return
	L = [(1, 2)]
	head = 2
	now = 3
	for s in S[1:]:
		L.append((head, now))
		if s == '1':
			head = now
		now += 1
	for a in L:
		print(' '.join(map(str, a)))
main()


(*S,) = map(int, open(0).readline().strip())
N = len(S)
ok = 1
for i in range(N - 1):
	if S[i] != S[-2 - i]:
		ok = 0
		break
if not ok or S[0] != 1 or S[-1] != 0:
	print(-1)
	exit(0)
E = []
V = [i + 1 for i in range(N // 2) if S[i]]
p = 1
for v in V:
	for i in range(p, v):
		E.append('%d %d\n' % (i, v))
	p = v
E.append('%d %d\n' % (p, p + 1))
p += 1
for i in range(p + 1, N + 1):
	E.append('%d %d\n' % (p, i))
open(1, 'w').writelines(E)


x = [c for c in input()]
n = len(x)
ret = []
for i in range(n - 1):
	ret.append([0, 0])
if x[n - 1] == '1':
	print(-1)
elif x[0] == '0':
	print(-1)
else:
	flg = 1
	for i in range(int((n - 1) / 2)):
		if x[i] != x[n - 1 - i - 1]:
			flg = 0
	if flg == 0:
		print(-1)
	else:
		a = 1
		b = n
		for i in range(int((n - 2) / 2)):
			if x[i] == '1':
				ret[i] = [a, i + 2]
				ret[n - i - 2] = [b, n - i - 2 + 1]
				a = i + 2
				b = n - i - 2 + 1
			else:
				ret[i] = [a, i + 2]
				ret[n - i - 2] = [b, n - i - 2 + 1]
		if n % 2 == 1:
			i = int((n - 3) / 2)
			if x[i] == '1':
				ret[i] = [a, i + 2]
				ret[n - i - 2] = [b, n - i - 2 + 1]
			else:
				tmp = b
				for j in range(i):
					if ret[n - j - 2][1] == b:
						ret[n - j - 2][1] = a
					if ret[n - j - 2][0] == b:
						ret[n - j - 2][0] = a
				ret[i] = [a, i + 2]
				ret[n - i - 2] = [a, tmp]
		else:
			i = int(n / 2) - 1
			if x[i] == '1':
				ret[i] = [a, b]
			else:
				tmp = b
				for j in range(i):
					if ret[n - j - 2][1] == b:
						ret[n - j - 2][1] = a
					if ret[n - j - 2][0] == b:
						ret[n - j - 2][0] = a
				ret[i] = [a, b]
		for i in range(n - 1):
			print('{0} {1}'.format(ret[i][0], ret[i][1]))


s = list(input())
s = [int(si) for si in s]
n = len(s)
if s[-1] or not s[0]:
	print(-1)
	return
for i in range(1, n // 2):
	if s[i - 1] != s[n - i - 1]:
		print(-1)
		return
ans = [(1, 2)]
for i in range(1, n - 1):
	(x, y) = ans[-1]
	if s[i]:
		ans.append((y, i + 2))
	else:
		ans.append((i + 2, y))
for (x, y) in ans:
	print(x, y)


s = input()
slen = len(s) - 1
slen2 = (len(s) - 1) // 2
iswitch = 0
for i in range(slen2):
	if s[i] != s[slen - i - 1]:
		iswitch = 1
if s[-1] == '1' or s[0] == '0':
	iswitch = 1
if iswitch == 1:
	print(-1)
elif slen == 1:
	print('1 1')
elif slen == 2:
	print('1 2')
	print('1 3')
else:
	if True:
		henlist = []
		mae = 1
		jswitch = 0
		for i in range(slen):
			now = i + 2
			if jswitch == 0:
				if s[now - 1] == '1':
					for i in range(now - mae):
						henlist.append([mae + i, now])
					mae = now
					if now > len(s) // 2:
						jswitch = 1
				else:
					pass
			else:
				henlist.append([mae, now])
	for hl in henlist:
		print(hl[0], hl[1])


from sys import exit

def muri():
	print(-1)
	exit()
L = list(map(int, input()))
N = len(L)
if L.pop():
	muri()
if not L[0]:
	muri()
if L != L[::-1]:
	muri()
if N == 2:
	print(1, 2)
	exit()
Ans = []
M = [i for (i, l) in enumerate(L, 1) if l]
K = [0] + [m2 - m1 - 1 for (m1, m2) in zip(M, M[1:])] + [0]
p = 1
for _ in range(len(M)):
	Ans.append((p, p + 1))
	p += 1
p += 1
for (j, k) in enumerate(K, 1):
	for _ in range(k):
		Ans.append((j, p))
		p += 1
for a in Ans:
	print(*a)


s = input()
len_s = len(s)
if s[-1] == '1':
	print(-1)
	exit()
for i in range((len_s - 1) // 2):
	if s[i] != s[len_s - 2 - i]:
		print(-1)
		exit()
if s[0] != '1':
	print(-1)
	exit()
num = 1
for i in range(len_s - 1):
	if s[i] == '1':
		print('{0} {1}'.format(num, i + 2))
		num = i + 2
	else:
		print('{0} {1}'.format(num, i + 2))


ss = input()
ans = 0
if ss[-1] == '1':
	ans = -1
s = ss[:-1]
gans = []
c = 1
for i in range(len(s)):
	if i == 0 and s[i] == '0':
		ans = -1
		break
	if s[i] != s[len(s) - i - 1]:
		ans = -1
		break
	if s[i] == '1':
		gans.append([c, i + 2])
		c = i + 2
	else:
		gans.append([i + 2, c])
if ans == -1:
	print(ans)
else:
	for i in gans:
		print(*i)


import sys
s = input()
check = 1
if s[-1] == '1':
	check = 0
if s[0] == '0':
	check = 0
n = len(s)
for i in range(n // 2):
	if s[i] != s[n - 2 - i]:
		check = 0
if check == 0:
	print(-1)
	sys.exit()
print(1, 2)
next = 2
for i in range(1, n - 1):
	print(next, i + 2)
	if s[i] == '1':
		next = i + 2


s = input()
n = len(s)
flg = 1
lis = []
if s[-1] == '1':
	print('-1')
	flg = 0
else:
	for i in range(n // 2):
		if s[i] == s[n - 2 - i]:
			lis.append(int(s[i]))
		else:
			print('-1')
			flg = 0
			break
if flg == 1:
	if lis[0] == 0:
		print('-1')
	else:
		posl = []
		for i in range(1, len(lis)):
			pos = i + 1
			if lis[i] == 1:
				posl.append(pos)
		old = 1
		for pos in posl:
			for i in range(old, pos):
				print('{} {}'.format(i, pos))
			old = pos
		print('{} {}'.format(old, old + 1))
		for i in range(old + 2, n + 1):
			print('{} {}'.format(old + 1, i))


from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor
INF = float('inf')

def LI():
	return list(map(int, sys.stdin.readline().split()))

def I():
	return int(sys.stdin.readline())

def LS():
	return sys.stdin.readline().split()

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

def IR(n):
	return [I() for i in range(n)]

def LIR(n):
	return [LI() for i in range(n)]

def SR(n):
	return [S() for i in range(n)]

def LSR(n):
	return [LS() for i in range(n)]

def SRL(n):
	return [list(S()) for i in range(n)]

def MSRL(n):
	return [[int(j) for j in list(S())] for i in range(n)]
mod = 1000000007
s = S()
if s[0] == '0' or s[-1] == '1' or s[:-1] != s[:-1][::-1]:
	print(-1)
else:
	n = len(s)
	s = s[:-1]
	now_point = 1
	for nxt_point in range(len(s)):
		print(now_point, nxt_point + 2)
		if s[nxt_point] == '1':
			now_point = nxt_point + 2


inp = [int(x) for x in list(input())]
length = len(inp)
(x, y) = (0, length - 2)
if not inp[0] == inp[length - 2] == 1 or inp[length - 1] == 1:
	print(-1)
	exit()
while x < y:
	if inp[x] != inp[y]:
		print(-1)
		exit()
	else:
		x += 1
		y -= 1
now = 1
num = 1
if length <= 4:
	for x in inp:
		num += 1
		if x:
			print(now, num)
			now = num
		else:
			print(now, num)
		if num == length:
			break
else:
	for x in inp:
		num += 1
		if x:
			print(now, num)
			if num != length - 1:
				now = num
		else:
			print(now, num)
		if num == length:
			break


s = input()
N = len(s)
flag = False
for i in range(N):
	if s[i] == '1':
		if s[N - 2 - i] != '1':
			print(-1)
			break
else:
	if s[0] == '0' or s[-1] == '1':
		print(-1)
	else:
		s = list(s)
		s[-1] = '1'
		ls = []
		for i in range(N):
			if s[i] == '1':
				ls.append(i)
		ps = 0
		for i in range(N - 1):
			if i == ls[ps]:
				ps += 1
			print(i + 1, ls[ps] + 1)


s = input()
N = len(s)
if s[-1] == '1' or s[0] == '0' or s[:N - 1] != s[:N - 1][::-1]:
	print('-1')
else:
	v = 1
	for i in range(N - 1):
		print('{} {}'.format(v, i + 2))
		if s[i] == '1' and i + 1 <= N // 2:
			v = i + 2
		else:
			pass


s = input()
(n, m, m2) = (len(s), 1, 2)
if 1 - int(s[0]) or int(s[-1]) or any((s[i] != s[n - i - 2] for i in range(n - 1))):
	print(-1)
else:
	for i in range(n - 1):
		print(m, m2)
		if int(s[i]):
			m = m2
		m2 += 1


x = [c for c in input()]
n = len(x)
ret = []
for i in range(n - 1):
	ret.append([0, 0])
if x[n - 1] == '1':
	print(-1)
elif x[0] == '0':
	print(-1)
else:
	flg = 1
	for i in range(n - 1):
		if x[i] != x[n - 1 - i - 1]:
			flg = 0
	if flg == 0:
		print(-1)
	else:
		a = 1
		for i in range(n - 1):
			if x[i] == '1':
				ret[i] = [a, i + 2]
				a = i + 2
			else:
				ret[i] = [a, i + 2]
		for i in range(n - 1):
			print('{0} {1}'.format(ret[i][0], ret[i][1]))


s = list(input())
n = len(s)
if s[0] != '1' or s[-1] == '1' or s[:(n - 1) // 2] != s[n - 2:n // 2 - 1:-1]:
	print(-1)
	return
chain = [1]
ans = []
s[-1] = '1'
for i in range(1, n):
	if s[i] == '1':
		chain.append(i + 1)
		ans.append((chain[-2], chain[-1]))
c = len(chain)
for i in range(1, c):
	for j in range(chain[i - 1] + 1, chain[i]):
		ans.append((j, chain[i]))
for edge in ans:
	print(*edge)


s = list(input())
n = len(s)
if s[0] == '0' or s[n - 1] == '1':
	print(-1)
	exit()
for i in range(1, n // 2):
	if s[i] != s[n - i - 2]:
		print(-1)
		exit()
s[n - 1] = '1'
i = 0
while i < n - 1:
	p = -1
	for j in range(i + 1, n):
		if s[j] == '1':
			p = j
			break
	for k in range(i, p):
		print(k + 1, p + 1)
	i = p


import typing
import sys
import math
import collections
import bisect
import itertools
import heapq
import decimal
import copy
import operator
INF = 10 ** 20
MOD = 10 ** 9 + 7

def ni():
	return int(sys.stdin.readline())

def ns():
	return list(map(int, sys.stdin.readline().split()))

def na():
	return list(map(int, sys.stdin.readline().split()))

def na1():
	return list([int(x) - 1 for x in sys.stdin.readline().split()])

def main():
	s = input()
	if s[0] == '0' or s[-1] == '1':
		print(-1)
		return ()
	s = s[:-1]
	n = len(s)
	for i in range(n):
		if s[i] != s[n - 1 - i]:
			print(-1)
			return
	pool = []
	idx = 0
	for i in range(1, n):
		if s[i] == '1':
			print((idx + 1, i + 1))
			idx = i
			for pi in pool:
				print((idx + 1, pi + 1))
			pool = []
		else:
			pool.append(i)
	print((n, n + 1))

def __starting_point():
	main()
__starting_point()


def die():
	print(-1)
	exit()
s = input()
n = len(s)
if s[-1] == '1':
	die()
if s[0] == '0':
	die()
for i in range(n - 1):
	if s[i] != s[-i - 2]:
		die()
root = last = 1
for i in range(n - 1):
	last += 1
	print(root, last)
	if s[i] == '1':
		root = last


s = input()
N = len(s)
flag = True
if s[N - 1] == '1':
	flag = False
if s[0] == '0' or s[N - 2] == '0':
	flag = False
for i in range(N // 2):
	if s[i] != s[N - i - 2]:
		flag = False
		break
if flag:
	ans = []
	prev = 0
	for i in range(N // 2):
		if s[i] == '1':
			for j in range(prev, i):
				ans.append([i + 1, j + 1])
			prev = i
	for i in range(prev, N - 1):
		ans.append([N, i + 1])
	for a in ans:
		print(*a)
else:
	print(-1)


import sys
ini = lambda : int(sys.stdin.readline())
inl = lambda : [int(x) for x in sys.stdin.readline().split()]
ins = lambda : sys.stdin.readline().rstrip()
debug = lambda *a, **kw: print('\x1b[33m', *a, '\x1b[0m', **dict(file=sys.stderr, **kw))

class Node:

	def __init__(self, val):
		self.val = val
		self.par = None

def solve():
	s = [x == '1' for x in ins()]
	n = len(s)
	if s[-1]:
		return print(-1)
	for i in range(n - 1):
		if s[i] != s[n - 2 - i]:
			return print(-1)
	if not s[0]:
		return print(-1)
	h = (n + 1) // 2
	nodes = [Node(i) for i in range(n)]
	for i in range(1, n):
		nodes[i].par = nodes[i - 1]
	i = 1
	while i + 2 < n:
		if s[i]:
			i += 1
			continue
		nodes[i + 2].par = nodes[i]
		(nodes[i], nodes[i + 1]) = (nodes[i + 1], nodes[i])
		i += 1
	edges = set()
	for i in range(1, n):
		u = nodes[i].val
		v = nodes[i].par.val
		edges.add((min(u, v) + 1, max(u, v) + 1))
	for (u, v) in edges:
		print(u, v)
solve()


def getN():
	return int(input())

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

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

def getArray(intn):
	return [int(input()) for i in range(intn)]

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

def rand_N(ran1, ran2):
	return random.randint(ran1, ran2)

def rand_List(ran1, ran2, rantime):
	return [random.randint(ran1, ran2) for i in range(rantime)]

def rand_ints_nodup(ran1, ran2, rantime):
	ns = []
	while len(ns) < rantime:
		n = random.randint(ran1, ran2)
		if not n in ns:
			ns.append(n)
	return sorted(ns)

def rand_query(ran1, ran2, rantime):
	r_query = []
	while len(r_query) < rantime:
		n_q = rand_ints_nodup(ran1, ran2, 2)
		if not n_q in r_query:
			r_query.append(n_q)
	return sorted(r_query)
from collections import defaultdict, deque, Counter
from decimal import *
from heapq import heapify, heappop, heappush
import math
import random
import string
from copy import deepcopy
from itertools import combinations, permutations, product
from operator import mul, itemgetter
from functools import reduce
from bisect import bisect_left, bisect_right
import sys
sys.setrecursionlimit(1000000000)
mod = 10 ** 9 + 7
S = input()
N = len(S)
if S[N - 1] == '1' or S[N - 2] == '0' or S[0] == '0':
	print(-1)
else:
	for i in range(N - 1):
		if S[i] != S[N - i - 2]:
			print(-1)
			return
	ans = []
	parent = 1
	for i in range(N - 1):
		if S[i] == '1':
			ans.append([parent, i + 2])
			parent = i + 2
		else:
			ans.append([parent, i + 2])
	for i in ans:
		print(i[0], i[1])


S = input()
N = len(S)
if S[0] != '1' or S[-1] != '0':
	print(-1)
	exit()
for (s, t) in zip(S[:N - 1], S[::-1][1:]):
	if s != t:
		print('-1')
		exit()
now = 1
branch = N
ans = []
for s in S[:N - 1]:
	if s == '1':
		ans.append('{} {}'.format(now, now + 1))
		now += 1
	else:
		ans.append('{} {}'.format(now, branch))
		branch -= 1
print(*ans, sep='\n')


s = '0' + input()
n = len(s) - 1
if s[1] != '1' or s[n] != '0':
	print(-1)
	exit()
for i in range(1, n // 2):
	if s[i] != s[n - i]:
		print(-1)
		exit()
q = [1]
for i in range(2, n):
	if s[i] == '1':
		for x in q:
			print(x, i)
		q = [i]
	else:
		q.append(i)
for x in q:
	print(x, n)


s = input()
flag = False
if s[0] == '0':
	flag = True
if s[-1] == '1':
	flag = True
N = len(s) // 2 + len(s) % 2
for i in range(N):
	if s[i] != s[-2 - i]:
		flag = True
if flag:
	print('-1')
	exit()
re = 1
for i in range(1, len(s)):
	print(re, i + 1)
	if s[i - 1] == '1':
		re = i + 1