CodeEff/ECCO huggingface dataset:
# Original solution
K=int(eval(input()))
a=K
while a%2==0:
    a//=2
while a%5==0:
    a//=5
if a==1:
    print((1))
else:
    mod=set([])
    a=1
    while a not in mod:
        mod.add(a)
        a*=10
        a%=K

    mod=list(mod)
    n=len(mod)
    check=1
    table=[0 for i in range(0,n)]
    for i in range(1,46):
        for j in range(0,n):
            table[j]=(check<<mod[j])|check
        ans=0
        for j in range(0,n):
            ans=ans|table[j]
        check=ans
        for j in range(1,46):
            if (check>>j*K)&1==1:
                print(i)
                exit()

# Optimized solution
K=int(eval(input()))
a=K
while a%2==0:
    a//=2
while a%5==0:
    a//=5
if a==1:
    print((1))
else:
    mod=set([])
    a=1
    while a not in mod:
        mod.add(a)
        a*=10
        a%=K

    mod=list(mod)
    n=len(mod)
    wei=pow(2,K)-1
    check=1
    ans=0
    for j in range(0,n):
        ans=ans|(check<<mod[j])
    check=ans
    for i in range(1,46):
        if check>>0 &1==1:
            print(i)
            exit()
        ans=check
        for j in range(0,n):
            ans=ans|(check<<mod[j])
        ans1=ans&wei
        ans2=ans>>K
        check=ans1|ans2
# Original solution
import heapq
K=int(eval(input()))
G=[[(1,(i+1)%K)] for i in range(K)]
for i in range(K):
    a=(i*10)%K
    G[i].append((0,a))
stack=list(G[1])
heapq.heapify(stack)
reached=[0]*K
reached[1]=1
while(stack):
    c,g=heapq.heappop(stack)
    if g==0:
        print((c+1))
        quit()
    reached[g]=1
    for i in G[g]:
        if reached[i[1]]:
            continue
        heapq.heappush(stack,(c+i[0],i[1]))


# Optimized solution
import heapq
K=int(eval(input()))
G=[[((i+1)%K,1)] for i in range(K)]
for i in range(K):
    a=(i*10)%K
    G[i].append((a,0))
def dijkstra(G,s):#Gはi->jの辺をG[i]=[(j,cost),...]で保存
  INF=10**19
  n=len(G)
  d=[INF]*n#n=node数
  d[s]=0
  visited={s}
  que=[(0,s)]
  while(que):
    p=heapq.heappop(que)
    v=p[1]
    visited.add(v)
    for node,cost in G[v]:
      if (node not in visited) and d[node]>d[v]+cost:
        d[node]=d[v]+cost
        heapq.heappush(que,(d[node],node))
  return d

d=dijkstra(G,1)
print((d[0]+1))
# Original solution
k=int(eval(input()))
lst = [k+1]*k
queue = [1]
lst[1] = 1
while queue:
    a = queue.pop(0)
    if lst[a*10%k] > lst[a]:
        lst[a*10%k] = lst[a]
        queue.insert(0,a*10%k)
    if lst[(a+1)%k]>= lst[a]+1:
        lst[(a+1)%k] = lst[a]+1
        queue.append((a+1)%k)
print((lst[0]))

# Optimized solution
import collections
k=int(eval(input()))
lst = [k+1]*k
q = collections.deque([1])
lst[1] = 1
while q:
    a = q.pop()
    if lst[a*10%k] > lst[a]:
        lst[a*10%k] = lst[a]
        q.append(a*10%k)
    if lst[(a+1)%k]>= lst[a]+1:
        lst[(a+1)%k] = lst[a]+1
        q.appendleft((a+1)%k)
print((lst[0]))
# Original solution
from datetime import datetime
K = int(eval(input()))
start = datetime.now()
def KSum(n):
    k = 0
    for i in str(n):
        k += int(i)
    return k

