Harryxun/stf_run huggingface dataset:
def INSTR():
	return input()

def INNUM():
	return int(INSTR())

def INSTR_S():
	return INSTR().split()

def INNUM_S():
	return map(int, INSTR_S())

def INSTR_M(n):
	return [INSTR() for _ in range(n)]

def INNUM_SM(n):
	return [tuple(INNUM_S()) for _ in range(n)]

N, M = INNUM_S()
NPIC = INSTR_M(N)
MPIC = INSTR_M(M)

for i, npic in enumerate(NPIC):
	if MPIC[0] in npic:
		c = npic.find(MPIC[0])
		for j, mpic in enumerate(MPIC):
			if c != NPIC[i + j].find(mpic):
				break
		else:
			print("Yes")
			exit()
print("No")


### FIXED CODE ###

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

l = 0
while l <= len(A[0]) - len(B[0]):
	for i in range(N - M + 1):
		s = A[i][l:]
		if not B[0] in s:
			continue
		if 0 == s.index(B[0]):
			for m in range(1, M):
				if not B[m] in A[i + m][l:]:
					break
				if 0 != A[i + m][l:].index(B[m]):
					break
			else:
				print("Yes")
				exit()
	l += 1
print("No")
from functools import *
from collections import *

M = 10**9+7

@lru_cache(maxsize=None)
def mod_inv(a):
  b, x, y = M, 1, 0
  while a != 1:
    (d, a), b = divmod(b, a), a
    x, y = y-d*x, x
  return x%M

cache = defaultdict(dict)
def calc_cache(self, parent):
  c = cache[self]
  if not c or parent in c:
    return c[parent]
  
  if c and None not in c:
    for p, (r2, t2, s2) in c.items():
      r3, t3, s3 = calc_cache(p, self)
      r = r2 * t3
      s = s2 + s3
      c[None] = r, None, s
      break
  
  if parent is None:
    return c[parent]
  
  if None in c:
    r0, t0, s0 = c[None]
    r1, t1, s1 = calc_cache(parent, self)
    r = r0 * mod_inv(t1) % M
    s = s0 - s1
    c[parent] = r, r * mod_inv(s) % M, s
    return c[parent]

N = int(input())
Edge = defaultdict(set)
fact = 1
for i in range(1, N):
  fact = fact * i % M
  a, b = map(int, input().split())
  Edge[a].add(b)
  Edge[b].add(a)

cache = defaultdict(dict)
stack = [None, 1]
children = {}
while len(stack) > 1:
  parent = stack[-2]
  self = stack[-1]
  if self not in children:
    children[self] = Edge[self]-{parent}
  if children[self]:
    stack.append(children[self].pop())
  else:
    ret = 1
    size = 1
    for child in (Edge[self] - {parent}):
      r, t, s = cache[child][self]
      ret = ret * t % M
      size += s
    cache[self][parent] = ret, ret * mod_inv(size) % M if parent else None, size
    stack.pop()

for i in range(1, N+1):
  print(calc_cache(i, None)[0] * fact % M)



### FIXED CODE ###

from functools import *
from collections import *
import sys
sys.setrecursionlimit(10**6)
input = sys.stdin.buffer.readline
 
M = 10**9+7

@lru_cache(maxsize=None)
def mod_inv(a):
  b, x, y = M, 1, 0
  while a != 1:
    (d, a), b = divmod(b, a), a
    x, y = y-d*x, x
  return x%M

@lru_cache(maxsize=None)
def calc_subtree(v):
  ret = 1
  size = 1
  for child in Edge[v]:
    Edge[child].remove(v)
    r, s = calc_subtree(child)
    ret = ret * r % M
    size += s
      
  ret = ret * size % M
  return ret, size

ans = {}
def set_ans(v, a):
  ans[v] = a
  for child in Edge[v]:
    n = calc_subtree(child)[1]
    set_ans(child, ans[v] * n * mod_inv(N-n) % M)

N = int(input())
Edge = defaultdict(set)
fact = N
for i in range(1, N):
  fact = fact * i % M
  a, b = map(int, input().split())
  Edge[a].add(b)
  Edge[b].add(a)

