Harryxun/stf_run huggingface dataset:
def resolve():
    def main():
        N,M=map(int,input().split())
        S, C = [0] * M, [0] * M

        for i in range(M):
            S[i], C[i] = map(int, input().split())
            if i==0:
                dic={S[i]:C[i]}
            else:
                if S[i] not in dic.keys():
                    dic[S[i]]=C[i]
                elif dic[S[i]]!=C[i]:
                    return -1
        #dic=dict(sorted(dic.items(), key=lambda x: x[0]))
        ans=[0]*N
        for i,j in dic.items():
            ans[i-1]=j

        if len(ans)!=1 and ans[0]==0:
            return -1
        else:
            return ans

    val=main()
    if val==-1:
        print(-1)
    else:
        for i in val:
            print(i,end='')
        print()







resolve()

### FIXED CODE ###

N,M=map(int,input().split())
s=[list(map(int,input().split())) for i in range(M)]

#print(A)
def main():
    if N==1 and M==0:
        return 0
    if N==2 and M==0:
        return 10
    if N==3 and M==0:
        return 100

        
    if N==1:
        for i in range(0,10**N):
            for j in range(M):
                if str(i)[s[j][0]-1]!=str(s[j][1]):
                    break
                if j==M-1:
                    return i
            if i==10**N-1:
                return -1
    else:
        for i in range(10**(N-1),10**N):
            for j in range(M):
                if str(i)[s[j][0]-1]!=str(s[j][1]):
                    break
                if j==M-1:
                    return i
            if i==10**N-1:
                return -1
                    

print(main())
s = input()
t - input()
def hamming_dist(str1,str2):
    ans = 0
    a,b = len(str1),len(str2)
    if a > b:
        ans = a - b
        length = b
    elif a < b:
        ans = b - a
        length = a
    else:
        length = a
    for i in range(length):
        if str1[i] != str2[i]:
            ans += 1
    return ans
print(hamming_dist(s,t))

### FIXED CODE ###

s = input()
t = input()
def hamming_dist(str1,str2):
    ans = 0
    a,b = len(str1),len(str2)
    if a > b:
        ans = a - b
        length = b
    elif a < b:
        ans = b - a
        length = a
    else:
        length = a
    for i in range(length):
        if str1[i] != str2[i]:
            ans += 1
    return ans
print(hamming_dist(s,t))
N,M=map(int,input().split())
SC=[]
for i in range(M):
    SC.append(list(map(int,input().split())))

import numpy as np
SC=np.array(SC)


keta=np.unique(SC[:,0])
flag=0
for i in keta:
    if len(np.unique(SC[SC[:,0]==i],axis=0))>=2:
        flag=1
for x in SC[SC[:,0]==1]:
    if x[1]==0:
        flag=1

ans=[0]*N
ans[0]=1
if flag!=1:
    for i in keta:
        ans[i-1]=np.unique(SC[SC[:,0]==i],axis=0)[0][1]
    ans2=""
    for a in ans:
        ans2+=str(a)
    print(ans2)
else:
    print(-1)

### FIXED CODE ###

N,M=map(int,input().split())
ans=[0]*N
SC=[0]*N
flag=0
flag2=0
for i in range(M):
    s,c=map(int,input().split())
    if s-1==0:
        flag2=1
    if SC[s-1]==1:
        if ans[s-1]!=c:
            flag=1
    else:
        SC[s-1]=1
        ans[s-1]=c

if flag2==0 and N!=1:
    ans[0]=1

if ans[0]==0 and N!=1:
    flag=1

if flag==0:
    ans2=""
    for a in ans:
        ans2+=str(a)
    print(ans2)
else:
    print(-1)
from collections import Counter
import sys

n = int(input())
arr = list(map(int, input().split()))

# 全て0ならYes
if all([x == 0 for x in arr]):
    print("Yes")
    sys.exit()

# 3つずつ循環していなければNo
if n % 3 != 0:
    print("No")
    sys.exit()

c = Counter(arr)

# 2種類の場合
if len(c) == 2:
    if c[0] == n // 3:
        print("Yes")
        sys.exit()

