Harryxun/stf_run huggingface dataset:
x = int(input())
temp = int(x ** 0.25)
for i in range(-temp, temp + 1):
    temp2 = int((i ** 5 + x) ** 0.2)
    if temp2 ** 5 - i ** 5 == x:
        print(temp2, i)
        break
    temp3 = int((i ** 5 - x) ** 0.2)
    if i ** 5 - temp3 ** 5 == x:
        print(i, temp3)
        break

### FIXED CODE ###

x = int(input())
temp = int(x ** 0.25)
flag = True
for i in range(-temp, temp + 1):
    for j in range(-temp, temp + 1):
        if i ** 5 - j ** 5 == x:
            print(i, j)
            flag = False
            break
    if flag == False:
        break
import math

a, b, h, m = map(int, input().split())

deg_h = 360 / 12
deg_m = 360 / 60

H = h * deg_h + m * deg_m
M = m * deg_m
deg = abs(H - M)

if deg > 180:
    deg = 360 - deg

rad = (deg/180) * math.pi
c = math.sqrt(a**2 + b**2 - 2*a*b*math.cos(rad))
print(c)


### FIXED CODE ###

n = input()

if(n[-1] == '0' or n[-1] == '6' or n[-1] == '1' or n[-1] == '8'):
    print('pon')
elif(n[-1] == '3'):
    print('bon')
else:
    print('hon')
# #の数を数えておいて、x*y-(最短距離+最初の#の数）
# 最短経路なので幅優先でやる
from collections import deque

h, w = map(int, input().split())
table =[]
default_dot = 0
for _ in range(h):
  line = list(input())
  default_dot+=line.count(".")
  table.append(line)

default_dot-=2  # スタートとゴール
table[0][0] = 0

cur = [0, 0]   # x, y
queue = deque()
queue.append(cur)
steps = [0, 1, 0, -1, 0]

minimum_step = 0

while True:
  now = queue.popleft()
  if now[0] == w-1 and now[1] == h-1:
    minimum_step = table[now[1]][now[0]]-1
    break
  for i in range(4):
    next_y, next_x = now[1]+steps[i], now[0]+steps[i+1]
    if 0<=next_y<h and 0<=next_x<w and table[next_y][next_x] == ".":
      table[next_y][next_x] = table[now[1]][now[0]]+1
      queue.append([next_x, next_y])


print(default_dot-minimum_step)

### FIXED CODE ###

# #の数を数えておいて、最初の.の数-最短距離
# 最短経路なので幅優先でやる
from collections import deque

h, w = map(int, input().split())
table =[]
default_dot = 0
for _ in range(h):
  line = list(input())
  default_dot+=line.count(".")
  table.append(line)

default_dot-=2  # スタートとゴール
table[0][0] = 0

cur = [0, 0]   # x, y
queue = deque()
queue.append(cur)
steps = [0, 1, 0, -1, 0]

minimum_step = 0

while True:
  if len(queue)==0:
    print(-1)
    exit()
  now = queue.popleft()
  if now[0] == w-1 and now[1] == h-1:
    minimum_step = table[now[1]][now[0]]-1
    break
  for i in range(4):
    next_y, next_x = now[1]+steps[i], now[0]+steps[i+1]
    if 0<=next_y<h and 0<=next_x<w and table[next_y][next_x] == ".":
      table[next_y][next_x] = table[now[1]][now[0]]+1
      queue.append([next_x, next_y])


print(default_dot-minimum_step)
a,b=map(int,input().split())

n=b-a