m = KSum(K)
j = 1
while((datetime.now()-start).total_seconds()<1.9):
    P = KSum(K*j)
    if m > P:
        m = P
    j += 1

print(m)


# Optimized solution
from collections import deque
K=int(eval(input()))
reached=[0 for i in range(K)]
reached[1]=1
dist=[0 for i in range(K)]
q=deque([])
q.append(1)
while(len(q)>0):
    r=q.popleft()
    v=(r+1)%K
    reached[r]=1
    if (reached[v]==0):
        q.append(v)
        dist[v]=dist[r]+1
    v=(r*10)%K
    if (reached[v]==0):
        q.appendleft(v)
        dist[v]=dist[r]
    if (reached[0]==1):
        break
print((dist[0]+1))
# Original solution
import heapq
K=int(eval(input()))
dist=[10**15 for i in range(K)]
dist[1]=1
q=[]
heapq.heappush(q,(0,1))
while (len(q)!=0):
    prc,src=heapq.heappop(q)
    if dist[src]<prc:
        continue
    if dist[(src+1)%K]>dist[src]+1:
        dist[(src+1)%K]=dist[src]+1
        heapq.heappush(q,(dist[(src+1)%K],(src+1)%K))
    if dist[(10*src)%K]>dist[src]:
        dist[(10*src)%K]=dist[src]
        heapq.heappush(q,(dist[(src*10)%K],(src*10)%K))
print((dist[0]))


# Optimized solution
from collections import deque
K=int(eval(input()))
dist=[10**15 for i in range(K)]
dist[1]=1
q=deque([1])
while(len(q)>0):
    r=q.popleft()
    s=(r+1)%K
    if dist[r]+1<dist[s]:
        dist[s]=dist[r]+1
        q.append(s)
    t=(r*10)%K
    if dist[r]<dist[t]:
        dist[t]=dist[r]
        q.appendleft(t)
print((dist[0]))
# Original solution
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from heapq import heappush, heappop
INF = float("inf")


def main():
    K = int(eval(input()))
    graph = defaultdict(list)
    for i in range(K):
        graph[i].append((1, (i + 1) % K))
        graph[i].append((0, (i * 10) % K))

    cost = [INF] * K
    cost[1] = 1
    que = deque()
    que.appendleft(1)
    while len(que) != 0:
        now = que.popleft()

        for c, node in graph[now]:
            new_cost = cost[now] + c
            if new_cost < cost[node]:
                cost[node] = new_cost
                if c == 0:
                    que.appendleft(node)
                else:
                    que.append(node)

    print((cost[0]))


if __name__ == '__main__':
    main()


# Optimized solution
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from heapq import heappop, heappush
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def ceil(a, b):
    return (a + b - 1) // b


def main():
    K = int(eval(input()))
    dp = [INF] * K
    dp[1] = 1

    heap = []
    heappush(heap, (1, 1))

    while len(heap) != 0:
        k, p = heappop(heap)
        if dp[(p + 1) % K] > dp[p] + 1:
            dp[(p + 1) % K] = dp[p] + 1
            heappush(heap, (dp[p] + 1, (p + 1) % K))
        if dp[(p * 10) % K] > dp[p]:
            dp[(p * 10) % K] = dp[p]
            heappush(heap, (dp[p], (p * 10) % K))

        if dp[0] != INF:
            break

    print((dp[0]))


if __name__ == '__main__':
    main()
# Original solution
k=int(eval(input()))
c=float("inf")
for i in range(10**5,10**6+1):
    c=min(c,sum([int(d) for d in str(k*i)]))
print(c)    

# Optimized solution
from collections import deque
k=int(eval(input()))
t=[1]*k
q=deque()
q.append((1,1))
while q:
    p,r=q.popleft()
    if p==0:
        print(r)
        break
    if t[p]:
        t[p]=0
        q.appendleft(((p*10)%k,r))
        q.append(((p+1)%k,r+1))