# 3種類の場合
elif len(c) == 3:
    result = list(c.values())
    if result[0] == result[1] == result[2]:
        ans1 = True
    else:
        ans1 = False
else:
    print("No")
    sys.exit()

result = list(c.keys())
ans2 = result[0] == result[1] ^ result[2] and result[1] == result[0] ^ result[2] and result[2] == result[0] ^ result[1]

print("Yes" if ans1 and ans2 else "No")

### FIXED CODE ###

import sys
from collections import Counter
n = int(input())
a = list(map(int, input().split()))


# 全て0ならYes
if all([x == 0 for x in a]):
    print("Yes")
    sys.exit()

    
# 全て0でない場合、nは必ず3の倍数になる
if n % 3 != 0:
    print("No")
    sys.exit()

c = Counter(a)

cli = list(c.keys())
cval = list(c.values())


# 排他的論理和は3つずつ循環するため、keyは3種類、または0を含む場合2種類になる
if len(cli) > 3 or len(cli) <2:
    print("No")
    sys.exit()

# keyが2種類の場合、0が全体の1/3ならOK
if len(cli) == 2 and 0 in cli:
    if c[0] == n // 3:
        print("Yes")
        sys.exit()
    else:
        print("No")
        sys.exit()

# keyが3種類の場合、全ての値が同数、かつ排他的論理和の関係であればOK
if not all([x == cval[0] for x in cval]):
    print("No")
    sys.exit()

ans_0 = cli[1] ^ cli[2] == cli[0]
ans_1 = cli[2] ^ cli[0] == cli[1]
ans_2 = cli[0] ^ cli[1] == cli[2]

print("Yes" if all([ans_0, ans_1, ans_2]) else "No")
N = int(input())
S = list(input())
K  = int(input())

for i in range(N):
    if S[i] == S[K]:
         continue
    else:
        S[i] = '*'
print(''.join(S))

### FIXED CODE ###

N = int(input())
S = list(input())
K  = int(input())

l_replace = [s if S[K-1] in s else '*' for s in S]
print(''.join(l_replace))
S = input()
counts = []
count = 0
for i in range(len(S)):
  if S[i] == 'A' or S[i] == 'G' or S[i] == 'C' or S[i] == 'T':
    count += 1
  else:
    counts.append(count)
    count = 0
print(max(counts))

### FIXED CODE ###

S = input()
counts = []
count = 0
for i in range(len(S)):
  if S[i] == 'A' or S[i] == 'G' or S[i] == 'C' or S[i] == 'T':
    count += 1
  else:
    counts.append(count)
    count = 0
counts.append(count)
if len(S) ==1:
  print(counts[0])
else:
  print(max(counts))
num = int(input())
 
cards = list()
 
for i in range(num):
    cards.append(input())
 
sort = ['S', 'H', 'C', 'D']
nums = [str(i) for i in range(1, 14)]
 
for p in sort:
    for n in nums:
        c = p+' '+n
        if not c in cards:
            print(c)

### FIXED CODE ###

n = input()
mark = ['S', 'H', 'C', 'D']
cards = ["{} {}".format(mark[i], j+1) for i in range(4) for j in range(13)]
for i in range(n):
    cards.remove(raw_input())
while len(cards) != 0:
    print cards.pop(0)
from math import factorial

N=int(input())
x=list(map(int,input().split()))
MOD=10**9+7


x_dist=[x[i+1]-x[i] for i in range(N-1)]

def Cn(n,Cn_1):
    return Cn_1+1/n

ans=0
Cn_list=[1]

for n in range(2,N):
    temp=Cn(n,Cn_list[n-2])
    Cn_list.append(temp)

for i in range(N-1):
    ans+=Cn_list[i]*x_dist[i]

print((ans*factorial(N-1))%MOD)

### FIXED CODE ###

MOD = 10 ** 9 + 7
N = int(input())
x = list(map(int, input().split()))
x.sort()
 
kaijo = [1]
for i in range(1, N):
    kaijo.append(kaijo[-1] * i % MOD)
 
ans = 0
for i in range(N - 1):
    ans = (ans * (i + 1) + (x[-1] - x[i]) * kaijo[i]) % MOD
 
print(ans)
n = int(input())
if n % 2 == 1:
  print (n-1) /2
