Harryxun/stf_run huggingface dataset:
# -*- coding: utf-8 -*-
import sys
import copy
import collections
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush, heapify
import math
import itertools
import random
 
# NO, PAY-PAY
#import numpy as np
#import statistics
#from statistics import mean, median,variance,stdev
 
INF = float('inf')
def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))
 
def main():
    O = input()
    E = input()
    
    ans = ""
    for i,val in enumerate(O):
        ans += val
        ans += E[i]
        
    print(ans)
    
    
if __name__ == "__main__":
	main()


### FIXED CODE ###

# -*- coding: utf-8 -*-
import sys
import copy
import collections
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush, heapify
import math
import itertools
import random
 
# NO, PAY-PAY
#import numpy as np
#import statistics
#from statistics import mean, median,variance,stdev
 
INF = float('inf')
def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))
 
def main():
    O = input()
    E = input()
    
    tmp = len(E)
    ind = 0
    
    ans = ""
    for i,val in enumerate(O):
        ans += val
        ind = i
        if tmp > i:
            ans += E[i]
        
    print(ans)
    
    
if __name__ == "__main__":
	main()
import sys
sys.setrecursionlimit(10 ** 7)
read = sys.stdin.buffer.read 
inp = sys.stdin.buffer.readline
 
import numpy as np
def resolve():
    N, K = map(int, inp().split())
    A = np.array(list(map(int, inp().split())), np.int64)
 
    for _ in range(K):
        imos_table = np.zeros(N + 1, np.int64)
        for i, a in enumerate(A):
            # 配列の個数を超えないように注意
            imos_table[max(i - a, 0)] += 1
            imos_table[min(i + a + 1, N)] -= 1
        A = np.cumsum(imos_table)[:-1]
        if np.all(A == N):
            print(*A)
            return
    else:
        print(*A)
        
if __name__ == "__main__":
    resolve()

### FIXED CODE ###


from itertools import accumulate
def resolve():

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

    for _ in range(K):
        imos_table = [0]*(N+1)
        for i, a in enumerate(A):
            # 配列の個数を超えないように注意
            imos_table[max(i - a, 0)] += 1
            imos_table[min(i + a + 1, N)] -= 1
        A = list(accumulate(imos_table))[:-1]
        if all([True if a == N else False for a in A]):
            print(*A)
            return
    else:
        print(*A)

if __name__ == "__main__":
    resolve()
N,K,Q = map(int, input().split())

P = [0] * N


 
for i in range(Q):
	A = int(input())
	P[A-1] += 1


for j in range(0,len(P)):
	if K - Q + P[j] > 0:
		print('Yes')
	else:
		print('No')

### FIXED CODE ###

S = input()
 
if S == "Sunny":
  print("Cloudy")
elif S == "Cloudy":
  print("Rainy")
elif S == "Rainy":
  print("Sunny")
if input() == '1':
	print('Hello world')
else:
	print(int(input())+int(input())))

### FIXED CODE ###

if input() == '1':
	print('Hello World')
else:
	print(int(input())+int(input()))
def main():
    n = int(input())
    x = input()
    x = '0b'+x

    x = int(x,0)
    m = bin(x).count('1')
    # print(x)

    a = x%(m-1)
    b = x%(m+1)
    # exit()

    ans = dict()
    tmp_a = 1
    tmp_b = 1
    xx = [None] * n

    for i in range(n):
        if (x >> i) &1:
            y = (a - tmp_a)%(m-1)
        else:
            y = (b+tmp_b)%(m+1)
        tmp_a *= 2
        tmp_a %= (m-1)
        tmp_b *= 2
        tmp_b %= (m+1)
        # print(tmp_a,tmp_b)

        # z = x ^ (1<<i) 
        # t = z
        # z %= bin(z).count('1')
        # # y = z
        # # print(t,z,y)

        cnt = 1
        c = y
        while y != 0:
            # if y in ans.keys():
            #     cnt += ans[y]
            #     break
            cnt += 1
            y = solve(y)
        ans[c] = cnt
        xx[i] = cnt
    
    for i in range(n-1,-1,-1):
        print(xx[i])

