Buggy python submission (verdict: Runtime Error):
S = input()
N = len(S)

if S[-1] == "1":
    print(-1)
    exit()

S2 = S[:-1]
for i in range((N - 1) // 2):
    if S2[i] != S2[N - i - 1]:
        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)



Fixed submission:
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)

Buggy python submission (verdict: Runtime Error):
S = input()
N = len(S)

if S[-1] == "1":
    print(-1)
    exit()

S2 = S[:-1]
for i in range(N // 2 + 1):
    if S2[i] != S2[N - i - 1]:
        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)



Fixed submission:
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)

Buggy python submission (verdict: Runtime Error):
S = input()
N = len(S)

if S[-1] == "1":
    print(-1)
    exit()

R = []
for i in range(N // 2):
    if S[i] == "1":
        if S[N - i - 2] == "1":
            R.append(i + 1)
        else:
            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

        mark = child - 1

for i in range(N):
    for t in T[i]:
        print(i+1, t+1)


Fixed submission:
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)

Buggy python submission (verdict: Runtime Error):
S = input()
N = len(S)

if S[-1] == "1":
    print(-1)
    exit()

R = []
for i in range(N // 2):
    if S[i] == "1":
        if S[N - i - 2] == "1":
            R.append(i + 1)
        else:
            print(-1)
            exit()

R_max = max(R)
for s in S[1:R_max-1]:
    if s == "0":
        print(-1)
        exit()


# 構築
T = [[] for i in range(N + 1)]

# R_maxの数だけ伸ばす
for i in range(1, R_max + 1):
    T[i].append(i + 1)

# 他はすべて1につなぐ
for i in range((R_max + 2), N + 1):
    T[1].append(i)

for i in range(1, N+1):
    for t in T[i]:
        print(i, t)


Fixed submission:
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)