# Original solution
import sys
stdin = sys.stdin
 
sys.setrecursionlimit(10**5) 
 
def li(): return list(map(int, stdin.readline().split()))
def li_(): return [int(x)-1 for x in stdin.readline().split()]
def lf(): return list(map(float, stdin.readline().split()))
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

from collections import deque

k = ni()
que = deque([(1,1)])

kmod = [0]*k

while kmod[0] == 0:
    cost, cur = que.popleft()
    if kmod[cur%k] == 0:
        kmod[cur%k] = cost
        que.appendleft((cost, 10*cur))
        que.append((cost+1, cur+1))            
        
print((kmod[0]))

# Optimized solution
import sys
stdin = sys.stdin
 
sys.setrecursionlimit(10**5) 
 
def li(): return list(map(int, stdin.readline().split()))
def li_(): return [int(x)-1 for x in stdin.readline().split()]
def lf(): return list(map(float, stdin.readline().split()))
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

from collections import deque

k = ni()
que = deque([(1,1)])

kmod = [0]*k

while kmod[0] == 0:
    cost, idx = que.popleft()
    if kmod[idx] == 0:
        kmod[idx] = cost
        que.appendleft((cost, (10*idx%k)))
        que.append((cost+1, (idx+1)%k))            
        
print((kmod[0]))
# Original solution
from collections import deque
#q = deque()
q= []
m = {}
K = int(eval(input()))
q.append((1,1))
while len(q):
  #n,s = q.popleft()
  n,s = q.pop(0)
  if n in m:
    continue
  m[n] = s
  #q.appendleft((n*10%K,s))
  q.insert(0,(n*10%K,s))
  #q.append(((n+1)%K,s+1))
  q.append(((n+1)%K,s+1))
print((m[0]))

# Optimized solution
from collections import deque
q = deque()
ans = {}
K = int(eval(input()))
q.append((1,1))
while len(q):
  resid,total = q.popleft()
  if resid in ans:
    continue
  ans[resid] = total
  q.appendleft((resid*10%K,total))
  q.append(((resid+1)%K,total+1))
print((ans[0]))
# Original solution
from collections import deque

k=int(eval(input()))
v=list(range(k))
stack=deque([1])
inf=float('inf')
visited=[0]*k
dist=[inf]*k
dist[1]=0
while stack:
  v=stack.pop()
  if not visited[v]:
    nv0=10*v%k
    nv1=(v+1)%k
    if dist[nv0]>dist[v]:
      dist[nv0]=dist[v]
      stack.append(nv0)
    if dist[nv1]>1+dist[v]:
      stack.appendleft(nv1)
      dist[nv1]=dist[v]+1
    visited[v]=1
print((dist[0]+1))

# Optimized solution
import sys
from collections import deque
readline=sys.stdin.readline

def main():
    k=int(readline())
    v=list(range(k))
    inf=float('inf')
    dist=[inf]*k
    visited=[0]*k
    stack=deque([1])
    dist[1]=0
    while stack:
        v=stack.pop()
        if not visited[v]:
            nv0=10*v%k
            nv1=(v+1)%k
            if dist[nv0]>dist[v]:
                dist[nv0]=dist[v]
                stack.append(nv0)
            if dist[nv1]>dist[v]+1:
                dist[nv1]=dist[v]+1
                stack.appendleft(nv1)
            visited[v]=1
    print((dist[0]+1))

if __name__=='__main__':
    main()
# Original solution
from heapq import heappush, heappop
k = int(eval(input()))

heap = [(1,1)]
dist = [float("inf")]*k
while heap:
    cost, cur = heappop(heap)
    if dist[cur] <= cost:
        continue
    dist[cur] = cost
    # +1
    nxt = (cur+1)%k
    heappush(heap, (cost+1, nxt))
    # *10
    nxt = cur*10 % k
    heappush(heap, (cost, nxt))