set_ans(1, mod_inv(calc_subtree(1)[0]) * fact % M)
for i in range(1, N+1):
  print(ans[i])
A = input()
B = input()
C = input()
if A < B:
    D = B
    E = A
else :
    E = B
    D = A

if D > C > E :
    print("yes")
else :
    print("no")

### FIXED CODE ###

A,B,C = map(int,input().split())
if A > C > B :
    print("Yes")
elif B > C > A :
    print("Yes")
else :
    print("No")
import sys

def stackBall(stackB, stackC, ball):
	if len(ball) == 0:
		return True
	if len(stackB) == 0 or stackB[-1] < ball[0]:
		stackB.append(ball.pop(0))
		if stackBall(stackB, stackC, ball):
			return True
	if len(stackC) == 0 or stackC[-1] < ball[0]:
		stackC.append(ball.pop(0))
		if stackBall(stackB, stackC, ball):
			return True
	return False

n = input()

for _ in range(n):
	ball = list(map(int, input().split()))
	if stackBall([], [], ball):
		print("YES")
	else:
		print("NO")

### FIXED CODE ###

import sys

def stackBall(ball):
	sB, sC = [0], [0]
	for b in ball:
		if max(sB[-1], sC[-1]) < b:
			if sB[-1] >= sC[-1]:
				sB.append(b)
			else:
				sC.append(b)
		elif min(sB[-1], sC[-1]) < b:
			if sB[-1] >= sC[-1]:
				sC.append(b)
			else:
				sB.append(b)
		else:
			return False
	return True


n = int(input())

for _ in range(n):
	ball = list(map(int, input().split()))
	if stackBall(ball):
		print("YES")
	else:
		print("NO")
n, t, m = int(input()), list(map(int, input().split())), int(input())
p, x = [], []
for i in range(m):
  q, y = map(int, input().split())
  p[i] = q
  x[i] = y
s = sum(t)
for j in range(m):
  print(s - t[j] + x[j])

### FIXED CODE ###

n = int(input())
t = list(map(int, input().split()))
m = int(input())
p = []
x = []
for i in range(m):
  q, y = map(int, input().split())
  p.append(q)
  x.append(y)
  
s = sum(t)
for j in range(m):
  print(s - t[p[j]-1] + x[j])
import sys
import numpy as np
from math import ceil as C, floor as F
from collections import defaultdict as D
 
alp = 'abcdefghijklmnopqrstuvwxyz'
def S(): return sys.stdin.readline().rstrip().split(' ')
def Ss(): return list(S())
def I(): return _I(S())
def Is(): return list(I())
def _I(ss): return map(int, ss) if len(ss) > 1 else int(ss[0])
 
_ = I()
xs = Is()

count = D(int)
for x in xs:
  count[x] += 1

q = I()
for _ in range(q):
  b, c = I()
  count[c] += count[b]
  count[b] = 0
  print(np.sum([k*v for k, v in count.items()]))
  

### FIXED CODE ###

import sys
import numpy as np
from math import ceil as C, floor as F
from collections import defaultdict as D
from functools import reduce as R

ALP = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
alp = 'abcdefghijklmnopqrstuvwxyz'
def _X(): return sys.stdin.readline().rstrip().split(' ')
def _S(ss): return tuple(ss) if len(ss) > 1 else ss[0]
def S(): return _S(_X())
def _Ss(ss): return list(ss) if isinstance(ss, tuple) else [ss]
def Ss(): return _Ss(S())
def _I(ss): return tuple([int(s) for s in ss]) if isinstance(ss, tuple) else int(ss)
def I(): return _I(S())
def _Is(ss): return list(ss) if isinstance(ss, tuple) else [ss]
def Is(): return _Is(I())

_ = I()
xs = Is()
 
sss = 0
count = D(int)
for x in xs:
  sss += x
  count[x] += 1
  
q = I()
for _ in range(q):
  b, c = I()
  sss += (c - b) * count[b]
  print(sss)
  count[c] += count[b]
  count[b] = 0
