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.

Difficulty: competition

Starter code:

Solutions:
s = input()

if s[0] == '0' or s[-2] == '0' or s[-1] == '1':  # 's' should be like "1xx...x0"
    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'] # not including 0 or larger than n//2

    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: # This means node is 0 or the root of the tree.
            continue
        print((node, parent))


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))


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()
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)

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]:
            print((-1))
            return
        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)))


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


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)
      return
  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)

import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
input = sys.stdin.readline
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
	return list(map(int,input().split()))
def m(): #複数文字
	return map(int,input().split())
def onem(): #Nとかの取得
	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): #listをスペースごとに分ける
	return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
	return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    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

"""
def nibu(x,n,r):
	ll = 0
	rr = r
	while True:
		mid = (ll+rr)//2

	if rr == mid:
		return ll
	if (ここに評価入れる):
		rr = mid
	else:
		ll = mid+1
"""

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()
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)

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()

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)); return
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[0]=="0":
    print("-1")
    return
if S[-1]=="1":
    print("-1")
    return

for s,rev_s in zip(S,reversed(S[:-1])):
    if s!=rev_s:
        print("-1")
        return

prev=N

for i in reversed(list(range(1,N))):
    print((i,prev))
    if S[i-1]=="1":
        prev=i




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 = 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':
    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

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
sys.setrecursionlimit(10**7) #再帰関数の上限,10**5以上の場合python
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#2分探索
#bisect_left(l,x), bisect(l,x)#aはソート済みである必要あり。aの中からx未満の要素数を返す。rightだと以下
from collections import deque
#deque(l), pop(), append(x), popleft(), appendleft(x)
#q.rotate(n)で → にn回ローテート
from collections import Counter#文字列を個数カウント辞書に、
#S=Counter(l),S.most_common(x),S.keys(),S.values(),S.items()
from itertools import accumulate,combinations,permutations#累積和
#list(accumulate(l))
from heapq import heapify,heappop,heappush
#heapify(q),heappush(q,a),heappop(q) #q=heapify(q)としないこと、返り値はNone
#import fractions#古いatcoderコンテストの場合GCDなどはここからimportする
from functools import lru_cache#pypyでもうごく
#@lru_cache(maxsize = None)#maxsizeは保存するデータ数の最大値、2**nが最も高効率
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
    #w.sort(key=itemgetter(1),reversed=True)  #二個目の要素で降順並び替え

    #N = int(input())
    #N, K = map(int, input().split())
    #A = tuple(map(int, input().split())) #1行ベクトル
    #L = tuple(int(input()) for i in range(N)) #改行ベクトル
    #S = tuple(tuple(map(int, input().split())) for i in range(N)) #改行行列

    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()

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=list(map(int,list(input())))
# s[0]=1,s[-1]=0,s[k]=s[n-k-1]は必要
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=' ')


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)
	return
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 = 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(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))
    return
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(list(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))
    return

for i in edges:
    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().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))


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
# ! /usr/bin/env python
# -*- coding: utf-8 -*-
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))
    return

for i in range((n-1) // 2):
    if s[i] != s[n-2-i]:
        print((-1))
        return

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=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 = 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

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))


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

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)

import sys
#input = sys.stdin.buffer.readline

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))
                return
        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))

def __starting_point():
    main()

__starting_point()

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("\033[33m", *a, "\033[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()


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))
        
    






    




import sys

s=list(map(int,list(input())))
n=len(s)
if s[0]==0 or s[-1]==1:
    print(-1)
    return
for i in range(n//2):
    if s[i]==s[n-2-i]:
        continue
    else:
        print(-1)
        return
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)

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 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 = '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
    # a max chain of sz
    now = 1
    for i in range(2, N+1):
        print((str(now) + ' ' + str(i)))
        if(s[i-1] == '1'):
            now = i


solve()


S=input()
N=len(S)

#1-originにする
#S[0]があるとすると、0,Nに別れることはないので、0
S="0"+S

#葉できった時に、1_(n-1)になるはず
if S[1]!="1":
    print("-1")
    return

#0_Nに別れることはない
if S[-1]!="0":
    print("-1")
    return

# S[i]=1の時,i_(N-i)に別れる-> S[i]==S[N-i]
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))
    #これまでに、N-i個がすでに気に追加されている。prevとcur(i)の間できると、(i_N-i)に別れる
    if S[i]=="1":
        prev=i
    else:
        #葉になる(1_N-1)に別れるため、i_(N-i)にはならない。S[1]=S[N-1]=1は決まっている。
        pass




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