print((dist[0]))

# Optimized solution
from collections import deque
k = int(eval(input()))

que = deque()
que.append((1,1))
dist = [float("inf")]*k
while que:
    cost, cur = que.popleft()
    if dist[cur] <= cost:
        continue
    dist[cur] = cost
    # +1
    nxt = (cur+1)%k
    que.append((cost+1,nxt))
    # *10
    nxt = cur*10 % k
    que.appendleft((cost, nxt))
print((dist[0]))
# Original solution
def solve(K):
    checked = [99999999999] * (K + 1)
    queue = [(1, 1)]
    checked[1] = 1
    while queue:
        x, n = queue.pop(0)
        if x == 0:
            return n
        _ = (x * 10) % K 
        if n < checked[_]:
            queue.insert(0, (_, n))
            checked[_] = n
        _ = (x + 1) % K 
        if n + 1 < checked[_]:
            queue.append((_, n + 1))
            checked[_] = n + 1
    return None

K = int(eval(input()))
print((solve(K)))



# Optimized solution
from collections import deque

def solve(K):
    checked = [99999999999] * (K + 1)
    queue = deque()
    queue.append((1, 1))
    checked[1] = 1
    while queue:
        x, n = queue.popleft()
        if x == 0:
            return n
        _ = (x * 10) % K 
        if n < checked[_]:
            queue.appendleft((_, n))
            checked[_] = n
        _ = (x + 1) % K 
        if n + 1 < checked[_]:
            queue.append((_, n + 1))
            checked[_] = n + 1
    return None

K = int(eval(input()))
print((solve(K)))
# Original solution
from collections import deque

def solve(K):
    checked = [99999999999] * (K + 1)
    queue = deque()
    queue.append((1, 1))
    checked[1] = 1
    while queue:
        x, n = queue.popleft()
        if x == 0:
            return n
        _ = (x * 10) % K 
        if n < checked[_]:
            queue.appendleft((_, n))
            checked[_] = n
        _ = (x + 1) % K 
        if n + 1 < checked[_]:
            queue.append((_, n + 1))
            checked[_] = n + 1
    return None

K = int(eval(input()))
print((solve(K)))



# Optimized solution
def solve(K):
    checked = [False] * K
    def calc(x):
        while not checked[x]:
            checked[x] = True
            yield x
            x = (x * 10) % K
    i = 0
    xs = [0]
    while 1:
        i += 1
        ys = []
        for x in xs:
            for z in calc((x + 1) % K):
                if z == 0:
                    return i
                ys.append(z)
        xs = ys

K = int(eval(input()))
print((solve(K)))
# Original solution
from heapq import heappop,heappush 
k=int(eval(input()))
inf=float("inf")
data=[[] for i in range(k)]
for i in range(1,k):
    if i%10==9:
        data[i]=[[i*10%k,0]]
    else:
        data[i]=[[i*10%k,0],[(i+1)%k,1]]

que=[[1,1]]
ans=[inf]*k
count=1
while que:
    c,u=heappop(que)
    ans[u]=c
    for v,d in data[u]:
        if ans[v]==inf:
            heappush(que,[d+c,v])
    if ans[0]!=inf:
        break
print((ans[0]))

# Optimized solution
from heapq import heappop,heappush 
from collections import deque
k=int(eval(input()))
inf=float("inf")
data=[[] for i in range(k)]
for i in range(1,k):
    if i%10==9:
        data[i]=[[i*10%k,0]]
    else:
        data[i]=[[i*10%k,0],[(i+1)%k,1]]

que=deque([[1,1]])
ans=[inf]*k
while que:
    c,u=que.popleft()
    ans[u]=c
    for v,d in data[u]:
        if ans[v]==inf:
            if d==0:
                que.appendleft([c,v])
            else:
                que.append([c+1,v])
    if ans[0]!=inf:
        break