#include<cstdio>
using namespace std;
 
int main(){
int a,b,c;
scanf("%d %d %d",&a,&b,&c);
if((a<b)&&(b<c))puts("Yes");
else puts("No");
return 0;
 
 
}

### FIXED CODE ###

a,b,c=map(int,raw_input().split())
if a<b<c:
    print "Yes"
else :
    print "No"
#coding utf-8
import fractions
import math
a, b = map(int,input().split())
ans = 0
g = math.gcd(a,b)
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

ans = len(factorization(g)) + 1
if a == 1 or b == 1:
    ans = 1
print(ans)

### FIXED CODE ###

#coding utf-8
import fractions
import math
a, b = map(int,input().split())
ans = 0
g = fractions.gcd(a,b)
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

ans = len(factorization(g)) + 1
if a == 1 or b == 1:
    ans = 1
print(ans)
a=map(int,input().split())
b=int(a[0]/(a[1]+a[2]))
c=a[0]-b*(a[1]+a[2])
if c>a[1]:
  print(b*a[1]+a[1])
else:
  print(b*a[1]+c)

### FIXED CODE ###

a=list(map(int,input().split()))
b=int(a[0]/(a[1]+a[2]))
c=a[0]-b*(a[1]+a[2])
if c>a[1]:
    print(b*a[1]+a[1])
else:
    print(b*a[1]+c)
n, q = map(int, input().split())
s = input()
L = [1 for i in range(n+2)] #カウント用
L[0] = -99999
L[n+1] = -99999
x = [list(input().split()) for i in range(q)]
    
S = [c  for c in s] #一文字ずつにわける
    
for i in range(q):
    index = [k for k, X in enumerate(S) if X == x[i][0]]
    for _, j in enumerate(index):
    if x[i][1]=='L':
        L[j+1-1] +=L[j+1]
        L[j+1] = 0
    else:
        L[j+1+1] +=L[j+1]
        L[j+1] = 0
     
print(sum(L[1:n+1]))

### FIXED CODE ###

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

if a==b and b==c:
  print("Yes")
else:
  print("No")
import sys
stdin = sys.stdin

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))

p=[0]*3
p[0]=ns()
p[1]=ns()
p[2]=ns()
turn='A'
d={'A':0,'B':1,'C':2}

while(len[p[d[turn]]]==0):
	tmp=p[d[turn]][0]
	p[d[turn]][0]=[]	
	turn=tmp


print(d[turn])


### FIXED CODE ###

import sys
stdin = sys.stdin

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))

p=[0]*3
p[0]=list(ns())
p[1]=list(ns())
p[2]=list(ns())
turn='a'
d={'a':0,'b':1,'c':2}

hand=p[d[turn]]
ch=len(hand)
while(ch!=0):
  turn=p[d[turn]].pop(0)
  hand=p[d[turn]]
  ch=len(hand)


print(turn.upper())
v=list(map(int,input().split()))
c=list(map(int,input().split()))
cnt=0
for i in range(n):
  if v[i]-c[i]>0:
    cnt+=v[i]-c[i]
print(cnt)

### FIXED CODE ###

n=int(input())
v=list(map(int,input().split()))
c=list(map(int,input().split()))
cnt=0
for i in range(n):
  if v[i]-c[i]>0:
    cnt+=v[i]-c[i]
print(cnt)
n = int(input())
A = map(int, input().split())

if 0 in A:
  return 0

product = 1

for a in A:
  product *= a

  if product > 10 ** 18:
    return -1

  return product


### FIXED CODE ###

def solve(A):
    if 0 in A:
        return 0

    product = 1

    for a in A:
        product *= a

        if product > 10 ** 18:
            return -1

    return product


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

print(solve(A))
a = map(int, input().split())
b = map(int, input().split())
c = map(int, input().split())
print(a[0]b[1]c[2])

### FIXED CODE ###

a = list(map(str, input()))
b = list(map(str, input()))
c = list(map(str, input()))
print(a[0] + b[1] + c[2])
A = input().split()
if A[0] == 2 or A[1] == 2:
    print(No)