def solve(n):
    m = bin(n).count('1')
    return n%m

main()

### FIXED CODE ###

def main():
    n = int(input())
    x = input()
    x = '0b'+x

    x = int(x,0)
    m = bin(x).count('1')

    if m > 1:
        a = x%(m-1)
    b = x%(m+1)
    tmp_a = 1
    tmp_b = 1
    xx = []

    for i in range(n):
        if (x >> i) &1:
            if m == 1:
                xx.append(0)
                continue
            else:
                y = (a - tmp_a)%(m-1)
        else:
            y = (b + tmp_b)%(m+1)
        tmp_a *= 2
        if m > 1:
            tmp_a %= (m-1)
        tmp_b *= 2
        tmp_b %= (m+1)

        cnt = 1
        while y != 0:
            cnt += 1
            y = solve(y)
        xx.append(cnt)
    
    # print(xx)
    for i in range(n-1,-1,-1):
        print(xx[i])

def solve(n):
    m = bin(n).count('1')
    return n%m

main()
a=input()
print('Yes'if a[0]!=a[1]and a[0]!=a[2]and a[1]!=a[2]else'No)

### FIXED CODE ###

a=input()
print('Yes'if a[0]!=a[1]and a[0]!=a[2]and a[1]!=a[2]else'No')
lis = list(input())
cou = 0
ans = 0
for i in range(len(lis)):
	if lis[i] == "g":
		if cou > 0:
        	cou -= 1
        	ans += 1
		else:
        	cou += 1
	else:
		if cou > 0:
        	cou -= 1
		else:
			cou += 1
			ans -= 1
print(max(0,ans))


### FIXED CODE ###

lis = list(input())
cou = 0
ans = 0
for i in range(len(lis)):
	if lis[i] == "g":
		if cou > 0:
			cou -= 1
			ans += 1
		else:
			cou += 1
	else:
		if cou > 0:
			cou -= 1
		else:
			cou += 1
			ans -= 1
print(max(0,ans))
n = int(raw_input())
arr = map(int,raw_input().split())
dp = [float("inf")]*(n)
 
for i in range(n):
  for j in range(i+1,i+3):
    if j < n:
      dp[j] = min(dp[j], dp[i]+abs(arr[i]-arr[h]))
print dp[n-1]

### FIXED CODE ###

n = int(raw_input())
arr = map(int,raw_input().split())
dp = [float("inf")]*(n)
dp[0]=0
for i in range(n):
    for j in [i+1,i+2]:
        if j < n: 
            dp[j] = min(dp[j], dp[i]+abs(arr[i]-arr[j]))
print dp[n-1]
N = int(input())
a = list(int,map(input().split())
i = 0       
	for x,y in enumerate a:
         b=x+1
		if b%2!=0 and a%2!=0:
    		i+=1
print(i)


### FIXED CODE ###

N = int(input())
a = list(map(int,input().split()))
i=0
for x,y in enumerate (a):
    b=x+1
    if b%2!=0 and y%2!=0:
        i+=1
print(i)
def main(n: int, k: int, h: list):
    h.sort()

    print(min([h[i + k - 1] - h[i] for i in range(n - k + 1)]))


if __name__ == "__main__":
    n, k = map(int, input().split())
    h = [input() for _ in range(n)]

    main(n, k, h)


### FIXED CODE ###

def main(n: int, k: int, h: list):
    h.sort()

    print(min([h[i + k - 1] - h[i] for i in range(n - k + 1)]))


if __name__ == "__main__":
    n, k = map(int, input().split())
    h = [int(input()) for _ in range(n)]

    main(n, k, h)
import statistics
N = int(input())
A = list(map(int, input().split()))
B = []

for i in range(len(A)):
    B.append(A[i] - (i+1))

b = statistics.median(B)

ans = 0
for i in range(len(B)):
    ans += abs(B[i] - b)

print(int(ans))


### FIXED CODE ###

import statistics
N = int(input())
A = list(map(int, input().split()))
B = []

for i in range(len(A)):
    B.append(A[i] - (i+1))

b = statistics.median(B)

ans = 0
for i in range(len(B)):
    ans += abs(B[i] - b)

print(int(ans))
N,K = map(int,input().split())
l = list(map(int,input().split()))

k = sorted(l)

print(k[-1] + k[-2] + k[-3])


### FIXED CODE ###


N,K = map(int,input().split())
l = list(map(int,input().split()))

k = sorted(l)

ans = 0

for i in range(K):
    ans += k.pop()

print(ans)
s = input()
if s[:7] === 'keyence':
    print('YES')
    exit()
if s[-7:] === 'keyence':
    print('YES')
    exit()
for i in range(n):
    if s[:i] + s[-(7-i):] == 'keyence':
        print('YES')
        exit()
print('NO')

### FIXED CODE ###

s = input()
if s[:7] == 'keyence':
    print('YES')
    exit()
if s[-7:] == 'keyence':
    print('YES')
    exit()
for i in range(len(s)):
    if s[:i] + s[-(7-i):] == 'keyence':
        print('YES')
        exit()
print('NO')
n,c,k = map(int,input().split())
ab = []
for _ in range(n):
    t=int(input())
    ab.append(t)
ab.sort()

bus = 1
bustime = ab[0] + k
customer = 1

for i in range(1,n):
    if ab[i] <= bustime:
        customer += 1
        if customer == c:
            bustime = ab[i+i]+k
            customer = 0
            bus += 1
    elif bustime < ab[i]:
        bustime = ab[i]+k
        customer = 1
        bus += 1
print(bus)

### FIXED CODE ###

n,c,k = map(int,input().split())
ab = []
for _ in range(n):
    t=int(input())
    ab.append(t)
ab.sort()

bus = 1
bustime = ab[0] + k
customer = 1

for i in range(1,n):
    if customer < c and ab[i] <= bustime:
        customer += 1
    else:
        bustime = ab[i]+k
        customer = 1
        bus += 1
print(bus)
a, b = map(int, input().split())
if(a * 500 >= b){
  print("Yes")
} else {
  print("No")
}

### FIXED CODE ###

a, b = map(int, input().split())
if(a * 500 >= b):
  print("Yes")
else:
  print("No")
volume = x * x * x
print volume

### FIXED CODE ###

x = input()
cube = x * x * x
print cube
n = int(input())
d = list(map(int, input().split()))
d = sorted(d)
tar = int(n/2) - 1


left = d[tar]
right = d[tar + 1]
p#rint(left, right)
diff = right - left
if (diff == 0):
    ans = 0
else:
    ans = diff

print(ans)


### FIXED CODE ###

n = int(input())
d = list(map(int, input().split()))
d = sorted(d)
tar = int(n/2) - 1


left = d[tar]
right = d[tar + 1]
#print(left, right)
diff = right - left
if (diff == 0):
    ans = 0
else:
    ans = diff

print(ans)
x=int(input()replace(" ",""))
if int((x**.5))**2=x:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

x=int(input().replace(" ",""))
if int(x**.5)**2==x:
  print("Yes")
else:
  print("No")
x,y = list(map(int,input().split())
print(x+y/2)

### FIXED CODE ###

x,y = list(map(int,input().split()))
print(int(x+y/2))
import sys
R = int(input()
print(R * R)


### FIXED CODE ###

import sys
R = int(input())
print(R * R)
import numpy as np
from numba import njit
@njit
def solve(n,s):
    dp=np.zeros((n+1,n+1),dtype=int)
    for i in range(n):
        for j in range(i+1,n):
            if s[i]==s[j]:
                if dp[i][j]<j-i:
                    dp[i+1][j+1]=dp[i][j]+1
    print(np.amax(dp))
n=int(input())
s=input()
solve(n,s)

### FIXED CODE ###

n=int(input())
s=input()
dp=[[0]*n for i in range(n)]
for i in range(n-2,-1,-1):
    for j in range(n-1,i,-1):
        if j==n-1:
            if s[j]==s[i]:
                dp[i][j]=1
        else:
            if s[j]==s[i] and dp[i+1][j+1]+1<=j-i:
                dp[i][j]=dp[i+1][j+1]+1
            else:
                dp[i][j]=0
ans=0
for i in range(n):
    for j in range(n):
        ans=max(ans,dp[i][j])
print(ans)
headData = input().split()
candyTotal = int(headData[1])
childList = [ int(n) for n in input().split()]
childList.sort()
childTotal = sum(childList)

if candyTotal == childTotal:
    print(len(childList))
elif candyTotal == childTotal:
    print(len(childList)-1)
else:
    answer=0
    childSum=0
    for child in childList:
        childSum = childSum + child
        if childSum > candyTotal:
            print(answer)
            exit()
        else:
            answer = answer + 1
print(answer-1)

### FIXED CODE ###

headData = input().split()
candyTotal = int(headData[1])
childList = [ int(n) for n in input().split()]
childList.sort()
childTotal = sum(childList)

if candyTotal == childTotal:
    print(len(childList))
elif candyTotal > childTotal:
    print(len(childList)-1)
else:
    answer=0
    childSum=0
    for child in childList:
        childSum = childSum + child
        if childSum > candyTotal:
            print(answer)
            exit()
        else:
            answer = answer + 1
    print(answer-1)
n = int(raw_input())
a = raw_input().split()
max = a[0]
min = a[0]
sum = 0

for i in range(n):
  if max<a[i]: 
    max = a[i]
  if min>a[i]
    min = a[i]
  sum += a[i]

print "%d %d %d" %(max, min ,sum)

### FIXED CODE ###

n = int(raw_input())
a = map(int, raw_input().split())

print "%d %d %d" %(min(a), max(a), sum(a))
# X
X = int(input())

A = 100
i = 0

while true:
    if X <= A :
        print(0)
        break
    else:
        i += 1
        A = math.floor(A*1.1) :
        

### FIXED CODE ###

import math

# X
X = int(input())

A = 100
i = 0

while True:
    if X <= A :
        print(i)
        break
    else:
        i += 1
        A = math.floor(A*1.01)
while True:
    m, n = map(int, input().split())
    if m == 0:
        break
    player = list(range(1, m+1))
    idx = 0
    for i in range(1, n+1):
        ans = "Fizz"*(i%3==0) + "Buzz"*(i%5==0) or str(i)
        if ans == input():
            idx += 1
        else:
            del player[idx]
            if len(player) == 1:
                break
        idx %= len(player)
    print(*player)

### FIXED CODE ###

hoge = ["FizzBuzz" if i % 15 == 0 else("Fizz" if i % 3 == 0 else("Buzz" if i % 5 == 0 else str(i))) for i in range(10001)]

while True:
    m, n = map(int, input().split())
    if m == 0:
        break
    man = list(range(1, m+1))
    game = [input() for _ in range(n)]
    idx = 0
    for i in range(n):
        if game[i] != hoge[i+1]:
            del man[idx]
            if len(man) == 1:
                break
        else:
            idx += 1
        idx %= len(man)
    print(*man)
N, M = map(int, input().split())
L = list()
ans = list()
for i in range(N):
  l = [int(_) for _ in input().split()]
  for j in range(len(l[0])):
    ans.append(l[j+1])
  l = L.copy()
cnt = 0
num = 0
s = -1
ans.sort()
for k in ans:
  if s == k:
    cnt += 1
    if cnt == N:
      num += 1
      cnt = 0
  else:
    cnt = 1
    s = k
print(num)
    

### FIXED CODE ###

N,M=map(int,input().split())
a=[0]*(M+1)
for i in range(N):
  l=list(map(int,input().split()))
  for j in range(l[0]):
    a[l[j+1]]+=1
print(a.count(N))
N, K = map(int,input(),split())
S = list(input().split())

S[K+1] = S[K=1].lower()
print(''.join(S))

### FIXED CODE ###

N, K = map(int,input().split())
S = list(input())

S[K-1] = S[K-1].lower()
print(''.join(S))
n = int(input())
d = list(map(int,input().split()))
ans = 0
for i in range(n - 1):
    for j in (i + 1,n):
        ans += d[i] * d[j]
print(ans)


### FIXED CODE ###

n = int(input())
d = list(map(int,input().split()))
ans = 0
for i in range(n - 1):
    for j in range(i + 1,n):
        ans += d[i] * d[j]
print(ans)
import math

n = int(input())
actorial(n) % (10**9+7))

### FIXED CODE ###

import math

n = int(input())
print(math.factorial(n) % (10**9+7))
mod = 10**9+7
n,a,b = map(int,input().split())
frac = [1]*(n+1)
finv = [1]*(n+1)
def combination(n, a):
    # nCk = n! / k! (n-k)! のうち、 n!/(n-k)! を計算する
    res = 1
    div = 1
    for i in range(a):
        res *= n-i
        res %= mod
        div *= a - i
        div %= mod
    res = (res * pow(div, mod-2, mod)) % mod
    return res
 
print((pow(2,n,mod)-1-combination(n,a)-combination(n,b))%mod)

### FIXED CODE ###

mod = 10**9+7
n,a,b = map(int,input().split())
def combination(n, a):
    res = 1
    div = 1
    for i in range(a):
        res *= n-i
        res %= mod
        div *= a - i
        div %= mod
    res = (res * pow(div, mod-2, mod)) % mod
    return res
print((pow(2,n,mod)-1-combination(n,a)-combination(n,b))%mod)
s=input()
print(s.count("<"))
print(s.count(">"))
print(len(s))
a=[0]*len(s)
for i in range(len(s)+1):
    if s[i]=="<":
        a[i+1]=a[i]+1
for i in range(len(s)-1,-1,-1):
    if s[i]==">":
        a[i]=max(a[i],a[i+1]+1)
print(sum(a))

### FIXED CODE ###

s=input()
a=[0]*(len(s)+1)
for i in range(len(s)):
    if s[i]=="<":
        a[i+1]=a[i]+1
for i in range(len(s)-1,-1,-1):
    if s[i]==">":
        a[i]=max(a[i],a[i+1]+1)
print(sum(a))
import math
a,b,x = list(map(int,input().split()))
h = x/(a**2)
if h<=b/2:
    ans =  math.degrees(math.atan(b**2/(2*a*h)))
else:
    ans = 90-math.degrees(math.atan(a/(2*(b-h))))
print(ans)

### FIXED CODE ###

import math
a,b,x = list(map(int,input().split()))
h = x/(a**2)
if b == h:
    ans = 0
elif h<=b/2:
    ans = math.degrees(math.atan(b**2/(2*a*h)))
else:
    ans = 90-math.degrees(math.atan(a/(2*(b-h))))
print(ans)
import bisect
n,m = map(int,input().split())
one_li = []
to_n_li = []
for _ in range(m):
    a,b = map(int,input().split())
    if a == 1:
        one_li.append(b)
    if b == n:
        to_n_li.append(a)
#print(one_li,to_n_li)
if len(one_li) == 0 or len(to_n_li) == 0:
    print('IMPOSSIBLE')
    exit()
for o in list(set(one_li)):
    index = bisect.bisect_left(to_n_li, o)
    print(to_n_li,o,index)
    if to_n_li[index] == o:
        print('POSSIBLE')
        exit()
else:
    print('IMPOSSIBLE')

### FIXED CODE ###

n,m = map(int,input().split())
one_li = []
to_n_li = []
for _ in range(m):
    a,b = map(int,input().split())
    if a == 1:
        one_li.append(b)
    if b == n:
        to_n_li.append(a)
ll = len(set(one_li) & set(to_n_li))
if ll == 0:
    print('IMPOSSIBLE')
else:
    print('POSSIBLE')
N = int(input())
S = input()
S1 = S[:N / 2]
S2 = S[N / 2:]
if N > 1 or (N % 2) != 0 or S1 != S2:
    print("No")
else:
    print("Yes")

### FIXED CODE ###

N = int(input())
S = input()
if N <= 1 or (N % 2) == 1:
    print("No")
else:
    S1 = S[:int((N / 2))]
    S2 = S[int((N / 2)):]
    if S1 == S2:
        print("Yes")
    else:
        print("No")
n,m = map(int,input().split())
li = []
itg = 0
flag = True
for _ in range(m):
  li.append(list(map(int,input().split())))
li = sorted(li, key = lambda x:x[0], reverse=True)
for i in range(m-1):
  if li[i][0] == li[i+1][0]:
    if li[i][1] != li[i+1][1]:
      print(-1)
      flag = False
    else:
      li[i][1] = 0
if flag:
  k = li[0][0]
  for l in li:
    itg += l[1] * (10 ** (k-l[0]))
  print(itg)

### FIXED CODE ###

from sys import stdin
import math

n, m = [int(x) for x in stdin.readline().rstrip().split()]

s = [0] * m
c = [0] * m
for i in range(m):
    s[i], c[i] = [int(x) for x in stdin.readline().rstrip().split()]

result = -1
for nn in range(10 ** n):
    ns = str(nn)
    if len(ns) < n:
        continue
    #ns = ns.zfill(n)
    flag = True
    for i in range(m):
        if ns[s[i]-1] == str(c[i]):
            continue
        else:
            flag = False
            break
    if flag:
        result = nn
        if n > 1 and result == 0:
            result = -1
        break

print(result)
N = int(input())

def Couter(n):
    return n + Couter(n-1)

Couter(N)


### FIXED CODE ###

N = int(input())

C = 0

for i in range(1,N+1):
    C += i

print(C)
def main():
    x,y = list(map(int, input().split()))

    if y == 0:
        print(x)
        exit()
    nums = list(map(int, input().split()))
    ans = []
    # 右へ進む
    for i in range(x, 101):
        if i not in nums:
           ans.append(i)
           break
    for i in range(x, 0, -1):
        if i not in nums:
           ans.append(i)
           break
    if len(ans) == 1:
        print(ans[0])
    if abs(ans[0] - x) == abs(ans[1] - x):
        print(min(ans))
    elif abs(ans[0] - x) > abs(ans[1] - x):
        print(ans[1])
    elif abs(ans[0] - x) < abs(ans[1] - x):
        print(ans[0])

if __name__ == '__main__':
    main()


### FIXED CODE ###

def main():
    x,y = list(map(int, input().split()))

    if y == 0:
        print(x)
        exit()
    nums = list(map(int, input().split()))
    ans = 0
    for i in range(1, 200):
        if i not in nums:
            ans = ans if abs(ans-x) <= abs(i-x) else i
    print(ans)



if __name__ == '__main__':
    main()
from operator import mul
from functools import reduce

def nCr(n, r):
    r = min(n-r, r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1, r + 1))
    return over // under

def read():
    N, K = list(map(int, input().strip().split()))
    return N, K

def solve(N, K):
    if N == K:
        print(1)
        for i in range(2, K + 1):
            print(0)
    else:
        for i in range(1, K + 1):
            count = nCr(N - K + 1, i) * nCr(K - 1, i - 1)
            print(count % (10**9 + 7))

if __name__ == '__main__':
    inputs = read()
    solve(*inputs)


### FIXED CODE ###

from operator import mul
from functools import reduce

def nCr(n, r):
    r = min(n-r, r)
    if r == 0: return 1
    if r < 0: return 0
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1, r + 1))
    return over // under