#############
# Main Code #
#############

"""
頂点がN個、辺がN - 1本あります
1110
任意の辺を一つ取り除くとサイズ1の連結成分が作れる
任意の辺を一つ取り除くとサイズ2の連結成分が作れる
任意の辺を一つ取り除くとサイズ3の連結成分が作れる

どの辺を一つ取り除いてもサイズ4の連結成分は作れない

サイズ1の連結成分が作れること、サイズnの連結成分は作れないことは自明
サイズiの連結成分が作れるなら、サイズn - iの連結成分が作れる
単純な木構造から考えよう
・パスグラフ
・スターグラフ

・パスグラフ
1(1がN - 1個) + 0になる
・スターグラフ
10...010になる

他のものは作れないか
連結成分iのものが作れる条件、作れない条件
作れない条件が知りたい　単体であれば必ず作れる
（連結成分iが作れ、jが作れない）が成り立たない場合がある？
部分木から考えていく
大きさ2のパスグラフは11
これをrootにつけると 110になる
大きさ3のスターグラフは101
これをrootにつけると1010になる

大きさnのグラフにパス状に/スター状に繋げていくと
1 - 2のグラフに
パス状に3を繋げると 110
スター状に繋げると 110 ここまでは同じ
1 - 2 - 3のグラフに
パス状に繋げると 1110
スター状に繋げると 1010

パスグラフに辺を加えて連結成分jが作れないようにしよう

11010110は作れるか
一方をパスグラフに、一方をスターグラフにする?
1 - 2の状態でスタート
もしS[i] = 1なら親要素にi + 2をつけ、それを親要素にする
もしS[i] = 0なら現在の親要素につける
"""

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 # 現在のparent
    for i in range(N - 1):
        if S[i] == "1":
            # パスグラフ状
            ans.append([parent, i + 2])
            parent = i + 2 # parent変更
        else:
            # スターグラフ状
            ans.append([parent, i + 2])
    for i in ans:
        print(i[0], i[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)))

# 42


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

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

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))

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]



def ex():print(-1);return

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()

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)

# coding: utf-8
# Your code here!
import sys
readline = sys.stdin.readline
read = sys.stdin.read

#n = int(readline())
#*a, = map(int,readline().split())
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)

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



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)

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=' ')

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))


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)

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)
    # print (lst)

    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)

def __starting_point():
    main()
__starting_point()

# -*- coding: utf-8 -*-

#############
# Libraries #
#############

import sys
input = sys.stdin.readline
sys.setrecursionlimit(1000000)

import math
#from math import gcd
import bisect
import heapq
from collections import defaultdict
from collections import deque
from collections import Counter
from functools import lru_cache

#############
# Constants #
#############

MOD = 10**9+7
INF = float('inf')
AZ = "abcdefghijklmnopqrstuvwxyz"

#############
# Functions #
#############

######INPUT######
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)]


#####Shorten#####
def DD(arg): return defaultdict(arg)

#####Inverse#####
def inv(n): return pow(n, MOD-2, MOD)

######Combination######
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

######Factorization######
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

#####MakeDivisors######
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

#####MakePrimes######
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

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

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

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

#####ChangeBase#####
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]

#####IntLog#####
def int_log(a, n):
  count = 0
  while n>=a:
    n //= a
    count += 1
  return count

#############
# Main Code #
#############

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)

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()


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)
    return
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):
    nonlocal i
    v = i
    for c in subtree[size]:
        i += 1
        print(v, i)
        dfs(c)

dfs(N)

# -*- coding: utf-8 -*-
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()

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))


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()
N=len(S)

#1-originにする
#S[0]があるとすると、0,Nに別れることはないので、0
S="0"+S

#葉できった時に、1_(n-1)になるはず
if S[1]!="1":
    print("-1")
    return

# S[i]=1の時,i_(N-i)に別れる-> S[i]==S[N-i]
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))
    #これまでに、N-i個がすでに気に追加されている。prevとcur(i)の間できると、(i_N-i)に別れる
    if S[i]=="1":
        prev=i
    else:
        #葉になる(1_N-1)に別れるため、i_(N-i)にはならない。S[1]=S[N-1]=1は決まっている。
        pass




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


#from collections import deque
#from heapq import heapify, heappop, heappush
#from bisect import insort, bisect_left
#import sys
#sys.setrecursionlimit(10**9)
#from math import gcd
#from decimal import Decimal
#mod = 1000000007
#mod = 998244353
#N = int(input())
#N, K = map(int, input().split())
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]))
#ans = 0
#for k in range(N):
#print(ans)
#print('Yes')
#print('No')


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()
n=len(s)
if s[-1]=="1":
    print((-1))
    return

