Harryxun/stf_run huggingface dataset:
n=int(input())
s='abcdefghij'
bottom=[[] for i in range(10)]
bottom[0]=['a']

def solve(n):
    num=0
    while num<=n:
        num=num+1
        for base in bottom[num-1]:
            for i in s[:num+1]:
                if ord(i)-ord(base[-1])>1:continue
                bottom[num].append(base+i)

solve(n-1)
print(*bottom[n-1],sep='\n')

### FIXED CODE ###

n=int(input())
s='abcdefghijklmnopqrstuvwxyz'
bottom=[[] for i in range(10)]
bottom[0]=['a']

def solve(n):
    num=0
    while num<n:
        num=num+1
        for base in bottom[num-1]:
            for i in s[:num+1]:
                if i!='a' and chr(ord(i)-1) not in base:break
                bottom[num].append(base+i)

solve(n-1)
#print(*bottom[n-2])
print(*bottom[n-1],sep='\n')
x=input()
if x%1000:
  print('x')
else 
  x=1000-x
  print('x')

### FIXED CODE ###

x=int(input())
if x%1000==0:
   print(0)
else :
  x=1000-x%1000
  print(x)
w, h, x, y = map(int, input().split())

s = w * h / 2
if (int(w / x) == 2) and (int(h / y) == 2):
    print(s, 1)
else:
    print(s, 0)

### FIXED CODE ###

x, a = map(int, input().split())

if x < a:
    print(0)
else:
    print(10)
# 2019-11-23 21:00:35(JST)
import sys

def main():
    m = int(sys.stdin.readline().rstrip())

    s = ''
    for i in range(m):
        d, c = sys.stdin.readline().split()
        c = int(c)
        s += d * c

    count = 0
    while int(s) >= 10:
        s = str(int(s[0]) + int(s[1])) + s[2:]
        count += 1
    
    print(count)




if __name__ == '__main__':
    main()


### FIXED CODE ###

# 2019-11-23 21:00:35(JST)
import sys
import collections
import math

def main():
    m = int(sys.stdin.readline().rstrip())

    a = collections.defaultdict(int)
    for _ in range(m):
        d, c = map(int, sys.stdin.readline().split())
        a[d] += c
    

    b = 0
    for i in range(10):
        b += (i + 9) * a[i]
    
    ans = math.ceil((b - 9)/ 9) - 1
    print(ans)
    
if __name__ == '__main__':
    main()
n, W = map(int, input().split())
MAX_V = 10**5
dp = [10**18]*(MAX_V+1)
dp[0] = 0
tmp_dp = [0]*(MAX_V+1)
for _ in range(n):
    w, v = map(int, input().split())
    for sum_v in range(MAX_V+1):
        if sum_v >= v:
            tmp_dp[sum_v] = min(dp[sum_v], dp[sum_v - v] + w)
        else:
            tmp_dp[sum_v] = min(dp[sum_v], w)
    dp = tmp_dp
    tmp_dp = [0]*(MAX_V+1)

ans = 0
while dp[ans+1] <= W:
    ans +=1
print(ans)

### FIXED CODE ###

N, W = map(int, input().split())
MAX_V = 10**5+1
dp = [float('inf')] * MAX_V
dp[0] = 0
for _ in range(N):
    w, v = map(int, input().split())
    for sum_v in range(MAX_V)[::-1]:
        if sum_v >= v:
            dp[sum_v] = min(dp[sum_v - v] + w, dp[sum_v])
        else:
            dp[sum_v] = min(dp[sum_v], w)
ans = 0
for v in range(MAX_V)[:: -1]:
    if dp[v] <= W:
        ans = v
        break
print(ans)
a=list(input())
b=list(input())
c=list(input())
cur='a'
while True:
    if cur=='a':
        if len(a)==0:
            print('a')
            break
        else:
            cur=a.pop()
    elif cur=='b':
        if len(b)==:
            print('b')
            break
        else:
            cur=b.pop()
    else:
        if len(c)==0:
            print('c')
            break
        else:
            cur=c.pop()
            
           
        

### FIXED CODE ###

