Harryxun/stf_run huggingface dataset:
a, b, k = map(int, input().split())

d1 = [i for i in range(1, a//2+2) if a%i == 0]
d2 = [i for i in range(1, b//2+2) if a%i == 0]
print(sorted(set(d1) & set(d2))[k-1])

### FIXED CODE ###

a, b, k = map(int, input().split())
 
def get_divisors(n):
    return [i for i in range(1, n//2+1) if n%i == 0] + [n]

print(sorted(set(get_divisors(a)) & set(get_divisors(b)), reverse=True)[k-1])
s = input()
s.sort()
print('Yes' if s == 'abc' else 'No')

### FIXED CODE ###

s = input()
s = [i for i in s]
s.sort()
print('Yes' if ''.join(s) == 'abc' else 'No')
import pdb
n,m=map(int,input().split())
x=list(map(int,input().split()))
x.sort()
d=[]
if len(x)!=1:
    for i in range(0,len(x)-1):
        d.append(x[i+1]-x[i])
    d.sort(reverse=True)
    for i in range(n-1):
        d.pop(0)
    ans=sum(d)
    print(ans)
else:
    print(0)
#pdb.set_trace()



### FIXED CODE ###

import pdb
n,m=map(int,input().split())
x=list(map(int,input().split()))
x.sort()
d=[]
if n<m:
    for i in range(0,len(x)-1):
        d.append(x[i+1]-x[i])
    d.sort(reverse=True)
    for i in range(n-1):
        d.pop(0)
    ans=sum(d)
    print(ans)
else:#koma are assigned
    print(0)
#pdb.set_trace()
if N[-1]=="3":
    print("bon")
elif N[-1]==("0"or"1"or"6"or"8"):    
    print("pon")
else:
    print("hon")

### FIXED CODE ###

#Ans
N=str(input())
if N[-1]=="2"or N[-1]=="4"or N[-1]=="5"or N[-1]=="7"or N[-1]=="9":
    print("hon")
elif N[-1]=="0" or N[-1]=="1"or N[-1]=="6"or N[-1]=="8":    
    print("pon")
elif N[-1]=="3":
    print("bon")
n = int(input())
nums = list(map(int,input().split()))
ans = 0
while True:
    for i in range(n):
        if nums[i] % 2 == 0:
            nums[i] = nums[i] / 2
        else:
            break
    if nums[i] % 2 != 0:
      ans += 1
      print(ans)
      break   
    else:
      ans +=1


### FIXED CODE ###

s = list(input())
c = 0


for i in range(3):
  if s[i] == '1':
    c += 1
   

print(c)
import math
n,m,k=map(int,input().split())
g=math.gcd(n,m)
for i in range(1,101):
	if g%i==0:
		k-=1
		if k==0:
			print(i)
			exit() 

### FIXED CODE ###

n,m,k=map(int,input().split())
for i in range(min(n,m),0,-1):
	if n%i==0 and m%i==0:
		k-=1
		if k==0:
			print(i)
			exit()
A, B, C, D = [int(i) for i in list(input())]

ans = 0
ans = f"{A}+{B}+{C}+{D}=7" if A+B+C+D==7 else ans
ans = f"{A}+{B}+{C}-{D}=7" if A+B+C-D==7 else ans
ans = f"{A}+{B}-{C}+{D}=7" if A+B-C+D==7 else ans
ans = f"{A}+{B}-{C}-{D}=7" if A+B-C-D==7 else ans
ans = f"{A}-{B}+{C}+{D}=7" if A-B+C+D==7 else ans
ans = f"{A}-{B}+{C}-{D}=7" if A-B+C-D==7 else ans
ans = f"{A}-{B}-{C}+{D}=7" if A-B-C+D==7 else ans
ans = f"{A}-{B}-{C}-{D}=7" if A-B-C-D==7 else ans

print(ans)

### FIXED CODE ###

A, B, C, D = [int(i) for i in list(input())]

ans = 0
ans = "{0}+{1}+{2}+{3}=7".format(A, B, C, D) if A+B+C+D==7 else ans
ans = "{0}+{1}+{2}-{3}=7".format(A, B, C, D) if A+B+C-D==7 else ans
ans = "{0}+{1}-{2}+{3}=7".format(A, B, C, D) if A+B-C+D==7 else ans
ans = "{0}+{1}-{2}-{3}=7".format(A, B, C, D) if A+B-C-D==7 else ans
ans = "{0}-{1}+{2}+{3}=7".format(A, B, C, D) if A-B+C+D==7 else ans
ans = "{0}-{1}+{2}-{3}=7".format(A, B, C, D) if A-B+C-D==7 else ans
ans = "{0}-{1}-{2}+{3}=7".format(A, B, C, D) if A-B-C+D==7 else ans
ans = "{0}-{1}-{2}-{3}=7".format(A, B, C, D) if A-B-C-D==7 else ans

print(ans)
h,w,a,b=map(int,input().split())

tmp=[0]*w
lista=[]
for i in range(h):
    lista.append([0]*w)
    
if a>w/2 or b>h/2:
    print("No")

elif h==1:
    for i in range(w-a):
        lista[0][a+i]=1
elif w==1:
    for i in range(h-b):
                lista[b+i][0]=1
else:  
    for i in range(w-a):
        lista[0][a+i]=1
        
    if a==0:    
        for i in range(w):
            for j in range(b):
                lista[j][i]=1 

    if b!=0:    
        for i in range(a):
            for j in range(h-b):
                lista[b+j][i]=1 
        for i in range(b):
            for i in range(w-a):
                lista[i][a+j]=1




for i in range(h):
    row = ""
    for j in range(w):
        row += str(lista[i][j])
    print(row)

### FIXED CODE ###

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

lista=[]

for i in range(h):
    lista.append([0]*w)

if (a>w/2)|(b>h/2):
    print("No")

else:
    if h==1:
        for i in range(w-a):
            lista[0][a+i]=1
    elif w==1:
        for i in range(h-b):
            lista[b+i][0]=1

    elif (a==0)&(b==0):
        lista=lista

    else:  
        for i in range(w-a):
            lista[0][a+i]=1
        
           
        if a==0:    
            for i in range(w):
                for j in range(b):
                    lista[j][i]=1 
        elif b==0:    
            for i in range(h):
                for j in range(w-a):
                    lista[i][j+a]=1                         
        else:    
            for i in range(a):
                for j in range(h-b):
                    lista[b+j][i]=1 
            for i in range(b):
                for j in range(w-a):
                    lista[i][a+j]=1


 

    for i in range(h):
        row = ""
        for j in range(w):
            row += str(lista[i][j])
        print(row)
input()
li = map(int,input().split())

print('NO' if len(li) > len(set(li)) else 'YES')

### FIXED CODE ###

input()
li = list(map(int, input().split()))
print('NO' if len(li)>len(set(li)) else 'YES')
from collections import deque

H, W = map(int, input().split())
que = deque()
A = [[0 for i in range(W)] for j in range(H)]
white_num = 0
for i in range(H):
    S = input()
    for j in range(W):
        if S[j] == '.':
            A[i][j] = -1
            white_num += 1
        elif S[j] == '#':
            A[i][j] = 0
            que.append([j, i])

ans = 0
while len(que) > 0:
    x, y = que.popleft()
    for k in range(4):
        nx = x + [1, 0, -1, 0][k]
        ny = y + [0, 1, 0, -1][k]
        if nx < 0 or ny < 0 or nx >= W or ny >= W:
            continue
        if A[ny][nx] == -1:
            que.append([nx, ny])
            A[ny][nx] = A[y][x] + 1
            ans = max(ans, A[ny][nx])
print(ans)

### FIXED CODE ###

from collections import deque

H, W = map(int, input().split())
que = deque()
A = [[0 for i in range(W)] for j in range(H)]
white_num = 0
for i in range(H):
    S = input()
    for j in range(W):
        if S[j] == '.':
            A[i][j] = -1
            white_num += 1
        elif S[j] == '#':
            A[i][j] = 0
            que.append([j, i])

ans = 0
while len(que) > 0:
    x, y = que.popleft()
    for k in range(4):
        nx = x + [1, 0, -1, 0][k]
        ny = y + [0, 1, 0, -1][k]
        if nx < 0 or ny < 0 or nx >= W or ny >= H:
            continue
        if A[ny][nx] == -1:
            que.append([nx, ny])
            A[ny][nx] = A[y][x] + 1
            ans = max(ans, A[ny][nx])
print(ans)
i=1
while int(input())!=0:
   print("Case "+str(i):+" "+str(input())) 


### FIXED CODE ###

i=1
while True:
    x=int(input())
    if x==0:
        break
    print("Case {}: {}".format(i,x))
    i+=1
n,m=map(int, input().split())
sc = [list(map(int, input().split())) for i in range(m)]

ans = ['0']*(m+1)
for i in range(len(sc)):
    if ans[sc[i][0]] == '0' or ans[sc[i][0]] == str(sc[i][1]):
        ans[sc[i][0]] = str(sc[i][1])
    else:
        print(-1)
        exit()
if ans[1] == '0':
    print(-1)
else:
    print(int(''.join(ans)))

### FIXED CODE ###

n,m=map(int, input().split())
sc = [list(map(int, input().split())) for x in range(m)]

ans = ['0']*(n+1)
flg = 0
for i in range(m):
    if ans[sc[i][0]] == '0':
        if sc[i][1] != 0:
            ans[sc[i][0]] = str(sc[i][1])
            if sc[i][0] == 1:
                flg = 1
        elif sc[i][0] == 1 and sc[i][1] == 0 and flg == 0:
            ans[sc[i][0]] = str(sc[i][1])
            flg = 1
        else:
            continue
    elif ans[sc[i][0]] == str(sc[i][1]):
        continue
    else:
        print(-1)
        exit()
if flg == 0 and len(ans) != 2:
    ans[1] = '1'
    print(int(''.join(ans)))
elif ans[1] == '0' and len(ans) != 2:
    print(-1)
else:
    print(int(''.join(ans)))
import math

N, D = map(int, input().split())

array = [[0]*11]*11

for i in range(N):
    x = list(map(int, input().split()))
    for j in range(D):
        array[i][j] += x[j];
    
for i in range(0,N-1):
    for j in range(i+1,N):
        dis = 0
        for k in range(D):
            dis += (array[i][k] - array[i][k])**2
        dis = math.sqrt(dis)
        if(type(dis) == int): sum_dis += 1
print(sum_dis)

### FIXED CODE ###

import math

N, D = map(int, input().split())

array = [[0 for i in range(10)] for j in range(10)]

for i in range(N):
    x = list(map(int, input().split()))
    for j in range(0, D):
        array[i][j] = x[j];
sum_dis = 0
for i in range(0,N-1):
    for j in range(i+1,N):
        dis = 0
        for k in range(D):
            dis += (array[i][k] - array[j][k])**2
        dis = math.sqrt(dis)
        if(dis.is_integer()): sum_dis += 1
print(sum_dis)
# coding: utf-8
import sys

def solve(a,begin,end,queue):
  if begin>=end:
    return
  maxx = sorted(list(map(abs,a[begin:end+1])),reverse=True)[0]
  if maxx in a:
    m = a.index(maxx)
  else:
    m = a.index(-1*maxx)
    maxx = -1*maxx
  if maxx==0:
    return
  if maxx>0:
    solve(a,begin,m-1,queue)
    for i in range(max(0,m-1),end):
      if a[i+1]>=a[i]:
        continue
      else:
        a[i+1]+=a[i]
        queue.append((i,i+1))
        if a[i+1]<a[i]:
          a[i+1]+=a[i]
          queue.append((i,i+1))
    return queue
  if maxx<0:
    solve(a,m+1,end,queue)
    for i in reversed(range(begin,min(len(a)-1,m+1))):
      if a[i]<=a[i+1]:
        continue
      else:
        a[i]+= a[i+1]
        queue.append((i+1,i))
        if a[i]>a[i+1]:
          a[i]+=a[i+1]
          queue.append((i+1,i))
    return queue

if __name__ == '__main__':
  n = int(input())
  a = list(map(int,input().split()))
  queue = solve(a,0,len(a)-1,[])
  print(len(queue))
  for i in range(len(queue)):
    print(queue[i][0],queue[i][1])


### FIXED CODE ###

# coding: utf-8

def solve(a,begin,end,queue):
  if begin>=end:
    return
  maxx = sorted(list(map(abs,a[begin:end+1])),reverse=True)[0]
  if maxx in a[begin:end+1]:
    m = a[begin:end+1].index(maxx)+begin
  else:
    m = a[begin:end+1].index(-1*maxx)+begin
    maxx = -1*maxx
  if maxx==0:
    return []
  if maxx>0:
    solve(a,begin,m-1,queue)
    for i in range(max(0,m-1),end):
      if a[i+1]>=a[i]:
        continue
      else:
        a[i+1]+=a[i]
        queue.append((i,i+1))
        if a[i+1]<a[i]:
          a[i+1]+=a[i]
          queue.append((i,i+1))
    return queue
  if maxx<0:
    solve(a,m+1,end,queue)
    for i in reversed(range(begin,min(len(a)-1,m+1))):
      if a[i]<=a[i+1]:
        continue
      else:
        a[i]+= a[i+1]
        queue.append((i+1,i))
        if a[i]>a[i+1]:
          a[i]+=a[i+1]
          queue.append((i+1,i))
    return queue

if __name__ == '__main__':
  n = int(input())
  a = list(map(int,input().split()))
  queue = solve(a,0,len(a)-1,[])
  print(len(queue))
  for i in range(len(queue)):
    print(queue[i][0]+1,queue[i][1]+1)
import numpy as np
N = int(input())
w = np.zeros(shape = (N,N))
flag = N-1
while flag:
    l = input.split()
    i = int(l[0])-1
    j = int(l[1])-1
    w[i][j] = int(l[2])
    flag -= 1
color = np.ones(shape = (N,))
for i in range(N//2 + 1):
    for j in range(i+1,N):
        weight = w[i][j]
        if weight!=0 and weight % 2 == 0:
            color[j] = color[i]       
        else:
            color[j] = 0
for i in color:
    print(int(i)) 

### FIXED CODE ###

read = input
n = int(read())
v = [[] for i in range(n+1)] # 邻接
used = [0 for i in range(n+1)] # 节点 1~n
def add(f,t,w):
    v[f].append((t, w))
for i in range(n-1):
    f,t,w = map(int, read().split())
    add(f,t,w)
    add(t,f,w)
# 从1出发，贪心即可，1画1，理论不会有回环，总是能画成二分图
from queue import Queue
q = Queue() # 队列
#def dfs(f, s, fa=-1):
#    if s % 2 == 0: 
#        used[f] = 1
#    for t, w in v[f]:
##         print('%d->%d->%d'%(fa, f, t,), s, w)
#        if t == fa:continue
#        dfs(t, w + s, f)
#
#
#dfs(1,0)
q.put_nowait((1, 0, -1)) #(目标节点号，根节点到目标节点的距离，与目标节点相连的上一个节点号)
while not q.empty():
    f, s, fa = q.get_nowait()
    if s % 2 == 0: 
        used[f] = 1 #used数组从1开始填充颜色
    for t, w in v[f]:
#         print('%d->%d->%d'%(fa, f, t,), s, w)
        if t == fa:continue  #fa为与目标节点相连的上一个节点号，防止成环。2->3则，3->2不能再遍历一遍
        q.put_nowait(
            (t, w + s, f)
        )
    
for i in used[1:]: #球号从1开始，故used[0]无意义
    print(used[i])
a,b,c=map(int,input().split())
if A%3 == 0:
  print("Possible")
elif B%3 == 0:
  print("Possible")
elif (A+B)%3 == 0:
  print("Possible")
else:
  print("Impossible")

### FIXED CODE ###

a,b=map(int,input().split())
if a%3 == 0:
  print("Possible")
elif b%3 == 0:
  print("Possible")
elif (a+b)%3 == 0:
  print("Possible")
else:
  print("Impossible")
a = [int(input) for i in range(5)]
m = 0
n = 0
for i in a:
  if i%10 != 0:
    t = 10 - i%10
  else:
    t = 0
  n += i + t
  m = max(m,t)
print(n-m)

### FIXED CODE ###

a = [int(input()) for i in range(5)]
m = 0
n = 0
for i in a:
  if i%10 != 0:
    t = 10 - i%10
  else:
    t = 0
  n += i + t
  m = max(m,t)
print(n-m)
A=int(input())
print(chr(B+1))

### FIXED CODE ###

A=ord(input())
print(chr(A+1))
import numpy as np
 
N,M=[int(i) for i in input().split()]
x=input().split()
y=[int(i) for i in x]
y.sort()
if(N==1):
    print(max(y)-min(y))
#    print(y[M-1]-y[0])
    exit()
if(M==1):
    print("0")
    exit()
diff=[]
for i in range(M-1):
    diff.append(y[i+1]-y[i])
sub=[]
array=np.array(diff)
index=np.argsort(array)
c=index[-1::-1]
for i in range(N-1):
    sub.append(c[i])
ans=0
for i in range(N):
    if(i==0):
        ans+=y[sub[i]]-y[0]
    elif(i==N-1):
        ans+=y[M-1]-y[sub[i-1]+1]
    else:
        ans+=y[sub[i]]-y[sub[i-1]+1]
print(ans)

### FIXED CODE ###

import numpy as np
 
N,M=[int(i) for i in input().split()]
x=input().split()
y=[int(i) for i in x]
y.sort()
if(N==1):
    print(max(y)-min(y))
#    print(y[M-1]-y[0])
    exit()
if(M==1):
    print("0")
    exit()
if(N>=M):
    print("0")
    exit()
diff=[]
for i in range(M-1):
    diff.append(y[i+1]-y[i])
sub=[]
array=np.array(diff)
index=np.argsort(array)
c=index[-1::-1]
for i in range(N-1):
    sub.append(c[i])
ans=0
for i in range(N):
    if(i==0):
        ans+=y[sub[i]]-y[0]
    elif(i==N-1):
        ans+=y[M-1]-y[sub[i-1]+1]
    else:
        ans+=y[sub[i]]-y[sub[i-1]+1]
print(ans)
if K >= A:
    N = K - A
    all_number = 1*A

    if N == 0:
        print(all_number)

    elif N >= B:
        N = N - B
        if N >= C:
            all_number = all_number - 1 * C
            print(all_number)

        else:
            all_number = all_number - 1*N
            print(all_number)

    elif N < B:
        print(all_number)
else:
    all_number = 1*K
    print(all_number)

### FIXED CODE ###

A, B, C, K = map(int,input().split())
if K <= A:
    print(K)
elif K <= A + B:
    print(A)
else:
    print(2*A + B - K)
import.math
A, B, C, D = map(int, input().split())
sita = A*30+B*6
if sita > 180:
  sitas = 360 - sita
elif -180<= sita < 0:
  sitas = sita * -1
elif sita < -180:
  sitas = sita + 360
else:
  sitas = sita
print(math.sqrt(C**2+D**2-2*C*D*math.cos(sitas)))

### FIXED CODE ###

def resolve():
    import math
    A, B, H, M = map(int, input().split())
    sita = abs(H*30+M*0.5-M*6)
    if sita > 180:
        sita = 360 - sita
    print(math.sqrt(A**2+B**2-2*A*B*math.cos(math.radians(sita))))
resolve()
def chain(k,y):
    if y in D or y==S[cur]:
        return 0
    for i in G[y]:
        if T[i]==y:
            return 1
        hist[i] = 1
        z = T[i]
        return chain(i,z)
S = input().strip()
T = input().strip()
D = [chr(i) for i in range(97,123)]
G = {}
for i in range(len(S)):
    x = S[i]
    if x in D:
        D.remove(x)
    if x not in G:
        G[x] = []
    G[x].append(i)
hist = [0 for _ in range(len(S))]
ind = 0
for i in range(len(S)):
    if hist[i]==1:continue
    x = S[i]
    y = T[i]
    if x!=y:
        for j in G[x]:
            cur = j
            hist[j]=1
            ind = chain(j,y)
            if ind==1:break
        if ind==1:break
if ind==0:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

S = input().strip()
T = input().strip()
F = {}
flag = 0
for i in range(len(S)):
    a = S[i]
    b = T[i]
    if a not in F:
        F[a] = b
    if F[a] != b:
        flag = 1
        break
    for c in F:
        if c!=a and F[c]==b:
            flag = 1
            break
if flag==1:
    print("No")
else:
    print("Yes")
s = raw_input()
k = int(raw_input())


s_l = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']

def s_i(st):
    for i in range(26):
        if st == s_l[i]:
            break
    return i + 1

j = 0
while k > 0:
    a = s_i(s[j])
    if s[j] == 'a' and j < len(s)-1:
        pass
    elif 27 - a <= k:
        k = k - (27 - a)
        s = s[:j] + 'a' + s[j+1:]
    elif j == len(s) - 1:
        t = (a+k)%26 - 1
        if t >= 0:
            s = s[:j] + s_l[t]
        else:
            s = s[:j] + s_l[t + 26]
        break
    else:
        pass
    j += 1

print s


### FIXED CODE ###

s = raw_input()
k = int(raw_input())


s_l = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']

def s_i(st):
    for i in range(26):
        if st == s_l[i]:
            return i + 1
            break

j = 0
while k > 0 and j <= len(s)-1:
    a = s_i(s[j])
    if s[j] == 'a' and j < len(s)-1:
        pass
    elif 27 - a <= k and j < len(s)-1:
        k = k - (27 - a)
        s = s[:j] + 'a' + s[j+1:]
    elif j == len(s) - 1:
        t = (a+k)%26 - 1
        if t >= 0:
            s = s[:j] + s_l[t]
        else:
            s = s[:j] + s_l[t + 26]
        break
    else:
        pass
    j += 1

print s
def ntukusi(a,b,c):
    return "YES" if b - a = c - b else "NO"

def main():
    a , b , c = map(int, input().split())
    print(ntukusi(a , b , c))

if __name__ == '__main__':
    main()

### FIXED CODE ###

def ntukusi(a,b,c):
    return "YES" if (b - a) == (c - b) else "NO"

def main():
    a , b , c = map(int, input().split())
    print(ntukusi(a , b , c))

if __name__ == '__main__':
    main()
import sys
sys.setrecursionlimit(10 ** 5)

N, M = map(int, input().split())
A = list(map(int, input().split()))
A.sort()
amin, amax = A[0], A[N-1]

BC = {}
for _ in range(M):
    b, c = map(int, input().split())
    if c in BC:
        BC[c] += b
    else:
        BC[c] = b

BC = sorted(BC.items(), reverse=True)

b = 0
c = 0
for i in range(N):
    if BC[c][0]<=A[i]:
        break
    A[i] = BC[c][0]
    b += 1
    if b==BC[c][1]:
        c += 1
        b = 0

print(sum(A))

### FIXED CODE ###

import sys
sys.setrecursionlimit(10 ** 5)

N, M = map(int, input().split())
A = list(map(int, input().split()))
A.sort()
amin, amax = A[0], A[N-1]

BC = {}
for _ in range(M):
    b, c = map(int, input().split())
    if c in BC:
        BC[c] += b
    else:
        BC[c] = b

BC = sorted(BC.items(), reverse=True)

b = 0
c = 0
cmax = len(BC)
for i in range(N):
    if BC[c][0] <= A[i]:
        break
    A[i] = BC[c][0]
    b += 1
    if b == BC[c][1]:
        c += 1
        b = 0
        if c == cmax:
            break

print(sum(A))
h, n = map(int, input().split())
c = {i:set() for i in range(h + 1)}
for i in range(n):
    a, b = map(int, input().split())
    c[b].add(a)
c[h] = set([1, 2])
count = 0
for i in range(h - 1):
    l = c[i] | c[i + 1]
    p = None
    if l == set():
        count += 2
        c[i + 1].add(1)
        c[i + 1].add(2)
    elif 0 not in l and 1 not in l:
        p = 1
    elif 2 not in l and 3 not in l:
        p = 3
    elif 1 not in l and 2 not in l:
        p = 2
    if p:
        j = 0
        while i + j + 1 < h:
            if c[i + j + 1] == set():
                j += 1
            else:
                break
        if p != 2 and 3 - p not in c[i + j + 2] and 4 - p not in c[i + j + 2]:
            count += 1
            c[i + 1].add(p - 1)
            c[i + 1].add(p)
            continue
        if j % 2 or j < 2:
            count += 1
            c[i + 1].add(p - 1)
            c[i + 1].add(p)
print(count)


### FIXED CODE ###

h, n = map(int, input().split())
c = [set() for i in range(h + 1)]
for i in range(n):
    a, b = map(int, input().split())
    c[b].add(a)
c[h] = set([1, 2])
count = 0
for i in range(h - 1):
    l = c[i] | c[i + 1]
    p = None
    if l == set():
        count += 2
        c[i + 1].add(1)
        c[i + 1].add(2)
    elif 0 not in l and 1 not in l:
        p = 1
    elif 2 not in l and 3 not in l:
        p = 3
    elif 1 not in l and 2 not in l:
        p = 2
    if p:
        j = 0
        while True:
            if c[i + j + 1] | c[i + j + 1] == set():
                j += 1
            else:
                break
        if p != 2 and p - 1 not in c[i + j + 1] and p not in c[i + j + 1]:
            count += 1
            c[i + 1].add(p - 1)
            c[i + 1].add(p)
            continue
        if j % 2 or j < 2:
            count += 1
            c[i + 1].add(p - 1)
            c[i + 1].add(p)
print(count)
h,w = map(int,input().split())
board = []
checkX = [False]*w
checkY = [False]*h
for i in range(h):
    board.append(input())

for i in range(h):
        for j in range(w):
            if board[i][j] == "#":
                checkX[i] = True
                checkY[j] = True
for i in range(h):
    if checkX[i]:
        for j in range(w):
            if checkY[j]:
                print(board[i][j],end="")
        print()

### FIXED CODE ###

h,w = map(int,input().split())
board = []
checkColumn = [False]*h
checkRow = [False]*w
for i in range(h):
    board.append(input())

for i in range(h):
        for j in range(w):
            if board[i][j] == "#":
                checkColumn[i] = True
                checkRow[j] = True
for i in range(h):
    if checkColumn[i]:
        for j in range(w):
            if checkRow[j]:
                print(board[i][j],end="")
        print()
def binary_search(A,n):
    # sequence A, item n
    l = len(A)
    if l==0:
        return False
    elif A[l/2] > n:
        return binary_search(A[:l/2],n)
    elif A[l/2] == n:
        return True
    elif A[l/2]<n:
        return binary_search(A[(l/2)+1:],n)

n = int(raw_input())
S = set(map(int,raw_input().split()))
q = int(raw_input())
T = map(int,raw_input().split())

C = 0
for k in T:
    if binary_search(S,k):
        C += 1
print C

### FIXED CODE ###

# coding: utf-8
# Here your code !
n = int(raw_input())
S = map(int,raw_input().split())
q = int(raw_input())
T = map(int,raw_input().split())
C = 0

def binary_search(A,n):
    """no recursion version"""
    l = len(A)
    left = l/2
    right = l-1
    while A[left] != n:
        if left == right and A[left] != n:
            #print left,right,"if"
            return False
        elif A[left] > n: # n????????????????????´???
            right = left
            left = left/2
            #print left,right,"elif1"
        elif A[left] < n: # n????????????????????´???
            right = right
            left = (left + right-1)/2 + 1
            #print left,right,"elif2"
    else:
        return True

for item in T:
    if binary_search(S,item):
        C += 1
print C
for i in range(0, N):
    j = A[i] - 2
    if j == 0 or j == 1:
        counter += 1
    else:
        while j > 1:
            if A[i] % j == 0:
                break
            else:
                j -= 1
        else:
            counter += 1

### FIXED CODE ###

def isprime(x):
    import math
    if  x == 2:
        return True
    elif x < 2 or x % 2 == 0:
        return False
    else:
        i = 3
        while i <= math.sqrt(x):
            if x % i == 0:
                return False
            i += 2
        return True

N = int(input())
A=[]
for i in range(N):
    A.append(int(input()))
counter = 0
for i in range(0, N):
    if isprime(A[i]):
        counter += 1
        
print(counter)
a = int(input())
if a[-1] == 3:
    print('bon')
elif a[-1]==0 or a[-1]==1 or a[-1]==6 or a[-1]==8:
    print('pon')
else:
    print('hon')

### FIXED CODE ###

a = str(input())
if a[-1] == '3':
    print('bon')
elif a[-1]=='0' or a[-1]=='1' or a[-1]=='6' or a[-1]=='8':
    print('pon')
else:
    print('hon')