else:
    print(Yes)

### FIXED CODE ###

A = input().split()
A[0] = int(A[0])
A[1] = int(A[1])
if A[0] == 2 or A[1] == 2:
    print('No')
else:
    print('Yes')
a,b,c=map(int,input())
color = [a]
if b not in color:
  color.append(b)
if c not in color:
  color.append(c)
print(color)

### FIXED CODE ###

a,b,c=map(int,input().split())
color = [a]
if b not in color:
  color.append(b)
if c not in color:
  color.append(c)
print(len(color))
import collections


x = int(input())

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

prime = prime_factorize(x)[0]

a,b = 0,-prime
while True:
    if x == a**5 - (b)**5:
        print(a,b)
        break
    else:
        a += 1
        b += 1

### FIXED CODE ###

s = str(input())
print('ABC') if s == 'ARC' else print('ARC')
import heapq

N, K = map(int, input().split())
dt = [list(map(int, input().split()))[::-1] for i in range(N)]
dt.sort(reverse=True)

ans = 0
t_set = set()
candidates = []
for d, t in dt[:K]:
  if t in t_set:
    heapq.heappush(candidates, [d, t])
    ans += d
  else:
    t_set.add(t)
    ans += d

x = len(t_set)
ans += x**2

ans = [ans]
for d, t in dt[K:]:
  if t in t_set:
    continue
  cand_d, cand_t = heapq.heappop(candidates)
  _ans = ans[-1] - cand_d + d + (2*x+1)
  x += 1
  ans.append(_ans)
  if len(candidates) == 0:
    break

print(max(ans))

### FIXED CODE ###

import heapq

N, K = map(int, input().split())
dt = [list(map(int, input().split()))[::-1] for i in range(N)]
dt.sort(reverse=True)

ans = 0
t_set = set()
candidates = []
for d, t in dt[:K]:
  if t in t_set:
    heapq.heappush(candidates, [d, t])
    ans += d
  else:
    t_set.add(t)
    ans += d

x = len(t_set)
ans += x**2

if len(candidates) == 0:
  print(ans)
  quit()

ans = [ans]
for d, t in dt[K:]:
  if t in t_set:
    continue
  cand_d, cand_t = heapq.heappop(candidates)
  _ans = ans[-1] - cand_d + d + (2*x+1)
  x += 1
  ans.append(_ans)
  t_set.add(t)
  if len(candidates) == 0:
    break

print(max(ans))
from collections import Counter
from copy import deepcopy

n = int(input())
a = list(map(int, input().split()))
c = Counter(a)
for v in c.values():
    all_comb += v*(v-1)/2

for i in range(n):
    tmp = c[a[i]]
    print(all_comb - 2*(tmp-1))


### FIXED CODE ###

from collections import Counter

n = int(input())
a = list(map(int, input().split()))
c = Counter(a)
all_comb = 0
for v in c.values():
    all_comb += v*(v-1)/2

for i in range(n):
    tmp = c[a[i]]
    print(int(all_comb-tmp+1))
for i in range(9):
	for j in range(9):
		print str(i+1)+"x"+str(j+1)+"="+str(i*j)

### FIXED CODE ###

for i in range(1,10):
	for j in range(1,10):
		print str(i)+'x'+str(j)+'='+str(i*j)
n = int(input())
xlist=[]
ylist=[]
for i in range(n):
    x,y=input().split()
    xlist.append(int(x))
    ylist.append(int(y))

import math
import itertools
import statistics

def distance(x1,x2,y1,y2):
    return math.sqrt((x1-x2)**2 + (y1-y2)**2)

def permutations_count(nnn, rrr):
    return math.factorial(nnn) // math.factorial(nnn - rrr)

nlist = list(range(0,n))
nlist = list(itertools.permutations(nlist,n))
anslist = []
ans = 0
for i in range(0,permutations_count(n,2)):
    for j in range(0,n-1):
        x1 = xlist[nlist[i][j]]
        x2 = xlist[nlist[i][j+1]]
        y1 = ylist[nlist[i][j]]
        y2 = ylist[nlist[i][j+1]]
        ans += distance(x1,x2,y1,y2)
    anslist.append(ans)
    ans = 0