a=list(input())
b=list(input())
c=list(input())
cur='a'
ai=-1
bi=-1
ci=-1
while ai<len(a) and bi<len(b) and ci<len(c):
    if cur=='a':
        ai+=1
        if ai<len(a):
            cur=a[ai]
    elif cur=='b':
        bi+=1
        if bi<len(b):
            cur=b[bi]
    else:
        ci+=1
        if ci<len(c):
            cur=c[ci]
if ai==len(a):
    print('A')
elif bi==len(b):
    print('B')
else:
    print('C')
N = int(input())
S = list(input())

a = S[0]
res= 0

for i in range(1, N-2):
    if a == S[i]:
        b = S[i]
        for j in range(j, N-1):
            if i == j:
                continue
            c = S[j]
            if a!=b and b!= c and a!=c:
                res +=1

print(res)

### FIXED CODE ###

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

cntOne = S.count('R') * S.count('G') * S.count('B')
cntTwo = 0


for i in range(N-1):
    for j in range(i+1, N):
        k = (j - i) + j
        if k < N:
            if S[i] != S[j] and S[j] != S[k] and S[k] != S[i]:
                cntTwo += 1
print(cntOne - cntTwo)
S = input().split(' ')
A = S[0]
B = S[1]
C = S[2]
K = S[3]

if K <= A:
  print(K)
elif K-A <= B:
  print(K)
else:
  print(K-C)

### FIXED CODE ###

S = list(map(int,input().split()))
A = S[0]
B = S[1]
C = S[2]
K = S[3]

if K <= A:
  print(K)
elif K <= A+B:
  print(A)
else:
  print(A-(K-A-B))
a, b, k = map(int,input().split())

for i in range k:
  if a > 0:
    a = a - 1
  elif b > 0
  	b = b - 1

print(a, b)

### FIXED CODE ###

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

if a >= k:
    a = a - k
else:
    b = b - k + a
    a = 0
    if b < 0:
        b = 0

print(a, b)
d,g=map(int,input().split())
p=[]
c=[]
count=0
for i in range(d):
    pi,ci=map(int,input().split())
    p.append(pi)
    c.append(ci)
e=[]
for i in range(d):
    x=p[i]*(i+1)*100+c[i]
    y=x/p[i]
    e.append([y,x,i,p[i]])
e.sort(reverse=True)
for i in range(d):
    if g>=e[0][1]:
        count+=p[e[0][2]]
        g=g-e[0][1]
        aa=e.pop(0)
        #print(aa)
    else:
        break