print(n/2)

### FIXED CODE ###

n = int(input())
if n % 2 == 1:
  print(int((n+1) / 2))
  exit(0)
print(int(n/2))
a,b = map(int,input())
print((a+b)/2)

### FIXED CODE ###

X,Y=map(int,input().split())
print(X+Y//2)
num=input()
num_list=list(num)
n=len(num)
ans_num=0
element=num_list[0]
while True:
    tf=True
    for i in range(n):
        if element<num_list[i]:
            tf=False
            element+=1
            break
    if tf:
        ans_num=element
        break
print(ans_num*n)

### FIXED CODE ###

num=input()
num_list=list(num)
n=len(num)
ans_num=0
element=int(num_list[0])
for i in range(n):
    if element<int(num_list[i]):
        tf=False
        element+=1
        break
print(str(element)*n)
import sys

args = sys.argv

result = int(int(args[2]) / int(args[1]))
if result > int(args[3]):
    result = int(args[3])
print(result)


### FIXED CODE ###

import sys


args = str(input()).split(" ")

result = int(int(args[1]) / int(args[0]))
if result > int(args[2]):
    result = int(args[2])
print(result)
N = int(input())
ac, wa, tle, re = 0, 0, 0, 0
for _ in range(10):
  S = int(input())
  if S == 'AC':
    ac+=1
  elif S == 'WA':
    wa+=1
  elif S == 'TLE':
    tle+=1
  elif S == 'RE':
    re+=1

print('AC x %d'%ac)
print('WA x %d'%wa)
print('TLE x %d'%tle)
print('RE x %d'%re)

### FIXED CODE ###

N = int(input())

ac, wa, tle, re = 0, 0, 0, 0

for i in range(N):
  S = input()
  if S=='AC':
    ac+=1
  elif S=='WA':
    wa+=1
  elif S=='TLE':
    tle+=1
  elif S=='RE':
    re+=1

print('AC x %d'%ac)
print('WA x %d'%wa)
print('TLE x %d'%tle)
print('RE x %d'%re)
import heapq
import sys
input = sys.stdin.readline


def dfs(v, visited, G):
    visited[v] = True
    for nv in G[v]:
        if visited[nv]==False:
            dfs(nv, visited, G)


def main():
    N, M = map(int, input().split())
    G = [[] for _ in range(N)]
    for _ in range(M):
        x, y, z = map(int, input().split())
        G[x-1].append(y-1)
        G[y-1].append(x-1)
    
    nodes = list(range(N))
    visited = [False]*N
    ans = 0
    while len(nodes)!=0:
        v = nodes.pop()
        if visited[v]==True:
            continue
        ans += 1
        dfs(v, visited, G)
        # print(visited)
        # print(nodes)
    
    print(ans)



if __name__ == '__main__':
    main()

### FIXED CODE ###

import heapq
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)


def dfs(v, visited, G):
    visited[v] = True
    for nv in G[v]:
        if visited[nv]==False:
            dfs(nv, visited, G)


def main():
    N, M = map(int, input().split())
    G = [[] for _ in range(N)]
    for _ in range(M):
        x, y, z = map(int, input().split())
        G[x-1].append(y-1)
        G[y-1].append(x-1)
    
    nodes = list(range(N))
    visited = [False]*N
    ans = 0
    while len(nodes)!=0:
        v = nodes.pop()
        if visited[v]==True:
            continue
        ans += 1
        dfs(v, visited, G)
        # print(visited)
        # print(nodes)
    
    print(ans)



if __name__ == '__main__':
    main()
a, b = map(str, input().split())

if a==str(H):
  print(b)
elif a==str(D):
  if b==str(H):
    print(D)
  elif b==str(D):
    print(H)

### FIXED CODE ###

a, b = map(str, input().split())