print((ans[0]))
# Original solution
import heapq


k = int(eval(input()))
dist = [float("inf")] * k
q = []
heapq.heappush(q, (1, 1))

while q:
    n, c = heapq.heappop(q)
    if dist[n] <= c:
        continue
    dist[n] = c

    if dist[(n+1) % k] > c + 1:
        heapq.heappush(q, ((n + 1) % k, c + 1))
    if dist[(n*10) % k] > c:
        heapq.heappush(q, ((n * 10) % k, c))

print((dist[0]))

# Optimized solution
import heapq


def small_multiple(k):
    # kの倍数で各桁の総数が最も小さくなるような、各桁の総数
    dist = [float("inf")] * k
    q = []
    # kで割った余りが1になるような最小の数は1
    heapq.heappush(q, (1, 1))

    while q:
        n, c = heapq.heappop(q)
        if dist[n] <= c:
            continue
        dist[n] = c

        if dist[(n + 1) % k] > c + 1:
            heapq.heappush(q, ((n + 1) % k, c + 1))
        if dist[(n * 10) % k] > c:
            heapq.heappush(q, ((n * 10) % k, c))

    print((dist[0]))


def main():
    k = int(eval(input()))
    small_multiple(k)


if __name__ == "__main__":
    main()
# Original solution
# coding: utf-8
# Your code here!

import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline #文字列入力のときは注意

k = int(eval(input()))

g = [[] for _ in range(k)]
for i in range(k):
    g[i].append(((i+1)%k,1))
    if i: g[i].append((10*i%k,0))

#print(g)
"""
from collections import deque
q = deque([1])
INF = float("inf")
res = [INF]*k
res[1] = 1
while q and res[0] == INF:
#    print(q)
    v = q.popleft()
    for c,d in g[v]:
        if res[c] <= res[v] + d: continue
        res[c] = res[v] + d
        if d: q.append(c)
        else: q.appendleft(c)

#print(res)
#print(used)
print(res[0])
"""

from heapq import *
def dijkstra(g,start):
    n = len(g)
    dist = [float("inf")]*(n) #startからの最短距離
    pending = n-1 #未確定の点の個数
    dist[start] = 0
    q = [(0,start)] #(そこまでの距離、点)
    while q and pending:
        c,v = heappop(q)
        if dist[v] < c: continue
        pending -= 1
        for to, cost in g[v]:
            if dist[v] + cost < dist[to]:
                dist[to] = dist[v] + cost
                heappush(q, (dist[to], to))
    return dist

dist = dijkstra(g,1)
print((dist[0]+1))






# Optimized solution
# coding: utf-8
# Your code here!

"""
01-BFS
辺の重みが0 or 1 のとき、dequeを使ってdijkstraを高速化できる
"""
from collections import deque
def bfs01(g,start):
    n = len(g)
    res = [float("inf")]*n #startからの最短距離
    res[start] = 0
    pending = n-1 #未確定の点の個数
    q = deque([(0,start)]) #(そこまでの距離、点)
    while q and pending:
        dv,v = q.popleft()
        if res[v] < dv: continue
        pending -= 1
        #if v==goal: break
        for to,cost in g[v]:
            if dv + cost < res[to]:
                res[to] = dv + cost
                if cost: q.append((res[to],to))
                else: q.appendleft((res[to],to))
    return res

######################################################################
#ARC084 small multiple
#
######################################################################

import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline #文字列入力のときは注意

k = int(eval(input()))

g = [[] for _ in range(k)]
for i in range(k):
    g[i].append(((i+1)%k,1))
    g[i].append((10*i%k,0))

res = bfs01(g,1)
print((res[0]+1))
# Original solution
from collections import deque
q = deque()
K = int(eval(input()))
q.append((1, 1))
m = {}
while len(q):
 n, s = q.popleft()
 if n in m:continue
 m[n] = s
 q.appendleft((n * 10 % K, s))
 q.append(((n + 1) % K, s + 1))