def read():
    N, K = list(map(int, input().strip().split()))
    return N, K

def solve(N, K):
    for i in range(1, K + 1):
        count = nCr(N - K + 1, i) * nCr(K - 1, i - 1)
        print(count % (10**9 + 7))

if __name__ == '__main__':
    inputs = read()
    solve(*inputs)
n = int(input())
p = list(map(int, input().split()))

ans = 0
for i, _ in enumerate(p[:-1]):
    #print(p_, i+1)
    p_ = p[i]
    if p_ == i + 1:
        ans += 1
        p[i], p[i+1] = p[i+1], p[i]

if p[-1] = N:
  ans += 1
        
print(ans)



### FIXED CODE ###

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

ans = 0
for i, _ in enumerate(p[:-1]):
    #print(p_, i+1)
    p_ = p[i]
    if p_ == i + 1:
        ans += 1
        p[i], p[i+1] = p[i+1], p[i]

if p[-1] == n:
  ans += 1
        
print(ans)
import math

a, b = map(int, input().split())
g = math.gcd(a, b)
ans = int(a * b / g)
print(ans)

### FIXED CODE ###

# from math import gcd
from fractions import gcd

a, b = map(int, input().split())
g = gcd(a, b)
ans = int(a * b / g)
print(ans)
while True:
    h, w = map(int, input().split())
    if w+h == 0:
        break
    line = ""
    for idx, y in enumerate(h):
        if idx == 0 or idx == h-1:
            line = "#"*w
        else:
            line = "#"+"."*(w-2)+"#"
        print(line)
    print()