print('H' if a == b else 'D')
X,Y,A,B,C=map(int,input().split())
P=sorted(map(int,input().split()), reverse=True)[:X]
Q=sorted(map(int,input().split()), reverse=True)[:Y]
R=sorted(map(int,input().split()), reverse=True)[:X+Y]
i,j=X-1,Y-1
for r in R:
    if i==-1 and j==-1:
        break
    elif j==-1:
        if r>P[i]:
            p[i]=r
            i-=1
        else:
            break
    elif i==-1:
        if r>Q[j]:
            Q[j]=r
            j-=1
        else:
            break
    elif P[i]>Q[j]:
        if r>Q[j]:
            Q[j]=r
            j-=1
        else:
            break
    else:
        if r>P[i]:
            p[i]=r
            i-=1
        else:
            break
print(sum(P)+sum(Q))

### FIXED CODE ###

X,Y,A,B,C=map(int,input().split())
P=sorted(map(int,input().split()), reverse=True)[:X]
Q=sorted(map(int,input().split()), reverse=True)[:Y]
R=sorted(map(int,input().split()), reverse=True)[:X+Y]
i,j=X-1,Y-1
for r in R:
    if i==-1 and j==-1:
        break
    elif j==-1:
        if r>P[i]:
            P[i]=r
            i-=1
        else:
            break
    elif i==-1:
        if r>Q[j]:
            Q[j]=r
            j-=1
        else:
            break
    elif P[i]>Q[j]:
        if r>Q[j]:
            Q[j]=r
            j-=1
        else:
            break
    else:
        if r>P[i]:
            P[i]=r
            i-=1
        else:
            break
print(sum(P)+sum(Q))
n = int(input())
ans = [0 for i in range(1001)]
for x in range(1,100):
    for y in range(1,100):
        for z in range(1,100):
            if (x*x + y*y + z*z + x*y + x*z + y*z) <= 1000:
                ans[x*x + y*y + z*z + x*y + x*z + y*z] += 1
for i in range(1,n+1):
    print(ans[i])

### FIXED CODE ###

n = int(input())
ans = [0 for i in range(10001)]
for x in range(1,100):
    for y in range(1,100):
        for z in range(1,100):
            if x*x + y*y + z*z + x*y + x*z + y*z <= 10000:
                ans[x*x + y*y + z*z + x*y + x*z + y*z] += 1
            else:
              break
for i in range(1,n+1):
    print(ans[i])
n=int(input())
k=int(input())
xs=map(int,input().split(' '))
#A (0,i)
#B (K,i)
sum=0
for i in range(n):
  deltak=abs(xs[i]-k)
  if xs[i]<deltak:
    sum+=2*xs[i]
  else:
    sum+=deltak*2
print(sum)

### FIXED CODE ###

n=int(input())
k=int(input())
xs=list(map(int,input().split(' ')))
#A (0,i)
#B (K,i)
sum=0
for i in range(n):
  deltak=abs(xs[i]-k)
  if xs[i]<deltak:
    sum+=2*xs[i]
  else:
    sum+=deltak*2
print(sum)
h, w = map(int, input().split())
grid = []
for _ in range(h):
    grid.append(list(map(int, input().split())))
for i in range(h):
    l = list(map(int, input().split()))
    for j in range(w):
        grid[i][j] = abs(grid[i][j] - l[j])

biggest = max([max(i) for i in grid])
m = (h + w) * biggest

unba = [[[False for _ in range(m)] for _ in range(w)] for _ in range(h)]

# 0行目
unba[0][0][grid[0][0]] = True
for i in range(1, w):
    for j in range(m):
        if unba[0][i-1][j]:
            unba[0][i][grid[0][i] + j] = True
            unba[0][i][abs(grid[0][i] - j)] = True

# 1~h-1行目
for i in range(1, h):

    # i行0列
    for j in range(m):
        if unba[i-1][0][j]:
            unba[i][0][grid[i][0] + j] = True
            unba[i][0][abs(grid[i][0] - j)] = True

    # i行j列
    for j in range(1, w):
        for k in range(m):
            if unba[i-1][j][k] or unba[i][j-1][k]:
                unba[i][j][grid[i][j] + k] = True
                unba[i][j][abs(grid[i][j] - k)] = True

l = [i for i in range(m) if unba[h-1][w-1][i]]
print(min(l))

### FIXED CODE ###