if s[0]=="0":
    print((-1))
    return

data=[]
for i in range(0,n-1):
    if s[i]=="1":
        data.append(i+1)
        if s[n-2-i]=="0":
            print((-1))
            return
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))


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()

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)

s = input()

if s[0] == '0' or s[-1] == '1' or s[:-1] != s[:-1][::-1]:
    print((-1))
    return

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))


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])

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)

# -*- coding: utf-8 -*-

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)
    return

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]


#ライブラリインポート
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()

s = input()
n = len(s)

if s[0] != "1" or s[n - 1] != "0":
  print("-1")
  return

for i in range(n):
  if s[i] != s[n - 2 - i]:
    print("-1")
    return

x = 1
for i in range(1, n):
  print(x, i + 1)
  if s[i - 1] == "1": x = i + 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':
        return None
    if S[N] == '1':
        return None
    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)))


s=input()
if s[0]=='0' or s[-1]=='1' or s[:-1]!=s[:-1][::-1]:
    print(-1)
    return
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)

#01:36
s = input()
n = len(s)
if s[-1] == '1':
  print(-1)
  return
t = s[:-1]
if t[::-1] != t:
  print(-1)
  return
if s[0] == '0':
  print(-1)
  return
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

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)


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)
m = n // 2
if S[0] == '0' or S[-1] == '1':
  print(-1)
  return

ans = [[1, 2]]
node = 1
now = 3
for i in range(m):
  if S[i] != S[n-i-2]:
    print(-1)
    return
  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":
    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


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)

#print (lis)

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]))


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':
        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]:
            print((-1)); return
        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 typing
import sys
import math
import collections
import bisect
import itertools
import heapq
import decimal
import copy
import operator

# sys.setrecursionlimit(10000001)
INF = 10 ** 20
MOD = 10 ** 9 + 7
# MOD = 998244353
# buffer.readline()


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()])


# ===CODE===
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()

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

print((1,2))
now = 2
for i in range(1,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[n - 1] == '1' or s[0] == '0':
    print(-1)
    return

for i in range(n):
    if s[i] != s[n - i - 2]:
        print(-1)
        return

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

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

    # check
    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 I(): return int(input())
def MI(): return list(map(int, input().split()))
def LI(): return list(map(int, input().split()))


"""
i=1は絶対ok．葉を繋ぐ辺を取れば良い
i=NはNG．もともとN要素なので
これ，i=0の時ngという条件を足せば，左右対象ぽい．サイズがaとN-aができるため．

「らしい」必要条件が分かった．必要十分だと嬉しい．
O(N)に近い感じで解きたいので，順次構築していくイメージ．

"""
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()


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 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])
        else:
            if 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()

s = input()
if(s[0]=='0')|(s[-1]=='1'):
    print(-1)
    return

n = len(s)
size = []
for i in range(1,n//2):
    sl = s[i]
    sr = s[n-2-i]
    if(sl != sr):
        print(-1)
        return
    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
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()

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 # and False
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]))


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))
    return

for i in range(n-1):
    if S[i] != S[-2-i]:
        print((-1))
        return


k = S.count(1)  # 1の個数
for i in range(k):
    print((i+1,i+2))

a = 1  # 付け足す辺の端点
b = k+2  # 付け足す頂点のindex
for i in range(n-1):
    if S[i] == 1:
        a += 1
    else:
        print((a,b))
        b += 1


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)))


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)

s = list(input())
n = len(s)
if s[-1] == "1":
    print((-1))
    return
if s[:-1] != s[:-1][::-1]:
    print((-1))
    return
if s[0] == "0":
    print((-1))
    return

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))







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()

S = input()

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

if check(S):
    N = len(S)
    l = [1]
    p = False
    for i in range(2, N+1):
        if p:
            l.append(i)
            if S[i-1]=="1":
                p = True
            else:
                p = False
        else:
            print(l[-1], i)
            if S[i-1]=="1":
                p = True
    sl = len(l)
    for i in range(sl-1):
        print(l[i], l[i+1])
else:
    print(-1)

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])

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())

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)
# print(s)
if s[-1]==1 or s[0]==0:
    print((-1))
    return

for i in range(n-1):
    if s[i]!=s[-2-i]:
        print((-1))
        return
s[-1]=1
now=n
for i in range(n-1)[::-1]:
    print((i+1,now))
    if s[i]==1:
        now=i+1