Harryxun/stf_run huggingface dataset:
s = input()
if s == "SUN":
    print("7")
elif S == "MON":
    print("6")
elif S == "TUE":
    print("5")
elif S == "WED":
    print("4")
elif S == "THU":
    print("3")
elif S == "FRI":
    print("2")
elif S == "SAT":
    print("1")

### FIXED CODE ###

s = input()
if s == "SUN":
    print("7")
elif s == "MON":
    print("6")
elif s == "TUE":
    print("5")
elif s == "WED":
    print("4")
elif s == "THU":
    print("3")
elif s == "FRI":
    print("2")
elif s == "SAT":
    print("1")
import math

N = int(input())

ans = []
for i in range(1, round(math.sqrt(N))):
    if N % i == 0:
        tmp = max(len(str(i)), len(str(N//i)))
        ans.append(tmp)

print(min(ans))

### FIXED CODE ###

N = int(input())

ans = []
for i in range(1, int(N**0.5)+1):
    if N % i == 0:
        ans.append(i)
        ans.append(int(N/i))

if N == 1:
    print("1")
else:
    print(len(str(ans[-1])))
a=int(input())
b=int(input())
x=[1,2,3]
x.remove(a)
x.remove(b)
return(*x)


### FIXED CODE ###

x='123'
for _ in range(2): 
  x=x.replace(input(),'')
print(x)
import collections

n = int(input());
S = [];

for i in range(n):
  S.append(input());

c = collections.Counter(S)
dic2 = sorted(dic.items())

num = c.most_common()[0][1];
ans = [];

for a,b in c.most_common():
    if b == num:
      ans.append(a);
      continue;
    
    else:
      break;

dic2 = sorted(ans);

for i in ans:
  print(i);

### FIXED CODE ###

import collections

n = int(input());
S = [];

for i in range(n):
  S.append(input());

c = collections.Counter(S)

num = c.most_common()[0][1];
ans = [];

for a,b in c.most_common():
    if b == num:
      ans.append(a);
      continue;
    
    else:
      break;

ans = sorted(ans);

for i in ans:
  print(i);
from collections import deque
import sys
input = sys.stdin.readline
h,w=map(int, input().split(' '))
a = [list(input()) for i in range(h)]
q = deque()
for i in range(h):
    for j in range(w):
        if a[i][j] == "#":
            a[i][j]=0
            q.append([i,j,0])
        else:
            a[i][j]=-1
while q:
    [s,t,cnt] = q.popleft()
    if s>0 and a[s-1][t] == -1:
        q.append([s-1,t,cnt+1])
        a[s-1][t] = cnt+1
    if s<h-1 and a[s+1][t] == -1:
        q.append([s+1,t,cnt+1])
        a[s+1][t] = cnt+1
    if t>0 and a[s][t-1] == -1:
        q.append([s,t-1,cnt+1])
        a[s][t-1] = cnt+1
    if t<w-1 and a[s][t+1] == -1:
        q.append([s,t+1,cnt+1])
        a[s][t+1] = cnt+1
ans = 0
for i in range(h):
    ans = max(ans,max(a[i]))
print(ans)


### FIXED CODE ###

from collections import deque
import sys
input = sys.stdin.readline
h,w=map(int, input().split(' '))
a = [input() for i in range(h)]
nl = [[] for i in range(h)]
q = deque()
for i in range(h):
    for j in range(w):
        if a[i][j] == "#":
            nl[i].append(0)
            q.append([i,j,0])
        else:
            nl[i].append(-1)
while q:
    [s,t,cnt] = q.popleft()
    if s>0 and nl[s-1][t] == -1:
        q.append([s-1,t,cnt+1])
        nl[s-1][t] = cnt+1
    if s<h-1 and nl[s+1][t] == -1:
        q.append([s+1,t,cnt+1])
        nl[s+1][t] = cnt+1
    if t>0 and nl[s][t-1] == -1:
        q.append([s,t-1,cnt+1])
        nl[s][t-1] = cnt+1
    if t<w-1 and nl[s][t+1] == -1:
        q.append([s,t+1,cnt+1])
        nl[s][t+1] = cnt+1
ans = 0
for i in range(h):
    ans = max(ans,max(nl[i]))
print(ans)
def dfs(tree,node,x,ans):
    ans[node-1]+=x
    if node in tree:
        for i in tree[node]:
            dfs(tree,i,x,ans)


n,q = map(int, input().split())
tree = {}
for i in range(n-1):
    a,b = map(int,input().split())
    if not(a in tree):
        tree[a] = [b]
    else:
        tree[a].append(b)

ans = [0]*n
for i in range(q):
    p,x = map(int,input().split())
    dfs(tree,p,x,ans)

print(*ans)


### FIXED CODE ###

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

def dfs(v,p):
    for i in tree[v]:
        if i==p:
            continue
        res[i]+=res[v]
        dfs(i,v)

n,q = map(int, input().split())
tree = [[] for _ in range(n)]
for i in range(n-1):
    a,b = map(int,input().split())
    tree[a-1].append(b-1)
    tree[b-1].append(a-1)

res = [0]*n
for i in range(q):
    p,x = map(int,input().split())
    res[p-1] += x

dfs(0,-1)
print(*res)
N, M = map(int, input().split())
AB = [list(map(int, input().split())) for _ in range(N)]

AB.sort()
B = [[] for _ in range(M + 2)]
i = 1
j = 0
while i <= M:
  while j < N or AB[j][0] <= i:
    B[i].append(AB[j][1])
    j += 1
  B[i] = B[i - 1].copy()
  i += 1

ans = 0
for i in range(1, M + 1):
  if len(B[i]) > 0:
    m = max(B[i])
    ans += m
    for j in range(i, M + 1):
      if len(B[j]) > 0:
        B[j].remove(m)

print(ans)

### FIXED CODE ###

from heapq import heappush, heappop

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

for i in range(N):
  ab = list(map(int, input().split()))
  #Ai > M の仕事はいらない
  if ab[0] <= M:
    jobs[ab[0] - 1].append(ab[1])

#最終日はAi=1の仕事のみ選べる。その前の日はAi<=2, ...
#終わりから考えればよさそう
hq = []
ans = 0
for i in range(M):
  for b in jobs[i]:
    heappush(hq, -1 * b)
  if len(hq) > 0:
    m = -1 * heappop(hq)
    ans += m

print(ans)
# -*- coding: utf-8

while True:
   a = list(map(int,input().split()))
   if a == [0,0]:
      break
   if a[1] % 2 == 0:
      b1 = "#."*int(a[1]/2)
      b2 = ".#"*int(a[1]/2)
   if a[1] % 2 == 1:
      b1 = "#."*int((a[1]-1)/2)+"#"
      b2 = ".#"*int((a[1]-1)/2)+"."
   
   if a[0] %2 == 0:
      for i in range(a[0]/2):
         print(b1)
         print(b2)
   if a[0] %2 == 1:
      for i in range((a[0]-1)/2):
         print(b1)
         print(b2)
      print(b1)
   print("")



### FIXED CODE ###

# -*- coding: utf-8

while True:
   a = list(map(int,input().split()))
   if a == [0,0]:
      break
   if a[1] % 2 == 0:
      b1 = "#."*int(a[1]/2)
      b2 = ".#"*int(a[1]/2)
   if a[1] % 2 == 1:
      b1 = "#."*int((a[1]-1)/2)+"#"
      b2 = ".#"*int((a[1]-1)/2)+"."
   
   if a[0] %2 == 0:
      for i in range(int(a[0]/2)):
         print(b1)
         print(b2)
   if a[0] %2 == 1:
      for i in range(int((a[0]-1)/2)):
         print(b1)
         print(b2)
      print(b1)
   print("")
n, a, b = map(int, input().split())

if n == 1:
    if a == b:
        print(1)
    else:
        print(0)
else:
    if a > b:
        print(0)
    else:
        print((b-a)(n-2)+1)        


### FIXED CODE ###

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

if n == 1:
    if a == b:
        print(1)
    else:
        print(0)
else:
    if a > b:
        print(0)
    else:
        print((b-a)*(n-2)+1)
# coding: utf-8 
N,T = [int(i) for i in input().split(" ")]
array = input().split(" ")
ans = 0
fin = 0
for x in array:
    time = int(x)
    if time <= fin:
        ans += (time + T - fin)
    else:
        ans += T
    fin = time + T
print(ans)

### FIXED CODE ###

# coding: utf-8 
array = input().split(" ")
flag = True
for i,s in enumerate(array[:(len(array)-1)]):
    if s[-1] != array[i+1][0]:
        flag = False
if flag is True:
    print("YES")
else:
    print("NO")
N = int(input())
S = input()

count = 0
for i in range(0, N - 1):
    if S[i] == 'A':
        if S[i+1] == 'B':
            if S[i+2] == 'C':
                count += 1

print(count)

### FIXED CODE ###

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

count = 0
for i in range(0, N - 2):
    if S[i] == 'A':
        if S[i+1] == 'B':
            if S[i+2] == 'C':
                count += 1

print(count)
T=list(input())
Q=[i for i, x in enumerate(T) if x == '?']

for i in Q:
    if i==0:
        if T[i+1]=="D" or T[i+1]=="?":
            T[i]="P"
        else:
            T[i]="D"
    elif i==len(T)-1:
        T[i]="D"
    else:
        if T[i-1]=="P":
            T[i]="D"
        elif T[i+1]=="D" or T[i+1]=="?":
            T[i]="P"
        else:
            T[i]="D"
print("".join(map(str, T)))

### FIXED CODE ###

import sys
T=list(input())
Q=[i for i, x in enumerate(T) if x == '?']

if len(T)==1:
    print("D")
    sys.exit(0)

for i in Q:
    if i==0:
        if T[i+1]=="D" or T[i+1]=="?":
            T[i]="P"
        else:
            T[i]="D"
    elif i==len(T)-1:
        T[i]="D"
    else:
        if T[i-1]=="P":
            T[i]="D"
        elif T[i+1]=="D" or T[i+1]=="?":
            T[i]="P"
        else:
            T[i]="D"
print("".join(map(str, T)))
def main(a, b):
    if (a * b) % 2 == 0:
        print('Even')
    else:
        print(Odd)

a = int(input())
b = int(input())
main(a, b)

### FIXED CODE ###

a, b = map(int, input().split())
if a*b % 2 == 0:
    print("Even")
else:
    print("Odd")
import sys
input = sys.stdin.readline
n, m = map(int, input().split())
graph = [[] for _ in range(n)]
for i in range(m):
    x, y = map(int, input().split())
    graph[x - 1].append(y - 1)

dp = [-1] * n
def count(a):
    if dp[a] != -1:
        return dp[a]
    else:
        dp[a] = 0
        for i in graph[a]:
            dp[a] = max(count(i) + 1, dp[a])
        return dp[a]

print(max([count(i) for i in range(n)]))


### FIXED CODE ###

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

n, m = map(int, input().split())
graph = [[] for _ in range(n)]
for i in range(m):
    x, y = map(int, input().split())
    graph[x - 1].append(y - 1)

dp = [-1] * n
def count(a):
    if dp[a] != -1:
        return dp[a]
    else:
        dp[a] = 0
        for i in graph[a]:
            dp[a] = max(count(i) + 1, dp[a])
        return dp[a]

print(max([count(i) for i in range(n)]))
from fractions import gcd

def lcm(a):
    from fractions import gcd
    x = a[0]
    for i in range(1, len(a)):
        x = (x * a[i]) // gcd(x, a[i])
    return x

n=int(input())
a=list(map(int, input().split()))
A=lcm(a)
ans=0

for i in a:
    ans+=A/i

print(int(ans%(10**9+7)))


### FIXED CODE ###

from fractions import gcd

n=int(input())
a=list(map(int, input().split()))
mod=10**9+7
l=1
ans=0

for i in a:
    l=l*i//gcd(l,i)

for i in a:
    ans+=l//i

print(ans%mod)
D=int(input("Enter a number in the range of 0 and 10000: "))
T=int(input("Enter a number in the range of 0 and 10000: "))
S=int(input("Enter a number in the range of 0 and 10000: "))
def DontBeLate(D,T,S):
    
    if (D and T) and S <=10000 and D/S==T:
        print("Yes")
    else:
        print("No")
(DontBeLate(D,T,S))


### FIXED CODE ###

D,T,S= [int(x) for x in input().split()]
if 1<=(D and T)<=10000 and (1<=S<=10000 and D/S<=T):
    print("Yes")
else:
    print("No")
import numpy
n = int(input())
# for i in range(n):
#     m = int(input())
#     k = k*m
# op = 1
p = list(map(int,input().split()))
# for i in p:
#     op = op*i
op = numpy.prod(p)
if op > 10**18:
    print(-1)
else:
    print(op)

### FIXED CODE ###

a,b = map(int,input().split())
print(a*b)
k=int(input())
a,b=map(int,input().split())
flg=False
for i in range(a,b+1):
  if i % k = 0:
    flg=True
    break
if flg:
  print('OK')
else:
  print('NG')
    

### FIXED CODE ###

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

flg = False
for i in range(A,B+1):
  if i % K == 0:
    flg = True

if flg :
  print("OK")
else:
  print("NG")
a=lst(input())
b=input()
i=0
for j in b:
	a[i:i]=j
    i+=1
print(*a)

### FIXED CODE ###

a=input()
b=input()
d=zip(a,b)
e="".join(i[0]+i[1] for i in d)
if len(a)==len(b):
	print(e)
elif len(a)>len(b):
  	print(e+a[-1])
elif len(a)<len(b):
  	print(e+b[-1])
def Solve(acts,first,second,third,index):
    if index == len(acts):
        return 0
    
    if first:
        val1 =  acts[index][0]+Solve(acts,False,True,True,index+1)
    else:
        val1 = 0
    if second:
        val2 = acts[index][1]+Solve(acts,True,False,True,index+1)
    else:
        val2 = 0
    if third:
        val3 =  acts[index][2]+Solve(acts,True,True,False,index+1)
    else:
        val3 = 0

    return max(val1,val2,val3)

def main():
    n = int(input())
    acts = []
    for i in range(n):
        a,b,c = map(int,input().split())
        acts.append((a,b,c))

##    dp = [[0 for x in range(3)] for y in range(n)]
##    dp[0][0] = acts[0][0]
##    dp[0][1] = acts[0][1]
##    dp[0][2] = acts[0][2]
##
##    for i in range(1,n):
##        dp[i][0] = dp[i-1][0]+max(acts[i][1],acts[i][2])
##        dp[i][1] = dp[i-1][1]+max(acts[i][0],acts[i][2])
##        dp[i][2] = dp[i-1][2]+max(acts[i][0],acts[i][1])

    #print(max(dp[-1]))
    #print(dp)

    print(Solve(acts,True,True,True,0))

main()


### FIXED CODE ###

def main():
    n = int(input())
    dp = [[0 for i in range(3)] for j in range(n)]

    for i in range(n):
        a,b,c = map(int,input().split())
        if i == 0:
            dp[i][0] = a
            dp[i][1] = b
            dp[i][2] = c
        else:
            dp[i][0] = max(dp[i-1][1],dp[i-1][2])+a
            dp[i][1] = max(dp[i-1][0],dp[i-1][2])+b
            dp[i][2] = max(dp[i-1][0],dp[i-1][1])+c


    print(max(dp[-1]))


main()
nums = [0, 2, 5, 5, 4, 5, 6, 3, 7, 6]
N, M = map(int, input().split())
A = list(map(int, input().split()))

# 使うマッチ棒の本数が等しい場合は大きい数だけ考えれば良い
A.sort(reverse=True)
s = set()
candidates = [] # [a, nums[a]]
for a in A:
  if nums[a] in s:
    continue
  s.add(nums[a])
  candidates.append([a, nums[a]])


dp = [-1] * (N+1)
dp[0] = 0
for i in range(N+1):
  for a, n in candidates:
    if i >= n and dp[i-n]>=0:
      dp[i] = max(dp[i], dp[i-n]+1)

ans = ''
idx = N
digit = dp[N]
while digit:
  for a, n in candidates:
    if dp[idx-n] == dp[idx]-1:
      ans += str(a)
      digit -= 1
      idx -= n
      break

print(int(ans))

### FIXED CODE ###

nums = [0, 2, 5, 5, 4, 5, 6, 3, 7, 6]
N, M = map(int, input().split())
A = list(map(int, input().split()))

# 使うマッチ棒の本数が等しい場合は大きい数だけ考えれば良い
A.sort(reverse=True)
s = set()
candidates = [] # [a, nums[a]]
for a in A:
  if nums[a] in s:
    continue
  s.add(nums[a])
  candidates.append([a, nums[a]])


dp1 = [0] * (N+1)
dp2 = [-1] * (N+1)
d = {}
for a, n in candidates:
  if n <= N:
    dp1[n] = 1
    dp2[n] = 0
    d[n] = a

for i in range(N+1):
  for a, n in candidates:
    if i >= n and dp1[i-n]:
      if dp1[i] < dp1[i-n] + 1:
        dp1[i] = dp1[i-n] + 1
        dp2[i] = i-n

ans = []
idx = N
while idx:
  next_idx = dp2[idx]
  ans.append(d[idx - next_idx])
  idx = next_idx

ans.sort(reverse=True)
print(''.join(list(map(str, ans))))
m,k = map(int,input().split())
if m == 1:
    if k == 0:
        print(0,0,1,1)
    else:
        print(-1)
elif 2**m <= k:
    print(-1)
else:
    remain = set(range(2**m))
    use = set()
    count = 0
    while k:
        if k & 1:
            remain.remove(2**count)
            use.add(2**count)
        k >>= 1
        count += 1
ans = []
remain = list(remain)
use = list(use)
for i in remain:
    ans.append(str(i))
for i in use:
    ans.append(str(i))
for i in remain[::-1]:
    ans.append(str(i))
for i in use[::-1]:
    ans.append(str(i))
print(" ".join(ans))

### FIXED CODE ###

m,k = map(int,input().split())
if m == 1:
    if k == 0:
        print(0,0,1,1)
    else:
        print(-1)
elif 2**m <= k:
    print(-1)
else:
    remain = set(range(2**m))
    use = set()
    count = 0
    while k:
        if k & 1:
            remain.remove(2**count)
            use.add(2**count)
        k >>= 1
        count += 1
    ans = []
    remain = list(remain)
    use = list(use)
    for i in remain:
        ans.append(str(i))
    for i in use:
        ans.append(str(i))
    for i in remain[::-1]:
        ans.append(str(i))
    for i in use[::-1]:
        ans.append(str(i))
    print(" ".join(ans))
s=input()
print(len(s)-s[::-1].index("z")-s.index("A"))

### FIXED CODE ###

s=input()
print(len(s)-s[::-1].index("Z")-s.index("A"))
from collections import deque
n,m = map(int,input().split())
g = [[] for _ in range(n)]
for i in range(m):
    a, b = map(int,input().split())
    g[a-1].append(b-1)
    g[b-1].append(a-1)

checked = [False]*n
q = deque([])
cnt = 0

#連結成分のカウント

for i in range(n):
    if checked[i]:
        continue
    checked[i] = True
    q.append(i)
    while q:
        v = q.pop()
        s = g[v]
        for j in s:
            if checked[j]:
                continue
            checked[j] = True
            q.append(j)
    cnt += 1

print(cnt - 1

### FIXED CODE ###

from collections import deque
n,m = map(int,input().split())
g = [[] for _ in range(n)]
for i in range(m):
    a, b = map(int,input().split())
    g[a-1].append(b-1)
    g[b-1].append(a-1)

dist = [-1]*n
q = deque([])
cnt = 0

#連結成分のカウント

for i in range(n):
    if dist[i] != -1:
        continue
    dist[i] = 0
    q.append(i)
    while q:
        v = q.pop()
        s = g[v]
        for j in s:
            if dist[j] != -1:
                continue
            dist[j] = 0
            q.append(j)
    cnt += 1

print(cnt - 1)
import sys
sys.setrecursionlimit(10000)

N = int(input())
H = [int(h) for h in input().split()]
cost = [0]*N

def dp(i):
  if i == 0:
    return 0
  elif i == 1:
    return abs(H[i-1] - H[i])
  else:
    return min(
      dp(i-1) + abs(H[i-1] - H[i]), 
      dp(i-2) + abs(H[i-2] - H[i]))
  
print(dp(N-1))

### FIXED CODE ###

import sys
#from functools import lru_cache
sys.setrecursionlimit(100000)

N = int(input())
H = [int(h) for h in input().split()]
INF = 10**5+1
cost = [INF]*N
cost[0] = 0
cost[1] = abs(H[0] - H[1])

#@lru_cache(maxsize=None)
def dp(i):
  if cost[i] != INF:
    return cost[i]
  else:
    cost[i] = min(
      dp(i-1) + abs(H[i-1] - H[i]),
      dp(i-2) + abs(H[i-2] - H[i]))
  return cost[i]

for i in range(N-1):
  dp(i)
print(dp(N-1))
result = True
for i in range(n):
    # except the last case, 前よりも自分が高ければ下がる
    if (i != (n-1)):
        if(h[i] > h[i+1]): 
            h[i] -= 1
    # except the 1st case, 後ろよりも自分が高ければ下がる
    elif (i != 0):
        if(h[i] > h[i-1]): 
            h[i] -= 1
    # 後ろよりも自分が低ければアウト
    if (i != 0):
        if(h[i] < h[i-1]):
            result = False
            break

if result:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

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

result = True
for i in range(n):
    if n == 1:
        break
    
    pos = ""
    if (i == 0):
        if (h[i] > h[i+1]):
            h[i] -= 1
    elif (i == (n-1)):
        if (h[i] > h[i-1]):
            h[i] -= 1
    else:
        if (h[i] > h[i+1]) | (h[i] > h[i-1]):
            h[i] -= 1
    
    if (i != 0):
        if(h[i] < h[i-1]):
            result = False
            break

            
if result:
    print("Yes")
else:
    print("No")
x,a = map(int,input())

print('0') if x<a else print('10')

### FIXED CODE ###

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

print('0') if x<a else print('10')
print("Yes" if len(set(input())))==3 else "No")

### FIXED CODE ###

print("Yes" if len(set(input()))==3 else "No")
N=int(input())
M=int(input())

X=sorted([int(i) for i in input().split()])

Y=list()
before=X[0]
for i in X:
  diff = i - before
  if diff == 0:
    continue
  Y.append(diff)
  before = i

Y=sorted(Y)

print(sum(Y[:-(N-1)]))



### FIXED CODE ###

N,M = map(int,input().split())
X=sorted([int(i) for i in input().split()])

Y=list()
for i in range(M)[1:]:
  diff = X[i]-X[i-1]
  Y.append(diff)

Y=sorted(Y)

if N==1:
  print(sum(Y))
else:
  print(sum(Y[:-(N-1)]))
n, m, l = map(int, input().split())
a = []
b = []
for i in range(n):
    a.append(list(map(int, input().split())))
for j in range(m):
    b.append(list(map(int, input().split())))

c = [[0 for k in range(l)] for i in range(n)]
for i in range(n):
    for k in range(l):
        for j in range(m):
            c[i][k] += int(a[i][j]*b[j][k] )
 for i in range(n):
    print(c[i])


### FIXED CODE ###

n, m, l = map(int, input().split())
a = [list(map(int, input().split())) for i in range(n)]
b = [list(map(int, input().split())) for j in range(m)]
[print(*x) for x in [[sum(j*k for j, k in zip(x, y)) for y in zip(*b)] for x in a]]
n = int(input())
s = input()

min_num = 
for i in range(n):
    min_num = min(s[:i].count("W") + s[i+1:].count("E"), min_num)
print(min_num)

### FIXED CODE ###

n = int(input())
s = input()

min_num = 300000
w_west = 0
e_east = s.count("E")
for s_i in s:
    if s_i == "E":
        e_east -= 1
    else:
        w_west += 1
    tmp = w_west + e_east - bool(s_i == "W")
    if tmp < min_num:
        min_num = tmp
print(min_num)
#!/usr/bin/env python3

k = int(input())

keta = 3

ans_c = []
sunuke = []
for i in range(1, 10**keta):  # 1~999
    a = i
    b = sum([int(j) for j in str(i)])
    tmp_sunuke = a/b
    ans_c.append(a)
    sunuke.append(tmp_sunuke)

base = 10
nines = 9
while(len(ans_c) <= 100000):
    for i in range(10**(keta-1), 10**keta):  # 1000~999
        a = i*base+nines
        b = sum([int(j) for j in str(i)])
        tmp_sunuke = a/b
        ans_c.append(a)
        sunuke.append(tmp_sunuke)
    base *= 10
    nines = nines*10 + 9
    # print(len(ans_c))

# print(ans_c)

tmp = 10**10
ans = []
for i in reversed(range(len(ans_c))):
    if sunuke[i] <= tmp:
        tmp = sunuke[i]
        ans.append(ans_c[i])
# print(ans)


for i in range(0, k):
    print(ans[-1-i])


### FIXED CODE ###

#!/usr/bin/env python3

k = int(input())

now = 1
step = 1


def sunuke(n):
    r = 0
    while n:
        r += n % 10
        n //= 10
    return r


def ok(a, b):
    return a * sunuke(b) <= b*sunuke(a)


while k:
    if ok(now, now+step):
        print(now)
        k -= 1
        now += step
    else:
        nstep = step*10
        while now % nstep != nstep-1:
            now += step
        step = nstep
n, m = map(int, input().split())
graph = [[] for _ in range(n)]
dp = [-1 for _ in range(n)]

for _ in range(m):
    x, y = map(int, input().split())
    graph[x-1].append(y-1)


def dfs(s):
    #print(s, dp)
    if dp[s] != -1:
        return dp[s]
    
    rep = 0
    for g in graph[s]:
        rep = max(rep, dfs(g)+1)
    dp[s] = rep
    return rep

#print(graph)
ans = 0
for i in range(n):
    #print('i:', i)
    ans = max(ans, dfs(i))

print(ans)

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**9)

n, m = map(int, input().split())
graph = [[] for _ in range(n)]
dp = [-1 for _ in range(n)]

for _ in range(m):
    x, y = map(int, input().split())
    graph[x-1].append(y-1)


def dfs(s):
    #print(s, dp)
    if dp[s] != -1:
        return dp[s]
    
    rep = 0
    for g in graph[s]:
        rep = max(rep, dfs(g)+1)
    dp[s] = rep
    return rep

#print(graph)
ans = 0
for i in range(n):
    #print('i:', i)
    ans = max(ans, dfs(i))

print(ans)
text = raw_input()
count = {} #a~zの出現回数を記録

for i in range(26):
    count[(i)] = 0
    
for i in range(len(text)):
    if(ord(text[i]) >= ord('a') and ord(text[i]) <= ord('z')):
        count[(ord(text[i]))-ord('a')] += 1

#出現回数の表示
for i in range(26):
    print '%s : %d' %(unichr(i+ord('a')), count[(i)])
print

### FIXED CODE ###

count = {}
for i in range(26):
    count[(i)] = 0

while True:
    try:
        x = raw_input()
    except:
        break
    for i in range(len(x)):
        if(ord('a') <= ord(x[i]) and ord(x[i]) <= ord('z')):
            count[(ord(x[i])-ord('a'))] += 1
        elif(ord('A') <= ord(x[i]) and ord(x[i]) <= ord('Z')):
            count[(ord(x[i])-ord('A'))] += 1

for i in range(26):
    print '%s : %d' %(chr(i+ord('a')), count[(i)])
exit(0)
import math
 
A,B,H,M=map(int,input().split(" "))
 
hour=[A*math.cos(math.radians(H*30+M/2)),A*math.sin(math.radians(H*30+M/2))]
minute =[B*math.cos(math.radians(M*6)),B*math.sin(math.radians(M*6))]
if (hour[0]>=0 and minute[0]>=0) or (hour[0]<0 and minute[0]<0):
    a=minute[0]-hour[0]
else:
    a=abs(minute[0])+abs(hour[0])
    
if (hour[1]>=0 and minute[1]>=0) or (hour[1]<0 and minute[1]<0):
    b=minute[1]-hour[1]
else:
    b=abs(minute[1])+abs(hour[1])    
print('{:.16f}'.format(math.sqrt(pow(a,2)+pow(b,2))))

### FIXED CODE ###

N = int(input())

if N%10==2 or N%10==4 or N%10==5 or N%10==7 or N%10==9:
    print('hon')
elif N%10==0 or N%10==1 or N%10==6 or N%10==8:
    print('pon')
else:
    print('bon')
a,b=int(input().split())
if a*(a+1)*b==0:
  print('Zero')
if a*(a+1)*b<0:
  print('Negative')
if a*(a+1)*b>0:
  print('Positive')

### FIXED CODE ###

a,b=map(int,input().split())
if b < 0:
    if (b-a+1) % 2 == 0:
        ans = 'Positive'
    elif (b-a+1) % 2 == 1:
        ans = 'Negative'
elif a > 0:
 ans='Positive'
else:
 ans='Zero'
  
print(ans)
in_pred = input()
in_real = input()

i = 0
for a in in_pred:
  for b in in_real:
    if a == b:
      i += 1
      
return i


### FIXED CODE ###

a = input()
b = input()

c = 0

for i in range(3):
  if a[i] == b[i]:
    c += 1
      
print(c)