def main():
    from sys import stdin
    def input():
        return stdin.readline().strip()

    h, w = map(int, input().split())
    g = []
    for _ in range(h):
        g.append(list(map(int, input().split())))
    for i in range(h):
        k = list(map(int, input().split()))
        for j in range(w):
            g[i][j] = abs(g[i][j] - k[j])

    m = (h + w) * 80

    if m == 0:
        print(0)
        exit()

    dp = [[False] * m for _ in range(w)]
    dp[0][g[0][0]] = True
    for j in range(1, w):
        for k in range(m):
            if dp[j-1][k]:
                dp[j][abs(k - g[0][j])] = True
                dp[j][k + g[0][j]] = True
    
    for i in range(1, h):
        new_dp = [[False] * m for _ in range(w)]
        for k in range(m):
            if dp[0][k]:
                new_dp[0][abs(k - g[i][0])] = True
                new_dp[0][k + g[i][0]] = True
        
        for j in range(1, w):
            for k in range(m):
                if new_dp[j-1][k] or dp[j][k]:
                    new_dp[j][abs(k - g[i][j])] = True
                    new_dp[j][k + g[i][j]] = True
        dp = new_dp

    for j in range(m):
        if dp[w-1][j]:
            print(j)
            break

main()
A, B = int(input())
if ( A < 6 ):
  result = 0
elif ( A < 13):
  result = B/2
else:
  result = B
  
print(result)

### FIXED CODE ###

A, B = map( int, input().split() )
if ( A < 6 ):
  result = 0
elif ( A < 13 ):
  result = B/2
else:
  result = B
  
print( int(result) )
n,a,b = map(int,input().split())	
if n*a=<b:
  print(int(n*a))
else:
  print(b)

### FIXED CODE ###

n,a,b = map(int,input().split())	
if n*a<=b:
  print(int(n*a))
else:
  print(b)
N, L = map(int, input().split())
S = [input() for i in range(N)]
print((''.join(S.sorted())))

### FIXED CODE ###

N, L = map(int, input().split())
S = [input() for i in range(N)]
S.sort()
String = ''.join(S)
print(String)
import functools  # Python3 
N,M = map(int,input().split())
x, y, z = [0] * N, [0] * N, [0] * N
for i in range(N):
	x[i], y[i], z[i] = map(int,input().split())

if M==0:
	print(0)
	exit()

ppp = functools.reduce(lambda x,y: x+y,sorted([ x[i]+y[i]+z[i] for i in range(N)])[-M:])
pmp = functools.reduce(lambda x,y: x+y,sorted([ x[i]-y[i]+z[i] for i in range(N)])[-M:])
ppm = functools.reduce(lambda x,y: x+y,sorted([ x[i]+y[i]-z[i] for i in range(N)])[-M:])
pmm = functools.reduce(lambda x,y: x+y,sorted([ x[i]-y[i]-z[i] for i in range(N)])[-M:])
mpp = functools.reduce(lambda x,y: x+y,sorted([-x[i]+y[i]+z[i] for i in range(N)])[-M:])
mpm = functools.reduce(lambda x,y: x+y,sorted([-x[i]+y[i]-z[i] for i in range(N)])[-M:])
mmp = functools.reduce(lambda x,y: x+y,sorted([-x[i]-y[i]+z[i] for i in range(N)])[-M:])
mmm = functools.reduce(lambda x,y: x+y,sorted([-x[i]-y[i]-z[i] for i in range(N)])[-M:])

MAX = 0
for lis in [ppp,pmp,ppm,pmm,mpp,mpm,mmp,mmm]:
	if lis  > MAX:
		MAX = lis
print(MAX)


### FIXED CODE ###

N,C = map(int,input().split())
D = []
for i in range(C):
    D.append(list(map(int,input().split())))
c = []
for i in range(N):
    c.append(list(map(int,input().split())))

import itertools
current_minimum = 1000 * 500 * 500 + 1
Z = []
Z.append([0]*C)
Z.append([0]*C)
Z.append([0]*C)
#print(Z)

for (i,j) in itertools.product(range(N),range(N)):
	cur_mod = ((i+1)+(j+1)) % 3
	cur_color = c[i][j]
	#print(cur_mod)
	#print(cur_color)
	Z[cur_mod][cur_color-1] += 1