print(statistics.mean(anslist))

### FIXED CODE ###

n = int(input())
zahyou = []
for i in range(n):
    a = input().split()
    zahyou.append(a)
import math


def distance(x1,x2,y1,y2):
    return math.sqrt((x1-x2)**2 + (y1-y2)**2)

allen = 0
for i in zahyou:
    for j in zahyou:
        allen += distance(int(i[0]),int(j[0]),int(i[1]),int(j[1]))

ans = float(allen/n)
print(ans)
N, L = map(int, input().split())
S = list(input() for i in range(L))
S.sort()
str = ""
for i in S:
    str += i
print(str)


### FIXED CODE ###

N, L = map(int, input().split())
S = list(input() for i in range(N))
str = ""
for i in range(N-1):
    for j in range(N-1):
        if S[j+1] + S[j] <= S[j] + S[j+1]:
            S[j], S[j+1] = S[j+1], S[j]
for i in S:
    str += i
print(str)
price = int(input()).split()
if  price > B:
  print(B)
else:
  print(N * A)


### FIXED CODE ###

price =input().split()
if int(price[0]) *  int(price[1]) > int(price[2]) :
	print(int(price[2]))
else :
	print(int(price[0]) * int(price[1]))
import sys
input = sys.stdin.readline

s = list(input().replace("¥n", ""))
l = {
    "0": 0,
    "1": 0
}

for v in s:
    l[v] += 1
        
print(min(l["0"], l["1"]) * 2)

### FIXED CODE ###

import sys
input = sys.stdin.readline

s = list(input())
l = {
    "0": 0,
    "1": 0,
}

for v in s:
    if l.get(v):
        l[v] += 1
    else:
        l[v] = 1
        
print(min(l["0"], l["1"]) * 2)
S = input()
print(S[0]+ len(S) + S[-1])

### FIXED CODE ###

S = input()
T = len(S)-2
print(S[0]+ str(T) + S[-1])
x,n=map(int,input().split())
p=list(map(int,input().split()))
p.sort()
ans=10000

for i in range(1,101):
    if (i in p):
        continue
    else:
        tmp=(x-i)**2
        if tmp<ans:
            ans=tmp
            c=i
print(c)

### FIXED CODE ###

x,n=map(int,input().split())
p=list(map(int,input().split()))
p.sort()
ans=10001

for i in range(0,102):
    if (i in p):
        continue
    else:
        tmp=(x-i)**2
        if tmp<ans:
            ans=tmp
            c=i
print(c)
N,M = map(int,input().split())
a = []
tmp = []
for i in range(M):
    tmp = list(map(str,input().split()))
    a.append(list(tmp))

siCheck = [0 for i in range(N)]
inCheck = [0 for i in range(N)]

for i in range(N):
    if a[i][0] == '1':
        siCheck[int(a[i][1])-1] = True
    else:
        siCheck[int(a[i][1])-1] = False
    if int(a[i][1]) == N:
        inCheck[int(a[i][0])-1] = True
    else:
        inCheck[int(a[i][0])-1] = False

for i in range(N):
    if siCheck[i] and inCheck[i]:
        print('POSSIBLE')
        exit()

print('IMPOSSIBLE')

### FIXED CODE ###

from collections import deque

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

island_map = {}
for a,b in route:
    if a not in island_map:
        island_map[a] = [b]
    else:
        island_map[a].append(b)

first_island = deque()
first_island += island_map[1]
second_island = deque()

for i in first_island:
    if i in island_map:
        second_island += island_map[i]
    else:
        pass
    for j in second_island:
        if j == N:
            print('POSSIBLE')
            exit()

print('IMPOSSIBLE')
n = int(input)
count = 0
for i in range(0,n):
  if (i+1)%3==0:
    count = count
  elif (i+1)%5==0:
    count = count
  else:
    count = count + i + 1

print(count)


### FIXED CODE ###