e.sort(key=lambda x:x[3],reverse=True)
print(count+g//((e[0][2]+1)*100))

### FIXED CODE ###

import sys
import math
d,g=map(int,input().split())
p=[]
c=[]
s=[]
count=0
for i in range(d):
    pi,ci=map(int,input().split())
    p.append(pi)
    c.append(ci)
    s.append((i+1)*100*pi+ci)

l=2**d
count=10**6*d
for i in range(l):
    buf=g
    x=0
    n=0
    for j in range(d):
        if i & 1 ==1:
            x+=p[j]
            buf-=s[j]
        else:
            n=j
        i=i>>1
    if buf>=0:
        y=math.ceil(buf/((n+1)*100))
        if y>p[n]:
            continue
        x=x+y
    count=min(count,x)
print(count)
ihlkn


### FIXED CODE ###

x = int(input())
print (x*x*x)
s = input()
ans = 0
for x in s:
  ans += int(x)
if ans%9 == 0:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

n, x, t = map(int, input().split())
a = n//x
if n%x != 0:
  a += 1
print(t*a)
n, k = map(int,input().split())
al = list(map(int,input().split()))
dics = {}

for i in range(n):
    if al[i] in dics:
        dics[al[i]] = dics[al[i]] + 1
    else:
        dics.update({al[i]:1})
        
counts = len(dics.values())
kesu = 0
sortv = list(sorted(dics.values()))

#while len(sortv) > k:
#    kesu = kesu + sortv[0]
#    sortv.remove(sortv[0])

if len(sortv) > k:
    for i in range(n-k+1):
        kesu = kesu + sortv[i]
print(kesu)

### FIXED CODE ###

n, k = map(int,input().split())
al = list(map(int,input().split()))
dics = {}
 
for i in range(n):
    if al[i] in dics:
        dics[al[i]] = dics[al[i]] + 1
    else:
        dics.update({al[i]:1})
        
counts = len(dics.values())
kesu = 0
sortv = list(sorted(list((dics.values()))))

i = counts
j = 0
while i > k:
    kesu = kesu + sortv[j]
    i = i - 1
    j = j + 1
print(kesu)
def resolve():
    def is_prime(n):
        if n == 1:
            return False

        for k in range(2, int(math.sqrt(n)) + 1):
            if n % k == 0:
                return False

        return True
    X = int(input())

    while True:
        if is_prime(X):
            print(X)
            return
        else:
            X += 1

    return
  
  
resolve()

### FIXED CODE ###

import math
def resolve():
    def is_prime(n):
        if n == 1:
            return False
 
        for k in range(2, int(math.sqrt(n)) + 1):
            if n % k == 0:
                return False
 
        return True
    X = int(input())
 
    while True:
        if is_prime(X):
            print(X)
            return
        else:
            X += 1
 
    return
 
resolve()
[a,b,c] = map(int,intput().split())

print({True: 'Yes', False: 'No'}[a < b < c])
  

### FIXED CODE ###

def lessthen (a, b):
    return a < b
    
def range (a, b, c):
    return lessthen(a, b) and lessthen(b, c)

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

if range(a, b, c):
    print('Yes')
else:
    print('No')
from collections import defaultdict

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

relation_dict = {}
for person1, person2 in friend_info:
    add_flag = False
    for k, v in relation_dict.items():
        if((person1 in v) or (person2 in v)):
            relation_dict[k].add(person1)
            relation_dict[k].add(person2)
            add_flag = True
            break
    if(add_flag == False):
        new_key = str(len(relation_dict)+1)
        relation_dict[new_key] = {person1, person2}

max_group = max([len(relation) for relation in relation_dict.values()])
print(max_group)

### FIXED CODE ###

D, T, S = map(int, input().split())
if S * T >= D:
    print("Yes")
else:
    print("No")
from collections import defaultdict
from copy import deepcopy

from bisect import bisect_left as bl

N,M=map(int,input().split())
n=N
A=list(map(int,input().split()))
dic={1:2,2:5,3:5,4:4,5:5,6:6,7:3,8:7,9:6}
dict=defaultdict(int)
list=[]
L=[]
for key in range(9,0,-1):
    if key in A:
        if dic[key] in dict.values():
            continue
        dict[key]=dic[key]
        list.append([key,dic[key]])
        L.append(key)
list.sort(key=lambda x:x[1])
cost=[]
for i in list:
    cost.append(i[1])
num=len(dict.keys())

dp=[[-1 for i in range(num+1)] for j in range(N+1)]
dp[0]=[0]*(num+1)
#dp[i] N=iでの最大値
Non=[-1]*(num+1)
for i in range(N):
    ini=[]
    for j in range(num):
        if i+1-cost[j]>=0 and dp[i+1-cost[j]]!=Non:
            a=dp[i+1-cost[j]][:]
            a[j+1]+=1
            a[0]+=1
            ini.append(a)
    if ini:
        dp[i+1]=max(ini)
s=""
s1=""
Num=N
Keys=dic.keys()
Keys.reverse()
for i in range(dp[N][0]):
    for k in Keys:
        if Num-dic[k]>=0 and dp[Num][0]-1==dp[Num-dic[k]][0]:
            s1+=str(k)
            Num-=dic[k]
            break
print(s1)


### FIXED CODE ###

from collections import defaultdict
from copy import deepcopy

from bisect import bisect_left as bl

N,M=map(int,input().split())
n=N
A=list(map(int,input().split()))
dic={1:2,2:5,3:5,4:4,5:5,6:6,7:3,8:7,9:6}
dict=defaultdict(int)
list=[]
L=[]
for key in range(9,0,-1):
    if key in A:
        if dic[key] in dict.values():
            continue
        dict[key]=dic[key]
        list.append([key,dic[key]])
        L.append(key)
list.sort(key=lambda x:x[0],reverse=True)
cost=[]
for i in list:
    cost.append(i[1])
num=len(dict.keys())

dp=[[-1 for i in range(num+1)] for j in range(N+1)]
dp[0]=[0]*(num+1)
#dp[i] N=iでの最大値
Non=[-1]*(num+1)
for i in range(N):
    ini=[]
    for j in range(num):
        if i+1-cost[j]>=0 and dp[i+1-cost[j]]!=Non:
            a=dp[i+1-cost[j]][:]
            a[j+1]+=1
            a[0]+=1
            ini.append(a)
    if ini:
        dp[i+1]=max(ini)
s=""


for l in L:
    for i in range(num):
        key,cost=list[i]
        if l==key:
            s+=str(key)*dp[N][i+1]

print(s)
N = int(input())
A = [int(input()) for i in range(N)]
A.sort()
leftA = A[:N//2+N%2]
rightA = A[N//2+N%2:]
rightA.sort(reverse=True)
tmp = leftA[0]
leftA[0] = leftA[1]
leftA[1] = tmp
ans = 0
if len(leftA) == len(rightA):
    for i in range(N//2):
        if i == 0:
            ans += abs(leftA[i] - rightA[i])
            lastA = rightA[i]
            continue
        ans += abs(lastA - leftA[i])
        if i == N//2-1:
            ans += max(abs(leftA[i] - rightA[i]), abs(leftA[0] - rightA[i]))
            continue
        ans += abs(leftA[i] - rightA[i])
        lastA = rightA[i]
else:
    for i in range(N//2+1):
        if i == 0:
            ans += abs(leftA[i] - rightA[i])
            lastA = rightA[i]
            continue
        ans += abs(lastA - leftA[i])
        if i == N//2:
            continue
        ans += abs(leftA[i] - rightA[i])
        lastA = rightA[i]
    ans2 = 0
    tmp = leftA.pop(-1)
    rightA.insert(0, tmp)
    for i in range(N//2):
        if i == 0:
            ans2 += abs(leftA[i] - rightA[i])
            lastA = rightA[i]
            continue
        ans2 += abs(lastA - leftA[i])
        lastA = rightA[i]
    ans2 += abs(rightA[-2] - rightA[-1])
    ans = max(ans, ans2)

print(ans)


### FIXED CODE ###

N = int(input())
A = [int(input()) for i in range(N)]
A = sorted(A)
h = N // 2
if N % 2 == 0:
    ans = sum(A[h:])*2 - sum(A[:h])*2 - A[h] + A[h-1]
else:
    ans1 = sum(A[h-1:])*2 - sum(A[:h-1])*2 - (A[h-1] + A[h]) * 3
    ans2 = sum(A[h:])*2 - sum(A[:h])*2 - (A[h] + A[h+1])
    ans = max(ans1, ans2)
print(ans)
n, k = map(int, input().split())
num_list = [int(i) for i in input().split()]

ans_list = []

for i in range(n - 1):
    for j in range(i + 1, n):
        ans_list.append(num_list[i] * num_list[j])

ans_list.sort()

print(ans_list[k])

### FIXED CODE ###

import numpy as np

n, k = map(int, input().split())
num_list = [int(i) for i in input().split()]
num_list = np.array(num_list)
num_list.sort()

neg = num_list[num_list < 0]
pos = num_list[num_list > 0]
zero =  num_list[num_list == 0]

def count(x):
    ans = 0
    if x >= 0:
        ans += len(zero) * n
    ans += np.searchsorted(num_list, x // pos, side="right").sum()
    ans += n * len(neg) - np.searchsorted(num_list, -(-x // neg), side="left").sum()
    ans -= np.count_nonzero(num_list * num_list <= x)
    return ans // 2

left = -(10 ** 18)
right = 10 ** 18

while left + 1 < right:
    mid = (left + right) // 2
    if count(mid) >= k:
        right = mid
    else:
        left = mid

print(right)
a,p='apple','peach'
t={a:p,p:a}
print(*[t[w]if 5==len(w)and if w in t else t[w[:5]]+w[5:]if w[:5]in t else w for w in input().split()])


### FIXED CODE ###

a,p,t='apple','peach','_'
print(input().replace(a,t).replace(p,a).replace(t,p))
s = input()
if len(s)>3:
  print(-1)
else:
  print(eval(s.replce(" ", "*")))

### FIXED CODE ###

s = input()
if len(s) > 3:
  print(-1)
else:
  print(eval(s.replace(" ", "*")))
N,M=map(int,input().split())
A=[list(map(int,input().split())) for _ in range(M)]
 
ans=[0]
for a in A:
    ans[a[0]-1]+=1
    ans[a[1]-1]+=1
 
for a in ans:
    print(a)

### FIXED CODE ###

N,M =map(int,input().split())
c = []
for i in range(M):
    a,b = map(int,input().split())
    c.append(a)
    c.append(b)
for j in range(N):
    print(c.count(j+1))
n=int(input())
a=list(map(int,input().split()))
a.sort()
amax = a[-1]
isok = [True]*(amax+1)
ans = 0

for i in range(n):
    x = a[i]
    if isok[x]:
        if i == 0 and a[i] != a[i+1]:
            ans += 1
        elif i == n-1 and a[i] != a[i-1]:
            ans += 1
        elif a[i] != a[i+1] and a[i] != a[i-1]:
            ans += 1
        orix = x
        while x<=amax:
            isok[x]=False
            x+=orix
print(ans)


### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
a.sort()
amax = a[-1]
isok = [True]*(amax+1)
ans = 0
if n == 1:
    print(1)
    exit()
for i in range(n):
    x = a[i]
    if isok[x]:
        if i == 0 and a[i] != a[i+1]:
            ans += 1
        elif i == n-1 and a[i] != a[i-1]:
            ans += 1
        elif a[i] != a[i+1] and a[i] != a[i-1]:
            ans += 1
        orix = x
        while x<=amax:
            isok[x]=False
            x+=orix
print(ans)
import sys #追加
sys.setrecursionlimit(500*500) #追加

def resolve():
    N, M, K = map(int, input().split())
    A = list(map(int, input().split()))
    B = list(map(int, input().split()))

    def dfs(n, i, j, d, k):
        if k >= K or (i == N and j == M):
            return n
        if d == 1 and i < N and k + A[i] <= K:
            k += A[i]
            l = dfs(n + 1, i + 1, j, d, k)
            r = dfs(n + 1, i + 1, j, -d, k)
            return max(l, r)
        elif d == -1 and j < M and k + B[j] <= K:
            k += B[j]
            l = dfs(n + 1, i, j + 1, d, k)
            r = dfs(n + 1, i, j + 1, -d, k)
            return max(l, r)
        else:
            return n

    print(dfs(0, 0, 0, 1, 0))

resolve()


### FIXED CODE ###

def resolve():
    import numpy as np

    N, M, K = map(int, input().split())
    A = list(map(int, input().split()))
    B = list(map(int, input().split()))

    A = np.insert(np.cumsum(A), 0, 0)
    B = np.insert(np.cumsum(B), 0, 0)

    ans = 0
    j = M
    for i in range(N + 1):
        if A[i] > K:
            break
        while A[i] + B[j] > K:
            j -= 1

        ans = max(ans, i + j)

    print(ans)

resolve()
#template
def inputlist(): return [int(k) for k in input().split()]
#template

N,M = inputlist()
li = []
for i in range(N):
    A,B = inputlist()
    B *= -1
    li.append([A,B])
ans = 0
from heapq import *
li.sort()
k = []
heapify(k)
flag = 0
for i in range(1,M+1):
    if flag == N:
        for t in range(M+1-i):
            ans -= heappop(k)
		break
    while li[flag][0] <= i:
        heappush(k,li[flag][1])
        flag = flag + 1
        if flag == N:
            break
    if len(k)>=1:
        ans -= heappop(k)
print(ans)


### FIXED CODE ###

#template
def inputlist(): return [int(k) for k in input().split()]
#template

N,M = inputlist()
li = []
for i in range(N):
    A,B = inputlist()
    B *= -1
    li.append([A,B])
ans = 0
from heapq import *
li.sort()
k = []
heapify(k)
flag = 0
for i in range(1,M+1):
    if flag == N:
        for i in range(M+1-i):
            ans -= heappop(k)
        break
    while li[flag][0] <= i:
        heappush(k,li[flag][1])
        flag = flag + 1
        if flag == N:
            break
    if len(k)>=1:
        ans -= heappop(k)
print(ans)
S = input()

K = int(input()) - 1

for i in range(K):
  if not S[i] == '1':
    print(S[i])
    exit()
else:
  print(S[i])


### FIXED CODE ###

S = input()

K = int(input())

for i in range(K):
  if not S[i] == '1':
    print(S[i])
    exit()
else:
  print('1')
import copy

n = int(input())
t = list(map(int, input().split()))
sum_t = sum(t)


m = int(input())
for _ in range(m):
    idx, value = map(int, input().split())
    print(sum_t - t[idx - 1] + value)



### FIXED CODE ###

a, op, b = input().split()

print(eval(a + op + b))
s = input(); a = []; b = [0]*27; t = ""
for i in range(len(s)): a.append(ord(s[i])); b[a[i]-97] = 1
if s == "zyxwvutsrqponmlkjihgfedcba": print(-1)
else:
    for i in range(27):
        if b[i] == 0: c = i; break
    if c != 26:
        a.append(c+97)
        for i in range(len(a)): t += chr(a[i])
        print(t)
    else:
        d = []
        for _ in range(24):
            if a[-2] > a[-1]: d.append(a.pop())
            else:
                d.append(a.pop()); a.pop(); d.sort()
                break
        else: d.append(a.pop()); a.pop(); d.sort()
        for i in range(len(d)):
            if a[-1] < d[i]: a.append(d[i]); break
        for i in range(len(a)): t += chr(a[i])
        print(t)

### FIXED CODE ###

s = input(); a = []; b = [0]*27; t = ""
for i in range(len(s)): a.append(ord(s[i])); b[a[i]-97] = 1
if s == "zyxwvutsrqponmlkjihgfedcba": print(-1)
else:
    for i in range(27):
        if b[i] == 0: c = i; break
    if c != 26:
        a.append(c+97)
        for i in range(len(a)): t += chr(a[i])
        print(t)
    else:
        d = []
        for _ in range(24):
            if a[-2] > a[-1]: d.append(a.pop())
            else:
                d.append(a.pop()); d.sort()
                break
        else: d.append(a.pop()); d.sort()
        for i in range(len(d)):
            if a[-1] < d[i]: a.pop(); a.append(d[i]); break
        for i in range(len(a)): t += chr(a[i])
        print(t)
import sys
sys.setrecursionlimit(100001)

n, m = map(int, input().split())
edges = [[] for _ in range(n)]
visited = [False] * n
for _ in range(m):
    a, b = map(int, input().split())
    la = len(edges[a - 1])
    lb = len(edges[a - 1])
    edges[a - 1].append([b - 1, lb])
    edges[b - 1].append([a - 1, la])

def dfs(p, v):
    if visited[v]:
        return
    visited[v] = True
    for (i, r) in edges[v]:
        if i != p and r != -1:
            dfs(v, i)
    count = 0
    pr = -1
    for (i, r) in edges[v]:
        if i != p and r != -1:
            print(v + 1, i + 1)
            edges[i][r][1] = -1
            count += 1
        if i == p:
            pr = r
    if count % 2 == 1:
        print(v + 1, p + 1)
        edges[p][pr][1] = -1

if m % 2 == 1:
    print(-1)
else:
    dfs(-1, 0)


### FIXED CODE ###

import sys
sys.setrecursionlimit(100001)

n, m = map(int, input().split())
edges = [[] for _ in range(n)]
visited = [False] * n
for _ in range(m):
    a, b = map(int, input().split())
    la = len(edges[a - 1])
    lb = len(edges[b - 1])
    edges[a - 1].append([b - 1, lb])
    edges[b - 1].append([a - 1, la])

def dfs(p, v):
    visited[v] = True
    for (i, r) in edges[v]:
        if not visited[i] and r != -1 and i != p:
            dfs(v, i)
    odd = False
    pr = -1
    for (i, r) in edges[v]:
        if i != p:
            if r != -1:
                edges[i][r][1] = -1
                odd = not odd
        else:
            pr = r
    if odd:
        edges[p][pr][1] = -1

if m % 2 == 1:
    print(-1)
else:
    dfs(-1, 0)
    for v in range(n):
        for (i, r) in edges[v]:
            if r >= 0:
                print(v + 1, i + 1)
import sys
n,m = map(int,input().split())
sc = [list(map(int,input().split())) for i in range(m)]

l = [0 for i in range(n)]
set_sc = [[] for i in range(n)]

for i in range(m):
    set_sc[sc[i][0]-1].append(sc[i][1])

for i in range(len(set_sc)):
    if len(set(set_sc[i])) > 1:
        print(-1)
        sys.exit()

if set_sc[0][0] == 0:
    print(-1)
    sys.exit()

for i in range(len(set_sc)):
    if len(set_sc[i]) == 0:
        continue
    l[i] = set_sc[i][0]

l = list(map(str,l))
print(''.join(l))

### FIXED CODE ###

import sys
n,m = map(int,input().split())
sc = [list(map(int,input().split())) for i in range(m)]

for i in range(10**n):
    s = str(i)
    if len(s) != n:
        continue
    c = 0
    for i in range(m):
        if n >= 2:
            if sc[i] == [1,0]:
                print(-1)
                sys.exit()
            
        if s[sc[i][0]-1] == str(sc[i][1]):
            c += 1
    
    if c == m:
        print(s)
        sys.exit()

print(-1)
N,K,Q=map(int,input().split())
L=[K-Q]*N
for j in range(N):
  A=int(input())
  L[A]+=1
for i in L:
  if i>0:
    print("Yes")
  else:
    print("No")

### FIXED CODE ###

N,K,Q=map(int,input().split()) #Nは人の人数、Kはみなが最初に持っているポイント、Qはクイズの回数
L=[K-Q]*N #
for i in range(Q):
    m=int(input())-1
    L[m]+=1
for k in range(N):
    if L[k]>0:
        print("Yes")
    else:
        print("No")
import sys
def get_unique_list(seq):
    seen = []
    return [x for x in seq if x not in seen and not seen.append(x)]

n,m  = map(int,input().split())
l = [list(map(int,input().split())) for _ in range(m)]
d = {}
for i in l:
    if i[0] in d and d[i[0]] != i[0]:
        d[i[0]] += 1
        print("-1")
        sys.exit()
    else:
        d[i[0]] =i[1]

#ここまでが同一桁に複数の数字が指定されていた時の処理

l = get_unique_list(l) #重複削除
l.sort() #ソート
d = 0
if l[0][1]==0 and l[0][0]==1: #1桁目が0
    if n ==1: #1桁指定の時
        print("0")
        sys.exit()
    else:
        print("-1")
        sys.exit()
        
if l[0][0]!=1: #1桁目に指定がない
    d = 10**(n-1)
    for i in l:
        d += int(i[1])*10**(n-int(i[0]))
        
else:
    for i in l:
        d += i[1]*10**(n-i[0])    

print(d)

### FIXED CODE ###

import sys
def get_unique_list(seq):
    seen = []
    return [x for x in seq if x not in seen and not seen.append(x)]

n,m  = map(int,input().split())
l = [list(map(int,input().split())) for _ in range(m)]
d = {}
if m == 0 and n != 1:
    print(10**(n-1))
    sys.exit()
if m == 0 and n == 1:
    print("0")
    sys.exit()
    
for i in l:
    if i[0] in d and  i[1] !=d[i[0]]:
        d[i[0]] += 1
        print("-1")
        sys.exit()
    else:
        d[i[0]] =i[1]
#ここまでが同一桁に複数の数字が指定されていた時の処理

l = get_unique_list(l) #重複削除
l.sort() #ソート
d = 0
if l[0][1]==0 and l[0][0]==1: #1桁目が0
    if n ==1: #1桁指定の時
        print("0")
        sys.exit()
    else:
        print("-1")
        sys.exit()
        
if l[0][0]!=1: #1桁目に指定がない
    d = 10**(n-1)
    for i in l:
        d += i[1]*10**(n-i[0])
        
else:
    for i in l:
        d += i[1]*10**(n-i[0])    

print(d)