current_minimum = 1000 * 500 * 500 + 1
for (c0,c1,c2) in itertools.permutations(range(C), 3):
	tmp = 0
	color = [c0,c1,c2]
	for cur_mod in range(3):
		target_color = color[cur_mod]
		for cur_color in range(C):
			tmp += Z[cur_mod][cur_color] * D[cur_color][target_color]
	if current_minimum >= tmp:
		current_minimum = tmp
print(current_minimum)
N, M, C = map(int, input().split())
B = [int(_) for _ in input().split()]
for i in range(1, N + 1):
    Ai = [int(_) for _ in input().split()]

right = 0

for j in range(1,N + 1):
  src = 0
  for k in range(M):
    src += Aj[k] * B[k]
  if src + C > 0:
    right += 1

print(right)


### FIXED CODE ###

N, M, C = map(int, input().split())
B = [int(_) for _ in input().split()]
A = []
for i in range(N):
    A.append([int(_) for _ in input().split()])

right = 0

for i in range(N):
    src = 0
    for j in range(M):
        src += A[i][j]*B[j]
    if src+C>0:
        right+=1

print(right)
import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np

rr = lambda: sys.stdin.readline().rstrip()
rs = lambda: sys.stdin.buffer.readline().split()
ri = lambda: int(sys.stdin.readline())
rm = lambda: map(int, sys.stdin.buffer.readline().split())
rl = lambda: list(map(int, sys.stdin.readline().split()))
inf = float('inf')
mod = 10**9 + 7

a, v = rm()
b, w = rm()
t = ri()
if abs(a-b) / (v-w) <= t:
  print('YES')
else:
  print('NO')



### FIXED CODE ###

import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np

rr = lambda: sys.stdin.readline().rstrip()
rs = lambda: sys.stdin.buffer.readline().split()
ri = lambda: int(sys.stdin.readline())
rm = lambda: map(int, sys.stdin.buffer.readline().split())
rl = lambda: list(map(int, sys.stdin.readline().split()))
inf = float('inf')
mod = 10**9 + 7

a, v = rm()
b, w = rm()
t = ri()
if v - w == 0:
  print('NO')
  exit()
if 0 <= abs(a-b) / (v-w) <= t:
  print('YES')
else:
  print('NO')
num=int(input())
for i in range (0,num):
	some=input(list1[])
    list1.append(some)
print(len(set(i for i in lst if i.isalpha())))

### FIXED CODE ###

list1=[]
num=int(input())
for i in range (0,num):
    list1.append(input())
print(len(set(i for i in list1 if i.isalpha())))
X,Y,Z = map(int,input().split())
 
print(Y Z X)

### FIXED CODE ###

X,Y,Z = map(int,input().split())
 
print('{} {} {} '.format(Z,X,Y))
a,b = map(int,input().split())
print(b,a)


### FIXED CODE ###

a,b,c=input().split(",")
print(a,b,c)
n = int(input())
a = list(map(int,input().split()))
b = a
#1 = plus
cp = 0
cm = 0
sumscp = 0
sumscm = 0

for i in range(len(a)):
    
    if i % 2 == 0:
        while sumscp + a[i] < 1:
            a[i] = a[i] + 1
            cp = cp + 1
        sumscp = sumscp + a[i]
    else:
        while sums + a[i] > -1:
            a[i] = a[i] - 1
            cp = cp + 1
        sumscp = sumscp + a[i]
        
for i in range(len(b)):
    
    if i % 2 == 0:
        while sumscp + b[i] > -1:
            b[i] = b[i] - 1
            cm = cm + 1
        sumscm = sumscm + b[i]
    else:
        while sums + a[i] < 1:
            b[i] = b[i] + 1
            cm = cm + 1
        sumscm = sumscm + b[i]
    
print(min(cp,cm))

### FIXED CODE ###

n = int(input())
a = list(map(int,input().split()))
sums = 0
count = 0
for i in range(n):
    sums = sums + a[i]
    if i % 2 ==0 :
        if sums > 0:
            None
        else:
            count = count + 1 -sums
            sums = 1
    else:
        if sums < 0:
            None
        else:
            count = count + 1 + sums
            sums = -1
            