print((m[0]))

# Optimized solution
from collections import deque
q=deque()
K=int(eval(input()))
a=q.append
a((1,1))
m={}
while len(q):
 n,s=q.popleft()
 if n in m:continue
 m[n]=s
 q.appendleft((n*10%K,s))
 a(((n+1)%K,s+1))
print((m[0]))
# Original solution
from decimal import Decimal

L=int(eval(input()))
l=Decimal(L/3)
print(("{:.12f}".format((l)**3)))

# Optimized solution
L=int(eval(input()))
print(("{:.12f}".format(L**3/27)))
# Original solution
a,b,c = list(map(int,input().split()))

if b == c:
    print(a)
elif a == c:
    print(b)
else:
    print(c)

# Optimized solution
a = list(map(int,input().split()))
a.sort()

if a[0]!=a[1]:
    print((a[0]))
else:
    print((a[2]))
# Original solution
from collections import Counter
cnt = Counter(list(map(int, input().split())))
print((cnt.most_common()[1][0]))

# Optimized solution
a, b, c = list(map(int, input().split()))
if a == b: print(c)
elif a == c: print(b)
elif b == c: print(a)
# Original solution
from collections import Counter
print((Counter(input().split()).most_common()[-1][0]))

# Optimized solution
l=input().split();print((min(l,key=lambda x:l.count(x))))
# Original solution
num = input().split()
num = [int(x) for x in num]

for i in num:
    if num.count(i) == 1:
        print(i)

# Optimized solution
num = [int(x) for x in input().split()]
for i in num:
    if num.count(i) == 1:
        print(i)
# Original solution
A, B, C = list(map(int, input().split()))
if A == B:
    print(C)
elif B == C:
    print(A)
else:
    print(B)


# Optimized solution
A, B, C = list(map(int, input().split()))
print((C if A == B else A if B == C else B))
# Original solution
# -*- coding: utf-8 -*-


def func(a, b, c):
    if a == b:
        result = c
    elif b == c:
        result = a
    else:
        result = b
    
    return result


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

# Optimized solution
a, b, c = list(map(int, input().split()))
print((a^b^c))
# Original solution
a,b,c = list(map(int, input().split()))

if a == b:
  print(c)
elif a == c:
  print(b)
else:
  print(a)

# Optimized solution
a = [int(_) for _ in input().split()]
a.sort()
if a[0] == a[1]:
  print((a[2]))
elif a[0] == a[2]:
  print((a[1]))
else:
  print((a[0]))
# Original solution
from collections import Counter

ABC = list(map(int, input().split()))

cnt = Counter(ABC)
values, counts = list(zip(*cnt.most_common(2)))

print((values[1]))

# Optimized solution
A, B, C = list(map(int, input().split()))

if A == B:
    print(C)
elif B == C:
    print(A)
else:
    print(B)
# Original solution
from collections import Counter
a = Counter(list(map(int,input().split()))).most_common()
print((a[1][0]))

# Optimized solution
from collections import Counter
print((Counter(list(map(int,input().split()))).most_common()[-1][0]))
# Original solution
A, B, C = list(map(int, input().split()))
print((A ^ B ^ C))


# Optimized solution
print((eval(input().replace(" ", "^"))))
# Original solution
A, B, C = list(map(int, input().split()))
print((A if B == C else B if A == C else C))

# Optimized solution
integer1, integer2, integer3 = list(map(int, input().split()))
if integer2 == integer3:
    print(integer1)
elif integer1 == integer3:
    print(integer2)
else:
    print(integer3)
# Original solution
a,b,c=list(map(int,input().split()))
print((a if b==c else b if a==c else c))

# Optimized solution
print((eval(input().replace(" ","^"))))
# Original solution
a,b,c = input().split()
if a == b:
    print(c)
elif b==c:
    print(a)
else:
    print(b)