print(n(n+1)//2-b)

### FIXED CODE ###

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

n=b-a

print(n*(n+1)//2-b)
n=int(input())
list=list(map(int,input().split()))

ave=int(sum(list)/len()list)

ans=0
for i in list:
  ans+= pow((i-ave),2)

print(ans)


### FIXED CODE ###

n=int(input())
list=list(map(int,input().split()))
min_tairyoku=10000000000000000000
tairyoku=[]
for i in range(min(list),max(list)+1):
    t=0
    for j in list:
        t += (j-i) ** 2
    tairyoku.append(t)
print(min(tairyoku))
N = int(input())
a = [[0]*3 for i in range(N)]

for i in range(N):
  a[i] = [int(i) for i in input().split()] 

def f(n, i):
  if n ==0:
    return a[0][i]
  i1 = (i+1) % 3
  i2 = (i+2) % 3
  if F[n][i]:
    return F[n][i]
  F[n][i] = max(f(n-1, i1), f(n-1, i2)) + a[n][i] 
  return F[n][i]  

F =[[None]*3 for _ in range(N)]

print(max(f(N-1, 0), f(N-1,1), f(N-1,2)))


### FIXED CODE ###

import sys
sys.setrecursionlimit(1000000)

N = int(input())
a = [[0]*3 for i in range(N)]

for i in range(N):
  a[i] = [int(i) for i in input().split()] 

def f(n, i):
  if n ==0:
    return a[0][i]
  i1 = (i+1) % 3
  i2 = (i+2) % 3
  if F[n][i]:
    return F[n][i]
  F[n][i] = max(f(n-1, i1), f(n-1, i2)) + a[n][i] 
  return F[n][i]  

F =[[None]*3 for _ in range(N)]

print(max(f(N-1, 0), f(N-1,1), f(N-1,2)))
import sys
n,y=map(int,input().split())
for i in range(n+1):
  for j in range(n-j+1):
    for k in range(n-i-j+1):
      if i*10000+j*5000+k*1000==y:
        print(i j k)
        sys.exit()
print(-1 -1 -1)
    

### FIXED CODE ###

import sys
n,y=map(int,input().split())
for i in range(n+1):
  for j in range(n-i+1):
      if i*10000+j*5000+(n-i-j)*1000==y:
        print(*[i,j,n-i-j])
        sys.exit()
print(*[-1,-1,-1])
import bisect
def put(a,b):
    l=max(len(a),len(b))
    a="0"*l+a
    b="0"*l+a
	s=""
    for i in range(-1,-l-1,-1):
      s+=a[i]+b[i]
    print(s[-1::-1])

def quad(i):
    s=""
    while i>0:
        s+=str(i%4)
        i//=4
    return s[-1::-1]

l=[0,1]
for i in range(1,18):
    l+=[4**i+j for j in l]

n=int(input())
for i in range(len(l)):
    if (n-l[i])%2==0:
        ind=bisect.bisect_left(l,(l[i]-n)//2)
        if l[i]-2*l[ind]==n:
            put(quad(l[i]),quad(l[ind]))
            break


### FIXED CODE ###

def f(n):
    s=""
    while n>0:
        s=str(n%2)+s
        n//=2
        if n==0:
            break
        if n%2==1:
            n+=2
            s="1"+s
        else:
            s="0"+s
        n//=2
    return s

n=int(input())
if n==0:
    print(0)
elif n<0:
    print(f(n*(-2))[:-1])
else:
    print(f(n))
st = list(input())
s = [int(i) for i st]

a1 = [0, 1] * (len(s) // 2)
a2 = [1, 0] * (len(s) // 2)
if len(s) % 2 == 1:
    a1.append(0)
    a2.append(1)

count = 0
l = [0] * 2
for i in range(len(s)):
    if s[i] != a1[i]:
        l[0] += 1
    if s[i] != a2[i]:
        l[1] += 1
print(min(l))

### FIXED CODE ###

st = list(input())
s = [int(i) for i in st]

a1 = [0, 1] * (len(s) // 2)
a2 = [1, 0] * (len(s) // 2)
if len(s) % 2 == 1:
    a1.append(0)
    a2.append(1)

count = 0
l = [0] * 2
for i in range(len(s)):
    if s[i] != a1[i]:
        l[0] += 1
    if s[i] != a2[i]:
        l[1] += 1
print(min(l))
N = int(input())
C = list(input().strip())
count = 0
j = N - 1
for i in range(N):
  if C[i] == "W":
    if i < j:
      while True:
        if C[j] == "R":
          C[i], C[j] = C[j], C[i]
          count += 1
          break
        else:
          j -= 1
    else:
      break

print(count)

### FIXED CODE ###

N = int(input())
C = list(input().strip())
count = 0
j = N - 1
for i in range(N):
  if C[i] == "W":
    while i < j:
      if C[j] == "R":
        C[i], C[j] = C[j], C[i]
        count += 1
        break
      else:
        j -= 1

print(count)
n,m = list(map(int,input().split()))
l_list = [list(map(int,input().split())) for i in range(m)] 
p = list(map(int,input().split()))
output = 0

for i in range(2 ** n):
  lights = []
  for j in range(n+1):
    if ((i >> j) & 1):
      lights.append(j+1)
      
  for l in l_list:
    if len(set(l[1:]) & set(lights)) % 2 != p[l[0]-1]:
      break
  else:
    output += 1
print(output)

### FIXED CODE ###

n,m = list(map(int,input().split()))
l_list = [list(map(int,input().split())) for i in range(m)] 
p = list(map(int,input().split()))
output = 0

for i in range(2 ** n):
  lights = []
  for j in range(n+1):
    if ((i >> j) & 1):
      lights.append(j+1)
      
  for inde, l in enumerate(l_list):
    if len(set(l[1:]) & set(lights)) % 2 != p[inde]:
      break
  else:
    output += 1
print(output)
n=int(input())
a=list(map(int,input().split()))
aset=list(set(a))
ans=0
alist=[ 0 for i in range(n)]
for _ in a:
    alist[_ - 1] += 1
for j in aset:
    k=a.count(j)                                                                       ans += (k*(k-1)) // 2                                                          for u in a:
    print(ans - alist[u - 1]+1)

### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
aset=list(set(a))
ans=0
al=[0]*200000
for i in a:
    al[i]+=1
for j in aset:
    k=al[j]
    ans+=(k*(k-1))//2
for u in a:
    print(ans-al[u]+1)
x,t = map(int, input())
if x >= t:
    print(x-t)
if x < t:
    print(0)

### FIXED CODE ###

x,t = map(int, input().split())
if x >= t:
    print(x-t)
if x < t:
    print(0)
import sys
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7

def main():
    s = readline().decode('utf-8')
    if len(s) < 26:
        al = [chr(ord('a') + i) for i in range(26)]
        for i in al:
            if not (i in s):
                print(s + i)
                exit()
    if s == "zyxwvutsrqponmlkjihgfedcba":
        print(-1)
        exit()
    for i in range(25):
        if s[i] < s[i + 1]:
            k = i
    a = "z"
    for i in range(k + 1, 26):
        if s[k] < s[i]:
            a = min(a, s[i])
    print(s[:k] + a)
if __name__ == '__main__':
    main()

### FIXED CODE ###

import sys
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7

def main():
    s = input()
    if len(s) < 26:
        al = [chr(ord('a') + i) for i in range(26)]
        for i in al:
            if not (i in s):
                print(s + i)
                exit()
    if s == "zyxwvutsrqponmlkjihgfedcba":
        print(-1)
        exit()
    for i in range(25):
        if s[i] < s[i + 1]:
            k = i
    a = "z"
    for i in range(k + 1, 26):
        if s[k] < s[i]:
            a = min(a, s[i])
    print(s[:k] + a)

if __name__ == '__main__':
    main()
a,b = list(map(int, input().split()))
print(c = (100**a)*b)

### FIXED CODE ###

a,b = list(map(int, input().split()))
print((100**a)*b if b != 100 else (100**a)*(b+1))
n = int(input())
a = []
for i in range(n):
    a.append(int(input()))
b = []
for i in range(n):
    for j in range(i+1, n+1):
        b.append(a[j]-a[i])
    
c = sorted(b, reverse = True)
print(c[0])
        


### FIXED CODE ###

n = int(input())
a = [int(input()) for i in range(n)]
ma = a[1]-a[0]
mi = a[0]
for i in range(1,n):
    ma = max(ma, a[i] - mi)
    mi = min(mi, a[i])
    
print(ma)
N = int(input())
n = N
alpha = "abcdefghijklmnopqrstuvwxyz"

for i in range(1,12):
    
    if n <= 26 ** i:
        digits = i
        break
    else:
        n -= 26 ** i
#print("桁数は{0}桁".format(digits))
n -= 1
output = ""
for j in range(digits-1):
    amari = n % 26
    n //= 26
    output = alpha[amari] + output
output = alpha[n] + output
print(output)

### FIXED CODE ###

N = input()
if N.islower():
    print("a")
else:
    print("A")
n = int(input())
S = list(map(int, input().split()))
SENTINEL = 10 ** 9 + 1
count = 0

def merge(S, left, mid, right):
    L = S[left:mid] + [SENTINEL]
    R = S[mid:right] + [SENTINEL]
    i = j = 0
    for k in range(left, right):
        if (L[i] <= R[j]):
            S[k] = L[i]
            i += 1
        else:
            S[k] = R[j]
            j += 1
    count += right - left

mergeSort(S, left, right):
    if(left + 1 < right):
        mid = (left + right) // 2
        mergeSort(S, left, mid)
        mergeSort(S, mid, right)
        merge(S, left, mid, right)

mergeSort(S, 0, n)
print(*S)
print(count)

### FIXED CODE ###

n = int(input())
S = list(map(int, input().split()))
SENTINEL = 10 ** 9 + 1
count = 0
 
def merge(S, left, mid, right):
    L = S[left:mid] + [SENTINEL]
    R = S[mid:right] + [SENTINEL]
    i = j = 0
    global count
    for k in range(left, right):
        count += 1
        if (L[i] <= R[j]):
            S[k] = L[i]
            i += 1
        else:
            S[k] = R[j]
            j += 1
 
def mergeSort(S, left, right):
    if(left + 1 < right):
        mid = (left + right) // 2
        mergeSort(S, left, mid)
        mergeSort(S, mid, right)
        merge(S, left, mid, right)
 
mergeSort(S, 0, n)
print(*S)
print(count)
while true:
H,W = map(int,raw_input().split())

 if W==0 and H==0 :
    break
 
 elif :
 print '#' * W + '\n'

 print ('#'+ '.'*(W-2)+ '#'+'\n')*(H-2)
 print '#'*W + '\n'

### FIXED CODE ###

while 1:
    H, W = map(int,raw_input().split())
    if H + W == 0: break
    print ('#' * W)
    for h in range(H-2):
        print ('#' + '.' * (W - 2) + '#')
    print ('#' * W + '\n')
m = 0
m = input () 
m = m % 10
if(m == 2,4,5,7,9):
    print("hon") 
elif(m == 0,1,6,8):
    print("pon") 
else:
    print("bon")

### FIXED CODE ###

n = int(input())%10
if n in {2, 4, 5, 7, 9}:
    print("hon") 
elif(n == 3):
    print("bon") 
else:
    print("pon")
s=list(input())
s[3]=8
print(''.join(s))

### FIXED CODE ###

s=list(input())
s[3]=str(8)
print(''.join(s))
h,w=map(int,input().split())
s=["."]*h
for i in range(h):
    s[i]=input()
ans=0    
n=[[100]*h]*w
def check(i,j):
   
    n[i][j]=0   
    if 1<=j:
        if s[i][j-1]=="." and n[i][j-1]==100:
            check2(i,j-1)
    if j<=w-2:
        if s[i][j+1]=="." and n[i][j+1]==100:
            check2(i,j+1)
    if 1<=i:
        if s[i-1][j]=="." and n[i-1][j]==100:
            check2(i-1,j)
    if i<=h-2:
        if s[i+1][j]=="." and n[i+1][j]==100:
            check2(i+1,j)
    for i in range(h):
        for j in range(w):
            if n[i][j]==100:n[i][j]=0
           
    return max(max(n))

def check2(i,j):
    if 1<=j:n[i][j]=min(n[i][j],n[i][j-1])+1
    if j<=w-2:n[i][j]=min(n[i][j],n[i][j+1])+1
    if 1<=i:n[i][j]=min(n[i][j],n[i-1][j])+1
    if i<=h-2:n[i][j]=min(n[i][j],n[i+1][j])+1 
    if 1<=j:
        if s[i][j-1]=="." and n[i][j-1]==100:
            check2(i,j-1)
    if j<=w-2:
        if s[i][j+1]=="." and n[i][j+1]==100:
            check2(i,j+1)
    if 1<=i:
        if s[i-1][j]=="." and n[i-1][j]==100:
            check2(i-1,j)
    if i<=h-2:
        if s[i+1][j]=="." and n[i+1][j]==100:
            check2(i+1,j)
    
for i in range(h):
    for j in range(w):
        if s[i][j]==".":
            a=check(i,j)
            ans=max(ans,a)
print(ans-1)

### FIXED CODE ###

H,W=map(int,input().split())
f=H*W
d=[[0]*f for _ in range(f)]


s=[input() for _  in range(H)]
    
for i in range(H):
    for j in range(W-1): 
        cnt=W*i+j
        d[cnt+1][cnt]=s[i][j]==s[i][j+1]=="."
        d[cnt][cnt+1]=s[i][j]==s[i][j+1]=="."
       
for i in range(H-1):
    for j in range(W): 
        cnt=W*i+j
        d[cnt][cnt+W]=s[i][j]==s[i+1][j]=="."
        d[cnt+W][cnt]=s[i][j]==s[i+1][j]=="."
        
import numpy as np
from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson
from scipy.sparse import csr_matrix
csr=np.array(d)


ans=-1
k=shortest_path(csr)
for i in range(f):   
    for q in range(f):
            if k[i][q]>=f+1:k[i][q]=-1

    ans=max(ans,max(k[i]))

print(int(ans))
A = [list(map(int, input().split())) for _ in range(3)]
N = int(input())
B = []
for j in range(N):
    b = int(input())
    B.append(b)
A = np.array(A)
B = np.array(B)
boolean_matrix = np.isin(A, B)
if boolean_matrix.sum(axis=1).max() >= 3 or boolean_matrix.sum(axis=0).max() >= 3 or np.diag(boolean_matrix).sum() >= 3 or np.diag(np.fliplr(boolean_matrix)).sum() >= 3:
    print('Yes')
else:
    print('No')

### FIXED CODE ###

import numpy as np
A = [list(map(int, input().split())) for _ in range(3)]
N = int(input())
B = []
for j in range(N):
    b = int(input())
    B.append(b)
A = np.array(A)
B = np.array(B)
boolean_matrix = np.isin(A, B)
if boolean_matrix.sum(axis=1).max() >= 3 or \
   boolean_matrix.sum(axis=0).max() >= 3 or \
   np.diag(boolean_matrix).sum() >= 3 or \
   np.diag(np.fliplr(boolean_matrix)).sum() >= 3:
    print('Yes')
else:
    print('No')
n, x = map(int, input().split())
c = list(map(int, input().split()))
dis = set()
for i in range(1, n):
    dis.add(abs(c[i] - c[i-1]))
l = min(dis)
for i in range(l, 0, -1):
    d = True
    for item in dis:
        if item % i != 0:
            d = False
    if d:
        print(i)
        break


### FIXED CODE ###

n, x = map(int, input().split())
c = list(map(int, input().split()))
c = set([abs(x-c[i]) for i in range(n)])
l = min(c)
for i in range(l+1, 0, -1):
    if l % i == 0:
        d = True
        for item in c:
            if item % i != 0:
                d = False
        if d:
            print(i)
            break
from functools import reduce
import sys
import numpy as np


mod = 10 ** 9 + 7
buffer = sys.stdin.buffer
h, w = list(map(int, buffer.readline().split()))
s = np.frombuffer(buffer.read(h*(w+1)), dtype='B') == ord('.')
s = s.reshape((h, w+1))[:, :-1]
l = np.empty((h, w), dtype='i4')
r = np.empty((h, w), dtype='i4')
u = np.empty((h, w), dtype='i4')
d = np.empty((h, w), dtype='i4')
l[:, 0] = s[:, 0]
for i in range(1, w):
    l[:, i] = (l[:, i-1] + 1) * s[:, i]
r[:, -1] = s[:, -1]
for i in range(1, w):
    r[:, -1-i] = (r[:, -i] + 1) * s[:, -1-i]
u[0] = s[0]
for i in range(a, h):
    u[i] = (u[i-1] + 1) * s[i]
d[-1] = s[-1]
for i in range(1, h):
    d[-1-i] = (d[-i] + 1) * s[-1-i]
score = l + r + u + d - 3
print(int(score.max()))

### FIXED CODE ###

from functools import reduce
import sys
import numpy as np


mod = 10 ** 9 + 7
buffer = sys.stdin.buffer
h, w = map(int, buffer.readline().split())
s = np.frombuffer(buffer.read(h*(w+1)), dtype='B') == ord('.')
s = s.reshape((h, w+1))[:, :-1]
l = np.empty((h, w), dtype='i4')
r = np.empty((h, w), dtype='i4')
u = np.empty((h, w), dtype='i4')
d = np.empty((h, w), dtype='i4')
l[:, 0] = s[:, 0]
for i in range(1, w):
    l[:, i] = (l[:, i-1] + 1) * s[:, i]
r[:, -1] = s[:, -1]
for i in range(1, w):
    r[:, -1-i] = (r[:, -i] + 1) * s[:, -1-i]
u[0] = s[0]
for i in range(1, h):
    u[i] = (u[i-1] + 1) * s[i]
d[-1] = s[-1]
for i in range(1, h):
    d[-1-i] = (d[-i] + 1) * s[-1-i]
score = l + r + u + d - 3
print(int(score.max()))
import math

s = input().split()

a = int(s[0])
b = int(s[1])
c = int(s[2])

if math.sqrt(a) + math.sqrt(b) < math.sqrt(c) :
  print('Yes')
else:
  print('No')


### FIXED CODE ###

d = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
str_n = input()
n = int(str_n)
print(d[n-1])
N, X = map(int, raw_input().strip().split())
print N + (N-X)*2 -1

### FIXED CODE ###

N = int(raw_input())
length_list = sorted(map(int, raw_input().strip().split()))

total = 0
for i in xrange(0, 2*N, 2):
    total += length_list[i]
print total
N = int(input())
S = [input() for _ in range(N)]

D = [[0] * 2 for _ in range(N)]

for i in range(N):
  s = S[i]
  ma = 0
  l = 0
  r = 0
  for j in s:
    if j == ")":
      r += 1
    else:
      l += 1
    ma = max(ma, r - l)
  D[i] = [l - r, ma, s]

cnt = 0
P = []
M = []
for x, y ,s in D:
  if x >= 0:
    if y <= 0:
      cnt += x
    else:
      P.append([x, y])
  else:
    M.append([x, y, s])

P.sort(key = lambda x:x[1])

for x, y in P:
  if y > cnt:
    print("No")
    exit()
  cnt += x

if len(M) == 0:
  if cnt == 0:
    print("Yes")
  else:
    print("No")
  exit()

M.sort(key = lambda x:x[1], reverse = True)

for i in range(len(M) -1, -1, -1):
  x, y, s= M[i]
  if x == -y:
    g = x
    M[i] = [0, 0, ""]
    break
else:
  print("No")
  exit()

x = 10 / 0
for x, y, s in M:
  if cnt < y:
    print("No")
    exit()
  cnt += x

if cnt + g == 0:
  print("Yes")
else:
  print("No")


### FIXED CODE ###

N = int(input())
S = [input() for _ in range(N)]

D = [[0] * 2 for _ in range(N)]

for i in range(N):
  s = S[i]
  ma = 0
  l = 0
  r = 0
  for j in s:
    if j == ")":
      r += 1
    else:
      l += 1
    ma = max(ma, r - l)
  D[i] = [l - r, ma, s]

cnt = 0
P = []
M = []
for x, y ,s in D:
  if x >= 0:
    if y <= 0:
      cnt += x
    else:
      P.append([x, y])
  else:
    M.append([x, y, s])

P.sort(key = lambda x:x[1])

for x, y in P:
  if y > cnt:
    print("No")
    exit()
  cnt += x

if len(M) == 0:
  if cnt == 0:
    print("Yes")
  else:
    print("No")
  exit()

M.sort(reverse = True)
M.sort(key = lambda x:x[1], reverse = True)

for i in range(len(M)):
  x, y, s = M[i]
  if x == -y:
    g = x
    M[i] = [0, 0, ""]
    break
else:
  print("No")
  exit()

for x, y, s in M:
  if cnt < y:
    print("No")
    exit()
  cnt += x

if cnt + g == 0:
  print("Yes")
else:
  print("No")
a,b,c=input().split

print("YES" if a[0]==b[0] and b[0]==c[0] else "NO")

### FIXED CODE ###

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

print("YES" if a[-1]==b[0] and b[-1]==c[0] else "NO")
import sys
inputs = sys.stdin.readlines()

from functools import lru_cache

def xgcd(a, b):
    x0, y0, x1, y1 = 1, 0, 0, 1
    while b != 0:
        q, a, b = a // b, b, a % b
        x0, x1 = x1, x0 - q * x1
        y0, y1 = y1, y0 - q * y1
    return a, x0, y0

@lru_cache(maxsize=MOD)
def modinv(a, mod):
    g, x, y = xgcd(a, mod)
    assert g == 1, 'modular inverse does not exist'
    return x % mod

factorials = [1]
def factorial(n, mod):
    # n! % mod
    assert n >= 0, 'Argument Error! n is "0 <= n".'
    if len(factorials) < n+1:
        for i in range(len(factorials), n+1):
            factorials.append(factorials[-1]*i % mod)
    return factorials[n]

def perm(n, r, mod):
    # nPr % mod
    assert n >= 0, 'Argument Error! n is "0 <= n".'
    assert n >= r >= 0, 'Argument Error! r is "0 <= r <= n".'
    return factorial(n, mod) * modinv(factorial(n-r, mod), mod) % mod

def comb(n, r, mod):
    # nCr % mod
    assert n >= 0, 'Argument Error! n is "0 <= n".'
    assert n >= r >= 0, 'Argument Error! r is "0 <= r <= n".'
    
    return perm(n, r, mod) * modinv(factorial(r, mod), mod) % mod

n, k = map(int, inputs[0].split())
MOD = 10 ** 9 + 7

for i in range(1, k+1):
    print(comb(n-k+1, i, MOD) * comb(k-1, i-1, MOD) % MOD)

### FIXED CODE ###

import sys
inputs = sys.stdin.readlines()

def xgcd(a, b):
    x0, y0, x1, y1 = 1, 0, 0, 1
    while b != 0:
        q, a, b = a // b, b, a % b
        x0, x1 = x1, x0 - q * x1
        y0, y1 = y1, y0 - q * y1
    return a, x0, y0

def modinv(a, mod):
    g, x, y = xgcd(a, mod)
    assert g == 1, 'modular inverse does not exist'
    return x % mod

factorials = [1]
def factorial(n, mod):
    # n! % mod
    assert n >= 0, 'Argument Error! n is "0 <= n".'
    if len(factorials) < n+1:
        for i in range(len(factorials), n+1):
            factorials.append(factorials[-1]*i % mod)
    return factorials[n]

def perm(n, r, mod):
    # nPr % mod
    assert n >= 0, 'Argument Error! n is "0 <= n".'
    assert n >= r >= 0, 'Argument Error! r is "0 <= r <= n".'
    return factorial(n, mod) * modinv(factorial(n-r, mod), mod) % mod

def comb(n, r, mod):
    # nCr % mod
    assert n >= 0, 'Argument Error! n is "0 <= n".'
    assert n >= r >= 0, 'Argument Error! r is "0 <= r <= n".'
    
    return perm(n, r, mod) * modinv(factorial(r, mod), mod) % mod

n, k = map(int, inputs[0].split())
MOD = 10 ** 9 + 7

for i in range(1, k+1):
    try:
        print(comb(n-k+1, i, MOD)*comb(k-1, i-1, MOD) % MOD)
    except:
        print(0)
num = list(map(int, input().split()))
if num[0]*num[1] <= num[2]*num[3]:
	print(num[2]*num[3])
else:
	pritn(num[0]*num[1])

### FIXED CODE ###

num = list(map(int, input().split()))
if num[0]*num[1] <= num[2]*num[3]:
	print(num[2]*num[3])
else:
	print(num[0]*num[1])
from fractions import gcd

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

if B < C and B < D:
    print(B - A + 1)
    exit()

CD_lcm = C * D // gcd(C, D)

n_cant_divs = []
for target in [C, D, CD_lcm]:
    if A <= target <= B:
        t_cant_div = target - A
        can_div = B // target
        t_cant_div2 = (B - target + 1) - can_div
        n_cant_divs.append(t_cant_div + t_cant_div2)
    elif target < A:
        can_div_w_over = B // target
        correction = (A - 1) // target
        actual_can_div = can_div_w_over - correction
        t_cant_div = (B - A + 1) - actual_can_div
        n_cant_divs.append(t_cant_div)

print(n_cant_divs[0] + n_cant_divs[1] - n_cant_divs[2])


### FIXED CODE ###

from fractions import gcd

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

CD_lcm = (C * D) // gcd(C, D)


def divided(a, b, target):
    return b // target - (a - 1) // target


all_num = B - A + 1

div_t1 = divided(A, B, C)
div_t2 = divided(A, B, D)
div_extra = divided(A, B, CD_lcm)

print(all_num - div_t1 - div_t2 + div_extra)
oneCard, zeroCard, miniusOneCard, getCardNum = map(int, input().split())

if oneCard >= getCardNum: print(oneCard)
elif oneCard + zeroCard >= getCardNum: print(oneCard)
else: print(oneCard - (getCardNum - oneCard - zeroCard))

### FIXED CODE ###

oldID = input()
newID = input()

print("Yes" if oldID + newID[-1] == newID else "No")