count2 = 0
sums2 = 0
for i in range(n):
    sums2 = sums2 + a[i]
    if i % 2 ==1 :
        if sums2 > 0:
            None
        else:
            count2 = count2 + 1 -sums2
            sums2 = 1
    else:
        if sums2 < 0:
            None
        else:
            count2 = count2 + 1 + sums2
            sums2 = -1
            
print(min(count,count2))
# coding: utf-8

X = input()
A = input()

x = int(X)
a = int(A)

if x < a:
    print(0)

elif a <= x:
    print(10)

### FIXED CODE ###

c = input()
l = c.split()

x = int(l[0])
a = int(l[1])

if x < a:
    print(0)

elif a <= x:
    print(10)
a,b = input()
A = int(a)
B = int(b)
c=A*B
if c%2 == 0:
  print("Even")
else:
  print("Odd")


### FIXED CODE ###

a,b = input().split()
A = int(a)
B = int(b)
c=A*B
if c%2 == 0:
  print("Even")
else:
  print("Odd")
a,b,c = map(int, input().split())
k = int(input())

m = [[] for _ in range(7)]
m[0].append([a,b,c])

for i in range(k):
    for j in m[i]:
        m[i+1].append([j[0]*2, j[1],j[2]])
        m[i+1].append([j[0], j[1]* 2, j[2]])
        m[i+1].append([j[0], j[1], j[2]* 2])

ans = 'No'
for t in m[k]:
    if t[0] < t[1] and t[1]<t[2]:
        ans = 'Yes'
        break
    else:
        continue
print(ans)



### FIXED CODE ###

import sys

sys.setrecursionlimit(10**6)

a,b,c = map(int, input().split())
k = int(input())

m = [[] for _ in range(8)]
m[0].append([a,b,c])

for i in range(k):
    for j in m[i]:
        m[i+1].append([j[0]*2, j[1],j[2]])
        m[i+1].append([j[0], j[1]* 2, j[2]])
        m[i+1].append([j[0], j[1], j[2]* 2])

ans = 'No'

for t in m[k]:
    if t[0] < t[1] and t[1] < t[2]:
        ans = 'Yes'
        break
print(ans)
|AB| * |BC| / 2

### FIXED CODE ###

ab, bc, ca = map(int, input().split())

print(int(ab*bc/2))
x = [map(str, input().split())]
y = [map(str, input().split())]
z = [map(str, input().split())]

print(''.join([x[0], y[1], z[2]]))

### FIXED CODE ###

x = str(input())
y = str(input())
z = str(input())
 
s = [x[0], y[1], z[2]]

print(''.join(s))
a,b,c = map(raw_input().split())
d,e,f = map(raw_input().split())
if a==f and b==e and c==d:
	print 'YES'
else:
	print 'NO'

### FIXED CODE ###

a = raw_input()
b = raw_input()
if a[0]==b[2] and a[1]==b[1] and a[2]==b[0]:
	print 'YES' 
else:
	print 'NO'
s=input()
x=[0 for _ in range(26)]
if len(s)<26:
    for i in range(len(s)):
        x[ord(s[i])-ord('a')]=1
    for j in range(len(s)):
        if x[j]==0:
            k=j
            break
    print("".join([s,chr(ord('a')+k)]))
elif s=="zyxwvutsrqponmlkjihgfedcba":
    print(-1)
else:
    mi=-1
    for i in range(1,26):
        if s[i]<s[i-1]:
            x[i]=1
            if mi==-1:
                mi=i
    tx=s[mi-1::]
    mx=min(list(tx))
    print(s[:mi-2]+mx)

### FIXED CODE ###

s=input()
x=[0 for _ in range(26)]
if len(s)<26:
    for i in range(len(s)):
        x[ord(s[i])-ord('a')]=1
    for j in range(26):
        if x[j]==0:
            k=j
            break
    print("".join([s,chr(ord('a')+k)]))
elif s=="zyxwvutsrqponmlkjihgfedcba":
    print(-1)
else:
    for i in range(2,27):
        if s[-i]<s[-i+1]:
            break
    for j in sorted(s[-i+1:]):
        if j>s[-i]:
            break
    print(s[:-i]+j)