n = int(input())
count = 0
for i in range(0,n):
  if (i+1)%3==0:
    count = count
  elif (i+1)%5==0:
    count = count
  else:
    count = count + i + 1

print(count)
print(6-int(input)-int(input))

### FIXED CODE ###

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

m = max(a,b,c)
al = a+b+c-m+m**K
print(al)

### FIXED CODE ###

a,b,c = map(int, input().split())
k = int(input())
kk=2**k
m = max(a,b,c)
al = a+b+c-m+m*kk
print(al)
s=input()
a=[]
for i in s:
    if i=='0':
        a.append(i)
    elif i=='1':
        a.append(i)
    else:
        a.pop(-1)
print(''.join(a))

### FIXED CODE ###

s=input()
a=[]
for i in s:
    if i=='0':
        a.append(i)
    elif i=='1':
        a.append(i)
    else:
        if len(a)!=0:
            a.pop(-1)
print(''.join(a))
N = int(input())
nums = input().split(" ")
nums2 = [int(x)-i-1 for i,x in enumerate(nums)]
nums2.sort()
length = len(nums2)
numpre = 0
same = 1
for n,m in zip(nums2,nums2[1:]):
  if n == m:
    same += 1
  else:
    impact = same + numpre
    if impact > length-impact:
      value = n
      break
    numpre += same
    same = 1
answer = 0
for i in nums2:
  answer += abs(i-value)
print(answer)

### FIXED CODE ###

N = int(input())
nums = input().split(" ")
nums2 = [int(x)-i-1 for i,x in enumerate(nums)]
nums2.sort()
length = len(nums2)
numpre = 0
same = 1
if length == 1:
  value = nums2[0]
 
for n,m in zip(nums2[:-1],nums2[1:]):
  if n == m:
    same += 1
  else:
    impact = same + numpre
    if impact > length-impact:
      value = n
      break
    numpre += same
    same = 1
  value = m
 
answer = 0
for i in nums2:
  answer += abs(i-value)
print(answer)
M=10**9+7
n=int(input())
c=list(int(input()) for i in range(n))
dp=[0]*n
rec=[0]*n
dp[0]=1
rec[c[0]]=1
for i in range(1,n):
	if c[i]==c[i-1]:
		dp[i]=dp[i-1]
		continue
	dp[i]=(dp[i-1]+rec[c[i]])%M
	rec[c[i]]=dp[i]
print(dp[-1])

### FIXED CODE ###

n=int(input())
c=list(int(input()) for i in range(n))
dp=[0]*n
rec=[0]*(2*10**5+1)
dp[0]=1
rec[c[0]]=1
for i in range(1,n):
	if c[i]==c[i-1]:
		dp[i]=dp[i-1]
		continue
	dp[i]=(dp[i-1]+rec[c[i]])%(10**9+7)
	rec[c[i]]=dp[i]
print(dp[-1])
A, B = int(input())

print(A*B)

### FIXED CODE ###

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

print(A*B)
n = int(input())
s1=input()
s2=input()
mod = 10**9+7
l = []
for i in range(0,n-1):
    if s1[i] != s1[i+1]:
        if s1[i] != s2[i]:
            l.append(0)
        else:
            l.append(1)
if s1[n-1]==s2[n-1]: l.append(1)
if l[0]:
    res = 3
else:
    res = 6

for i in range(1,len(l)):
    if l[i-1] and l[i]:
        res *= 2
    elif l[i-1] and  not l[i]:
        res *= 2
    elif not l[i-1] and not l[i]:
        res *= 3

print(res % mod)

### FIXED CODE ###

n = int(input())
s1=input()
s2=input()
mod = 10**9+7
l = []
for i in range(0,n-1):
    if s1[i] != s1[i+1]:
        if s1[i] != s2[i]:
            l.append(0)
        else:
            l.append(1)
if s1[n-1]==s2[n-1]:
    l.append(1)
else:
    l.append(0)
if l[0]:
    res = 3
else:
    res = 6

for i in range(1,len(l)):
    if l[i-1] and l[i]:
        res *= 2
    elif l[i-1] and  not l[i]:
        res *= 2
    elif not l[i-1] and not l[i]:
        res *= 3