# Optimized solution
a,b,c = list(map(int,input().split()))
print((a^b^c))
# Original solution
a, b, c = list(map(int, input().split()))
print((a if b == c else b if a == c else c))


# Optimized solution
print((eval(input().replace(' ', '^'))))
# Original solution
A,B,C=list(map(int,input().split()))

if A==B:
	print(C)
else:
	if A==C:
		print(B)
	else:
		print(A)
		


# Optimized solution
A,B,C=list(map(int,input().split()))

if A==B:
	print(C)
elif B==C:
	print(A)
else:
	print(B)
# Original solution
A, B, C = list(map(int,input().split()))
if(A == B):
  print(C)
elif(A == C):
  print(B)
else:
  print(A)

# Optimized solution
A, B, C = list(map(int,input().split()))
if(A == B):
  print(C)
elif(B == C):
  print(A)
else:
  print(B)
# Original solution
a, b, c = list(map(int, input().split()))
if a == b:
  print(c)
elif b == c:
  print(a)
else:
  print(b)

# Optimized solution
l1, l2, l3 = list(map(int, input().split()))
print((l1 ^ l2 ^ l3))
# Original solution
from collections import Counter
A = Counter([int(i) for i in input().split()]).most_common()
print((A[1][0]))

# Optimized solution
a, b, c = list(map(int, input().split()))
if a == b:
    print(c)
elif a == c:
    print(b)
else:
    print(a)
# Original solution
from collections import Counter
N = int(eval(input()))

A = list(map(int, input().split()))
c = Counter(A)
s = c.most_common()[0][0]
idx_s = [i for i,x in enumerate(A) if x == s]
l = idx_s[0]
r = idx_s[1]

def nCr(n,r):
  if n < 0 or r < 0 or n < r: return 0
  if n - r < r: r = n - r
  if r == 0: return 1
  if r == 1: return n
  
  # 分子のn*(n-1)*...がr個分続くやつ
  numerator = [n-r+k+1 for k in range(r)]
  # 分母：r!=r*(r-1)*...*3*2の要素
  denominator = [k+1 for k in range(r)]
  
  # 分母の要素で割れる部分を割っていく部分
  for p in range(2, r+1):
    # 分母は1,2,3,...rのようになっており、1は意味がないのでスキップした形か
    pivot = denominator[p-1]
    if pivot > 1:
      # 分子のX番目と分母のX-offset番目が共通の約数を持つということだと思う。piv分ずれているのだから、pivの倍数というところか
      offset = (n-r) % p
      for k in range(p-1, r, p):
        # 約分できる要素について割る
        numerator[k - offset]  /= pivot
        denominator[k] /= pivot
        
  ret = 1
  for k in range(r):
    if numerator[k] > 1: ret *= int(numerator[k])
      
  return ret

for i in range(1,N+2):
    print(((nCr(N+1, i) - nCr(l+N+1-(r+1), i-1)) % (10**9+7)))

# Optimized solution
from collections import Counter
N = int(eval(input()))

A = list(map(int, input().split()))
c = Counter(A)
s = c.most_common()[0][0]
idx_s = [i for i,x in enumerate(A) if x == s]
l = idx_s[0]
r = idx_s[1]

MOD = 10**9+7
fac = [1,1] + [0]*N
finv = [1,1] + [0]*N
inv = [0,1] + [0]*N
for i in range(2,N+2):
    fac[i] = fac[i-1] * i % MOD
    inv[i] = -inv[MOD%i] * (MOD // i) % MOD
    finv[i] = finv[i-1] * inv[i] % MOD
 
def nCr(n,r):
    if n < r: return 0
    if n < 0 or r < 0: return 0
    return fac[n] * (finv[r] * finv[n-r] % MOD) % MOD

for i in range(1,N+2):
    print(((nCr(N+1, i) - nCr(l+N+1-(r+1), i-1)) % MOD))