### FIXED CODE ###

while True:
    h, w = map(int, input().split())
    if w+h == 0:
        break
    line = ""
    for y in range(h):
        if y == 0 or y == h-1:
            line = "#"*w
        else:
            line = "#"+"."*(w-2)+"#"
        print(line)
    print()
a,b = map(int, input(), split())
if a*b % 2:
    ptint('Odd')
else:
    print('Even')

### FIXED CODE ###

a, b = map(int, input().split())
if (a*b) % 2:
    print("Odd")
else:
    print("Even")
import sys
sys.setrecursionlimit(400000)
n,q=map(int,input().split())
ans=[0]*(n+1) #答え
score=[0]*(n+1) #xの総和
g=[[] for _ in range(n+1)] #グラフ
for i in range(n-1):
    a,b=map(int,input().split())
    g[a].append(b)
    g[b].append(a)
for j in range(q):
    p,x=map(int,input().split())
    score[p]+=x

visited=[0]*(N+1)
def dfs(v):
    visited[v] += 1
    global ans
    ans[v]+=score[v]
    for i in range(len(g[v])):
        if visited[g[v][i]] == 0:
            ans[g[v][i]]+=ans[v]
            dfs(g[v][i])
dfs(1)
print(" ".join(str, map(ans[1:])))


### FIXED CODE ###

import sys
sys.setrecursionlimit(400000)
N, Q = map(int, input().split())
paths = [list() for _ in range(N+1)] # paths[i] : 頂点iと繋がってる点を全て表す
for _ in range(N-1):
    a, b = map(int, input().split())
    paths[a].append(b)
    paths[b].append(a)
# ab = [list(map(int, input().split())) for _ in range(N-1)]
px = [list(map(int, input().split())) for _ in range(Q)]

ans = [0]*(N+1) # ans[i] : 頂点iについて答える値を格納

counters = [0]*(N+1) # そのノードの部分木に与える点数の総和を格納
for x in px:
    counters[x[0]] += x[1]

visit = [0]*(N+1) #dfsをする時に一度訪れた点に再訪しないための確認
def dfs(node, score, ans):
    visit[node] = 1 # 訪問したことを記録
    score += counters[node] # 自分の部分木に加点する分を加えて後世に残す
    ans[node] = score # 点数の記録
    for loof in paths[node]: # 自分と繋がってる各ノードについて
        if visit[loof] == 0: # まだ探索していなければ
            dfs(loof, score, ans) # 探索

dfs(1, 0, ans)
    

for i in range(1, N+1):
    print(ans[i])