print(res % mod)
n=int(input())
l=list(map(int,input().split()))

l.sort()
k=l[::2]

print(k.sum())

### FIXED CODE ###

n=int(input())
l=list(map(int,input().split()))
 
l.sort()
k=l[::2]
sum=0
for i in range(n):
  sum += k[i]
  
print(sum)
N , W = map(int,input().split())
dp[W+1] = [0]

for i in range(N):
    n , m = map(int,input().split())
    for j in range(W,m-1,-1):
        x = n + dp[j-m]
        if x > dp[j]:
            dp[j] = x:
            
print(dp[W])


### FIXED CODE ###

N , W = map(int,input().split())
dp = [0]*(W+1)

for i in range(N):
    n , m = map(int,input().split())
    for j in range(W,m-1,-1):
        x = n + dp[j-m]
        if x >= dp[j]:
            dp[j] = x
            
print(dp[W])
s = input()
print(s[0] + ( len(s)-2) + s[-1])

### FIXED CODE ###

s = input()
print(s[0] + str( len(s)-2) + s[-1])
k = int(input())
table = [1,2,3,4,5,6,7,8,9,10,11,12,21,22,23,32,33,34,43,44,45,54,55,56,65,66,67,76,77,78,87,88,89,98]
for i in range(1,9):
    key1=int(str(i)+str(i-1)+str(i-1))
    key2=int(str(i)+str(i)+str(i))
    key3=int(str(i)+str(i+1)+str(i+1))
    table.append(key1-1)
    table.append(key1)
    table.append(key1+1)
    table.append(key2-1)
    table.append(key2)
    table.append(key2+1)
    table.append(key3-1)
    table.append(key3)
    table.append(key3+1)
table.pop()
table.append(987)
table.append(988)
table.append(989)
table.append(998)
table.append(999)
table.append(1000)
table.append(1001)
table.append(1010)
table.append(1011)
table.append(1012)
table.append(1100)
table.append(1101)
table.append(1110)
table.append(1111)
table.append(1112)
table.append(1121)
table.append(1122)
table.append(1123)
table.append(1210)
table.append(1211)
table.append(1212)
table.append(1221)
table.append(1222)
table.append(1223)
table.append(1232)
table.append(1233)
table.append(1234)
for j in range(2,9):
        key1=int(str(j)+str(j-1)+str(j-1)+str(j-1))
        key2=int(str(j)+str(j)+str(j)+str(j))
        key3=int(str(j)+str(j+1)+str(j+1)+str(j+1))    
    table.append(key1-1)
    table.append(key1)
    table.append(key1+1)
    table.append(key2-1)
    table.append(key2)
    table.append(key2+1)
    table.append(key3-1)
    table.append(key3)
    table.append(key3+1)
table.pop()
table.append(9887)
table.append(9888)
table.append(9889)
table.append(9998)
table.append(9999)
print(table[k-1])

### FIXED CODE ###

k = int(input())
lunlun = []
def dfs(A):
    if len(A) == 10:
        return
    else:
        start = int(A[-1])
        if start == 9:
            for i in range(start-1, start+1):
                A.append(str(i))
                lunlun.append("".join(A))
                dfs(A)
                A.pop()
        elif start == 0:
            for i in range(start, start+2):
                A.append(str(i))
                lunlun.append("".join(A))
                dfs(A)
                A.pop()
        else:
            for i in range(start-1, start+2):
                A.append(str(i))
                lunlun.append("".join(A))
                dfs(A)
                A.pop()
for j in range(1, 10):
    lunlun.append(str(j))
    dfs([str(j)])
lunlun = list(map(int, lunlun))
lunlun.sort()
print(lunlun[k-1])
n=int(input())

for a in range(1,10):
    for b in range(1,10):
        if a*b==n:
            flag=True
if flag:
   print("Yes") 
else:
     print("No")

### FIXED CODE ###

from sys import exit

N = int(input())

for i in range(1, 10):
    for j in range(1, 10):
        if N == i * j:
            print('Yes')
            exit()
print('No')