Harryxun/stf_run huggingface dataset:
# https://atcoder.jp/contests/tenka1-2018-beginner/tasks/tenka1_2018_d

import sys
input=sys.stdin.readline

def main():
    N=int(input())
    m=0
    k=0
    for i in range(2*N+1):
        if i*(i+1)==2*N:
            m=i
            k=i+1
            break
    if m==0 or N==1:
        print("No")
        exit()
    else:
        ml=[[] for i in range(k)]
        for i in range(1,k+1):
            ml[i-1].append(str(i))
            ml[i-2].append(str(i))
        for i in range(k+1,N+1):
            ml[i-k-1].append(str(i))
            l=(i-k-1)//k
            ml[(i-k-1+2+l)%k].append(str(i))
        print("Yes")
        print(k)
        for i in range(k):
            print(m, " ".join(ml[i]))
    
    
if __name__=="__main__":
    main()


### FIXED CODE ###

# https://atcoder.jp/contests/tenka1-2018-beginner/tasks/tenka1_2018_d

import sys
input=sys.stdin.readline

def main():
    N=int(input())
    m=0
    k=0
    for i in range(int(((8*N+1)**0.5-1)/2)+1):
        if i*(i+1)==2*N:
            m=i
            k=i+1
            break
    if m==0:
        print("No")
        exit()
    elif N==1:
        print("Yes")
        print(2)
        print(1,1)
        print(1,1)
    else:
        ml=[[] for i in range(k)]
        for i in range(1,k+1):
            ml[i-1].append(str(i))
            ml[i-2].append(str(i))
        for i in range(k+1,N+1):
            ml[(i-k-1)%k].append(str(i))
            l=(i-k-1)//k
            ml[(i-k-1+2+l)%k].append(str(i))
        print("Yes")
        print(k)
        for i in range(k):
            print(m, " ".join(ml[i]))
    
    
if __name__=="__main__":
    main()
a=input().strip()
b=input().strip()
c=input().strip()
print("".join([a[0],b[1],c[0]])

### FIXED CODE ###

a=input().strip()
b=input().strip()
c=input().strip()
print("".join([a[0],b[1],c[2]]))
N = int(input())
# スペース区切りの整数の入力
A = list(map(int, input().split()))
A.argsort()

def gcd(a, b):
  while b > 0:
    a, b = b, a%b
  return a

list_koyaku1=[]
list_koyaku11=[]       
         
if N==2:
    ans=max(A)

else:
    b=min(A)
    c=max(A)
    if gcd(c,b)==1:
        b=A[-2]
    
    for a in A:
        list_koyaku1.append(gcd(a,b))

    for a in list_koyaku1:
        list_koyaku11.append(gcd(a,c))
    
    number_prime=list_koyaku11.count(1)
    
    if number_prime>1:
        ans=1
    else:
        ans=max(list_koyaku11)

print(ans)



### FIXED CODE ###

N = int(input())
# スペース区切りの整数の入力
A = list(map(int, input().split()))


def gcd(a, b):
  while b > 0:
    a, b = b, a%b
  return a

list1=[0]
L=0
for a in A:
    L=gcd(L,a)
    list1.append(L)

list2=[0]
R=0
for a in reversed(A):
    R=gcd(R,a)
    list2.append(R)

list2.reverse()

ans=[]

for i in range(N):
    ans.append(gcd(list1[i],list2[i+1]))

print(max(ans))
a = int(input())
from math import gcd
b = 0
for i in range(1, n + 1):
  for j in range(1, n + 1):
    for k in range(1, n + 1):
      b += gcd(gcd(i, j), k)
      
print(b)

### FIXED CODE ###

a = int(input())
from math import gcd
b = 0
for i in range(1, a + 1):
  for j in range(1, a + 1):
    for k in range(1, a + 1):
      b += gcd(gcd(i, j), k)
      
print(b)
N, M, K = map(int, input().split())
A = list(map(int, input().split()))[::-1]
B = list(map(int, input().split()))[::-1]

t = 0
count = 0
while t <= K:
    if A and A[-1] < B[-1] and t + A[-1] <= K:
        t += A.pop()
        count += 1
    elif B and t + B[-1] <= K:
        t += B.pop()
        count += 1
    else:
        break
print(count)

### FIXED CODE ###

from itertools import accumulate

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

# 累積和
a = [0] + list(accumulate(A))
b = [0] + list(accumulate(B))

ans = 0
j = M
for i in range(N + 1):
    # Aで既にKを超えていたらBから取れない
    if a[i] > K:
        break
    # 選択可能な最大のjを探す
    # 最大のjは前回のj以下
    while b[j] > K - a[i]:
        j -= 1
    ans = max(ans, i + j)

print(ans)
candy = N * (N + 1 )/2

print(candy)

### FIXED CODE ###

N = int( input() )

candy = int( N * ( N + 1 ) / 2 )

print(candy)
inputs = input().split(' ')
if int(inputs[0]) * int(inputs[2]) % 2 == 0:
	print('Even')
else :
	print('Odd')

### FIXED CODE ###

inputs = input().split(' ')
if int(inputs[0]) * int(inputs[1]) % 2 == 0:
	print('Even')
else:
	print('Odd')
s = input()
c = 0

#check for constraints
if 2<=len(s) and len(s) <= 26:
    s2 = ''.join(sorted(s))
    for i in s2:
        if c > len(s):
            quit()
        if s2[c] == s2[c+1]:
            print("no")  # string is not unique
            quit()
        elif s2[c] != s2[c+1]:
            c = c + 1
else: quit()

### FIXED CODE ###

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

total = A+B

if A >= 1 and B <=9 :
    if total < 10:
        print(total)
    else:
        print('error')
while 1:
   H, W = map(int, raw_input().split())
  
   if H == 0 and W == 0:
      break
   if W%2 ==0:
      for i in range(0, H, 2):
         M[i] = "#."*(w/2)
      for i in range(1, H, 2):
         M[i] = ".#"*(W/2)
   elif W%2 == 1:
      for i in range(0, H, 2):
         M[i] = "#."*(w/2)+"#"
      for i in range(1, H, 2):
         M[i] = ".#"*(W/2)+"."
  
   for i in range(H):
      print "%c" %(M[i])
   print ""

### FIXED CODE ###

while 1:
   H, W = map(int, raw_input().split())
           
   if H == 0 and W == 0:
      break
   for i in range(H):
      if i%2 == 0:
         if W%2 == 0:
            print "#."*(W/2)
         elif W%2 == 1:
            print "#."*(W/2)+"#"
      elif i%2 == 1:
         if W%2 == 0:
            print ".#"*(W/2)
         elif W%2 == 1:
            print ".#"*(W/2)+"."
   print ""
print("2018"+input()(4:))

### FIXED CODE ###

print("2018"+input()[4:])
a = int(input())
b = int(input())
if a*b % 2 == 0:
  print("Even")
else:
  print("Odd")

### FIXED CODE ###

a,b = map(int,input().split())
c = a*b
if c % 2 ==0:
  print("Even")
else:
  print("Odd")
# coding: utf-8
# Your code here!
import itertools
import pandas as pd

k, s = map(int, input().split())

lst = [i for i in range(k+1)]


prod = itertools.product(lst, repeat=3)

frame = pd.DataFrame(list(prod))

frame['ans'] = frame[0]+frame[1]+frame[2]

s_bool = (frame['ans'] ==s)

ans = s_bool.sum()

print(ans)











### FIXED CODE ###

# coding: utf-8
# Your code here!

k, s = map(int, input().split())

cnt = 0

for i in range(k+1):
    for j in range(k+1):
        if s-i-j <= k and s-i-j>=0:
            cnt += 1

print(cnt)
N = int(input())
A = list(map(int, input().split()))
table = []

for i, a in enumerate(A):
    table.append([a,i])
table.sort()

# DP[i][j] 左端に i 個, 右端に j 個貪欲に詰めたときのうれしさ
DP = [[0 for i in range(N+1)] for j in range(N+1)]
for i in range(1,N+1):
    # i 人目 table[i-1] の幼児を移動させる
    baby, pos = table.pop()
    for x in range(i+1):
        y = i - x

        #左端に置く場合と右端に置く場合でmax
        DP[x][0] = DP[x-1][0] + baby * abs(pos-x+1))
        DP[0][y] = DP[x][y-1] + baby * abs(pos-(N-y))
        if x & y:
            DP[x][y] = max((DP[x-1][y] + baby * abs(pos-x+1)),\
                     (DP[x][y-1] + baby * abs(pos-(N-y)))

ans = 0
for i in range(N+1):
    ans = max(ans, DP[i][N-i])
print(ans)


### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
table = []

for i, a in enumerate(A):
    table.append([a,i])
table.sort(reverse=True)

# DP[i][j] 左端に i 個, 右端に j 個貪欲に詰めたときのうれしさ
DP = [[0 for i in range(N+1)] for j in range(N+1)]
for i in range(1,N+1):
    # i 人目 table[i-1] の幼児を移動させる
    for x in range(i+1):
        y = i - x

        #左端に置く場合と右端に置く場合でmax
        DP[x][y] = max((DP[x-1][y] + table[i-1][0] * abs(table[i-1][1]  - x+1)) * (x>0),\
                     (DP[x][y-1] + table[i-1][0] * abs(table[i-1][1] - (N - y))*(y>0)))


ans = 0
for i in range(N+1):
    for j in range(N+1):
        ans = max(ans, DP[i][j])
print(ans)
a,b,c = [input() for i in range(3)]
a.sort()
print(int((a[2]+a[1])+a[0])

### FIXED CODE ###

a,b,c=sorted(map(int,input().split()))
print(10*c+b+a)
n=int(input());
G=[[0 for i in range(n)]for j in range(n)]
for i in range(n):
    list=[int(m) for m in input().split()]
    u=list[0]
    k=list[1]
    for j in range(2,len(list)):
        v=list[j]
        G[u-1][v-1]=1
for i in range(n):
    for j in range(n):
        print(G[i][j],end="")
        if j!=len(g[i])-1:
            print(" ",end="")
    print()



### FIXED CODE ###

n=int(input());
G=[[0 for i in range(n)]for j in range(n)]
for i in range(n):
    list=[int(m) for m in input().split()]
    u=list[0]
    k=list[1]
    for j in range(2,len(list)):
        v=list[j]
        G[u-1][v-1]=1
for i in range(n):
    for j in range(n):
        if j!=n-1:
            print(G[i][j],end=" ")
        else:
            print(G[i][j],end="\n")
# xの逆元は、x*y = 1 mod pとなるようなy
N, K = map(int, input().split())
mod = 10**9 + 7
a = N - K + 1
print(a)
for i in range(K-1):
    a *= (N - K - i) * (K - (i + 1)) / ((i+2) * (i+1)) % mod
    a = int(a)
    print(a)



### FIXED CODE ###

# xの逆元は、x*y = 1 mod pとなるようなy
N, K = map(int, input().split())
mod = 10**9 + 7
a = N - K + 1
print(a)
for i in range(K-1):
    a = a * (N - K - i) * (K - (i + 1)) // ((i+2) * (i+1))
    print(a % mod)
num=str(input())
temp=num
rev=0
while(num>0):
    dig=num%10
    rev=rev*10+dig
    num=num//10
if(temp==rev):
    print("Yes")
else:
    print("No")

### FIXED CODE ###

n = input()
x = len(n)

if n == n[::-1]:
    if n[:((x-1)//2)] == n[:((x-1)//2)][::-1]:
        if n[((x+3)//2)-1:] == n[((x+3)//2)-1:][::-1]:
            print('Yes')
        else:
            print('No')
    else:
        print('No')
else:
    print('No')
N=int(input())
def sq(n):
    c=0
    A=[0 for j in range(n+1)]
    for i in range(n//2):
        p=(i+1)**2
        if p>n:
            for j in range(i**2,n+1):
                A[j]=i
            break
        else:
            for j in range(i**2,p):
                A[j]=i
    return A
A=sq(N)
L=[0 for j in range(N+1)]
for x in range(1,a+1):
    for y in range(1,a+1):
        for z in range(a+1):
            p=x**2+y**2+z**2+x*y+y*z+z*x
            if p<=N:
                L[p]=L[p]+1
            else:
                break
for l in L:
    print(l)

### FIXED CODE ###

N=int(input())
def sq(n):
    c=0
    A=[0 for j in range(n+1)]
    for i in range(n//2):
        p=(i+1)**2
        if p>n:
            for j in range(i**2,n+1):
                A[j]=i
            break
        else:
            for j in range(i**2,p):
                A[j]=i
    return A
A=sq(N)
a=A[N]
L=[0 for j in range(N+1)]
for x in range(1,a+1):
    for y in range(1,a+1):
        for z in range(1,a+1):
            p=x**2+y**2+z**2+x*y+y*z+z*x
            if p<=N:
                L[p]=L[p]+1
            else:
                break
for i in range(1,N+1):
    print(L[i])
N, Z, W = map(int,input().split())
    p = list(map(int,input().split()))
    a = abs(p[N-2] - p[N-1])
    b = abs(p[N-1] - W)
    print(max(a, b))

### FIXED CODE ###

N, Z, W = map(int,input().split())
p = list(map(int,input().split()))
a = abs(p[N-2] - p[N-1])
b = abs(p[N-1] - W)
print(max(a, b))
import heapq

N,M = map(int,input().split())
value = list(map(int,input().split()))
value = list(map(lambda x: x*(-1), value))
heapq.heapify(value)

for i in range(M):
  num = (heapq.heappop(value)*(-1)//2)*(-1)
  heapq.heappush(value,num)

print(sum(list(map(lambda x: x*(-1), value))))


### FIXED CODE ###

weather = ['Sunny', 'Cloudy', 'Rainy','Sunny']
print(weather[weather.index(input())+1])
X=int(input())
if X==3 or x==5 or X==7:
  	print("YES")
else:
  print("NO")

### FIXED CODE ###

X=int(input())
if X==3 or X==5 or X==7:
  print("YES")
else:
  print("NO")
from functools import lru_cache


@lru_cache
def factorial(n):
    if n == 0:
        return 1
    return (n * factorial(n-1)) % MOD


def combination(n, k):
    return factorial(n) // factorial(k) // factorial(n - k)


k = int(input())
s = input()
MOD = 10**9+7

ans = 0
for i in range(k + 1):
    tmp = combination(i + len(s) - 1, len(s) - 1)
    tmp *= pow(25, i, MOD)
    tmp *= pow(26, k - i, MOD)
    ans += tmp
    ans %= MOD
print(ans)


### FIXED CODE ###

MOD = 10**9+7

k = int(input())
s = input()
MAX = k + len(s)

factorial = [0] * (MAX + 1)
factorial[0] = 1
for i in range(1, MAX + 1):
    factorial[i] = factorial[i-1] * i % MOD


ifactorial = [0] * (MAX + 1)
ifactorial[MAX] = pow(factorial[MAX], MOD - 2, MOD)
for i in range(MAX, 0, -1):
    ifactorial[i - 1] = ifactorial[i] * i % MOD

pow25 = [1] * (k + 1)
pow26 = [1] * (k + 1)
for i in range(k):
    pow25[i + 1] = pow25[i] * 25
    pow25[i + 1] %= MOD
    pow26[i + 1] = pow26[i] * 26
    pow26[i + 1] %= MOD


def combination(n, k):
    ret = factorial[n] * ifactorial[k] * ifactorial[n - k]
    return ret % MOD


ans = 0
for i in range(k + 1):
    tmp = combination(i + len(s) - 1, len(s) - 1)
    tmp *= pow25[i]
    tmp %= MOD
    # tmp *= pow(25, i, MOD)
    tmp *= pow26[k - i]
    # tmp *= pow(26, k - i, MOD)
    tmp %= MOD
    ans += tmp
    ans %= MOD
print(ans)
from math import factorial
from itertools import permutations

n = int(input())
x, y = [0] * n, [0] * 
for i in range(n):
    x[i], y[i] = map(int, input().split())

dist_sum = 0
for route in permutations(range(n), n):
    for j in range(1, n):
        dist = (x[route[j]] - x[route[j - 1]]) ** 2
        dist += (y[route[j]] - y[route[j - 1]]) ** 2
        dist = dist ** 0.5
        dist_sum += dist
ans = dist_sum / factorial(n)
print(ans)


### FIXED CODE ###

from math import factorial
from itertools import permutations

n = int(input())
x, y = [0] * n, [0] * n
for i in range(n):
    x[i], y[i] = map(int, input().split())

dist_sum = 0
for route in permutations(range(n), n):
    for j in range(1, n):
        dist = (x[route[j]] - x[route[j - 1]]) ** 2
        dist += (y[route[j]] - y[route[j - 1]]) ** 2
        dist = dist ** 0.5
        dist_sum += dist
ans = dist_sum / factorial(n)
print(ans)
import sys

H, W, M = map(int, sys.stdin.readline().strip().split())

h = [0] * H
w = [0] * W

g = [[False] * W for _ in range(H)]

for _ in range(M):
    Th, Tw = map(int, sys.stdin.readline().strip().split())

    h[Th - 1] += 1
    w[Tw - 1] += 1

    g[Th - 1][Tw - 1] = True

ans = max(h) + max(w)

index_h = [n for n, v in enumerate(h) if v == max(h)]
index_w = [n for n, v in enumerate(w) if v == max(w)]

sub = 1
for ih in index_h:
    for iv in index_w:
        if g[ih][iv] is false:
            sub = 0
            break
    else:
        continue
    break

ans -= sub
print(ans)


### FIXED CODE ###

import sys

H, W, M = map(int, sys.stdin.readline().strip().split())

h = [0] * H
w = [0] * W

# g = [[False] * W for _ in range(H)]
S = set()
for _ in range(M):
    Th, Tw = map(int, sys.stdin.readline().strip().split())

    h[Th - 1] += 1
    w[Tw - 1] += 1

    # g[Th - 1][Tw - 1] = True
    S.add((Th - 1, Tw - 1))

max_h = max(h)
max_w = max(w)
ans = max_h + max_w

index_h = [n for n, v in enumerate(h) if v == max_h]
index_w = [n for n, v in enumerate(w) if v == max_w]

sub = 1
# for ih in index_h:
#     for iv in index_w:
#         if g[ih][iv] is False:
#             sub = 0
#             break
#     else:
#         continue
#     break
# ans -= sub
# print(ans)


for ih in index_h:
    for iv in index_w:
        if not (ih, iv) in S:
            print(ans)
            exit()
print(ans - 1)
N,W = map(int,input().split())
w,v = [],[]
for i in range(N):
    a,b = map(int,input().split())
    w.append(a)
    v.append(b)
m = sum(v)
dp = [[0]*(m+1) for i in range(N+1)]

for i in range(N):
    for j in range(m+1):
        if j-v[i] >=0:
            dp[i+1][j] = max(dp[i][j-v[i]] + w[i],dp[i][j])
        else:
            dp[i+1][j] = dp[i][j]

for j in range(m+1):
        if dp[N][j] <= W:
            ans = max(ans,j)
print(ans)

### FIXED CODE ###

N,W = map(int,input().split())
w,v = [],[]
for i in range(N):
    a,b = map(int,input().split())
    w.append(a)
    v.append(b)
m = sum(v)
dp=[[float("inf")]*(m+1) for i in range(N+1)]
dp[0][0] = 0

for i in range(N):
    for j in range(m+1):
        if j-v[i] >=0:
            dp[i+1][j] = min(dp[i][j-v[i]] + w[i],dp[i][j])
        else:
            dp[i+1][j] = dp[i][j]
ans = 0
for j in range(m+1):
        if dp[N][j] <= W:
            ans = max(ans,j)
print(ans)
X,Y = map(str, input().split())
if hex(X)<hex(Y):
  print("<")
elif hex(X)>hex(Y):
  print(">")
else:
  print("=")


### FIXED CODE ###

x,y = map(str, input().split())
if int(x,16) > int(y,16):
  print(">")
elif int(x,16) < int(y,16):
  print("<")
else:
  print("=")
labels
group=[np.array([0]*n) for i in range(l)]

group
labels=list(labels)
for i in range(n):
    group[labels[i]][i]=1

group_num=[0 for i in range(l)]
for i in range(n):
    group_num[labels[i]]+=1
group_num

def get_group_num(i):
    return group_num[labels[i]]

frends=np.ones((n,n))-frends
blocks=np.ones((n,n))-blocks

def get_frend_num(i):
    check=frends[i]*group[labels[i]]
    return int(sum(check)-1)
def get_block_num(i):
    check=blocks[i]*group[labels[i]]
    return int(sum(check)-1)


for i in range(n):
    frend_group_num=get_group_num(i)-1
    frend_num=get_frend_num(i)
    block_num=get_block_num(i)
    print(abs(frend_group_num-frend_num-block_num))
    

### FIXED CODE ###

import numpy as np
from scipy.sparse.csgraph import connected_components
from scipy.sparse import csr_matrix

import sys
sys.setrecursionlimit(10**9)
n,m,k=[int(i) for i in input().split()]
frends_num=[0 for i in range(n)]
def make_frends(m,n):
    data=[1 for i in range(m)]

    row=[]
    col=[]
    for k in range(m):
        i,j=[int(l) for l in input().split()]
        new_i=min(i,j)-1
        new_j=max(i,j)-1
        row.append(new_i)
        col.append(new_j)
        frends_num[new_i]+=1
        frends_num[new_j]+=1
    frend_sparce_matrix=csr_matrix((data, (row, col)),shape=(n,n))
    return frend_sparce_matrix


frends=make_frends(m,n)
l,labels=connected_components(frends)
labels
labels=list(labels)

class Group:
    def __init__(self,labels):
        self.labels=labels
        self.group_num=[0 for i in range(l)]
        for i in labels:
            self.group_num[i]+=1
    def get_group_num(self,i):
        return self.group_num[self.labels[i]]

group=Group(labels)


def get_frend_num(i):
    return frends_num[i]


def make_block(k,n):
    block_num=[0 for i in range(n)]
    for p in range(k):
        i,j =[int(l)-1 for l in input().split()]
        new_i=min(i,j)
        new_j=max(i,j)
        if labels[new_i]==labels[new_j]:
            block_num[i]+=1
            block_num[j]+=1
    return block_num

block=make_block(k,n)

def get_block_num(i):
    return block[i]

ans=[]
for i in range(n):
    ans.append(str(group.get_group_num(i)-1-get_frend_num(i)-get_block_num(i)))
print(" ".join(ans))
n,m=map(int,input().split())
ps=[list(input().split()) for i in range(m)]
pen=[0]*n
rig=[0]*n

for i in range(m):
  if ps[i][1] == "AC":
    rig[int(ps[i][0])-1]=1
  else:
    if rig[int(ps[i][0]-1)] == 0:
      pen[int(ps[i][0]-1)]+=1

cnt1,cnt2=0,0
for i in range(n):
  if rig[i]==1:
    cnt1+=rig[i]
    cnt2+=pen[i]
    
print(str(cnt1)+" "+str(cnt2))


### FIXED CODE ###

n,m=map(int,input().split())
ps=[list(input().split()) for i in range(m)]
pen=[0]*n
rig=[0]*n

for i in range(m):
  if ps[i][1] == "AC":
    rig[int(ps[i][0])-1]=1
  else:
    if rig[int(ps[i][0])-1] == 0:
      pen[int(ps[i][0])-1]+=1

cnt1,cnt2=0,0
for i in range(n):
  if rig[i]==1:
    cnt1+=rig[i]
    cnt2+=pen[i]
    
print(str(cnt1)+" "+str(cnt2))
from math import gcd
from itertools import accumulate
def GCD(args):
    return list(accumulate(args,gcd))[-1]
N = int(input())
T = [int(input()) for _ in range(N)]
g = GCD(T)
ans = g
for t in T:
    ans *= t//g
print(ans)

### FIXED CODE ###

def gcd(n,m):
    if n < m:
        t = n
        n = m
        m = t
    r = n % m
    while r > 0:
        n, m = m, r
        r = n % m
    return m
N = int(input())
T = [int(input()) for _ in range(N)]
ans = T[0]
for i in range(1,N):
    g = gcd(ans,T[i])
    ans = ans*T[i]//g
print(ans)
s = input()

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']
for i in l:
    if not i in s:
        print(i)
        break


### FIXED CODE ###

s = input()

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']
flag = True
for i in l:
    if not i in s:
        print(i)
        flag = False
        break
if flag:
    print('None')
N = int(input())
X = [int(i) for i in input().split()]
for i in range(N): print((lambda j: sorted([x for k, x in enumerate(X) if not k == j]))(i)[N/2-1])

### FIXED CODE ###

N = int(input())
X = [int(i) for i in input().split()]
X_sorted = sorted(X)

X_med = X_sorted[N//2-1:N//2+1]
for xi in X:
  if xi <= X_med[0]: print(X_med[1])
  else: print(X_med[0])
n, k = map(int, input().split())
a = list(map(int, input().split()))
a.sort(reverse=True)
print(sum[:k])

### FIXED CODE ###

n, k = map(int, input().split())
a = list(map(int, input().split()))
a.sort(reverse=True)
print(sum(a[:k]))
input()
myarr = list(map(int, input().split())
for i in range(1, len(myarr)):
    for j in range(i, 0,-1):
        if myarr[j] < myarr[j-1]:
            t = myarr[j]
            myarr[j] = myarr[j-1]
            myarr[j-1] = t
        else:
            break
    print(" ".join(map(str, myarr)))
        
    


### FIXED CODE ###

N = int(input())
arr = list(map(int, input().split()))

for i in range(len(arr)):
    for j in range(i,0,-1):
        if(arr[j] < arr[j-1]):
            temp = arr[j]
            arr[j] = arr[j-1]
            arr[j-1] = temp
        else:
            continue
    print(' '.join(map(str,arr)))
sum = 0
while 1:
   x, y =map(int, raw_input().split())
   sum = sum + 1
   if x == y == '0':
      break
   print sorted(x, y)

### FIXED CODE ###

while 1:
   x, y = map(int, raw_input().split())
   if x == 0 and y == 0:
      break
   elif x > y:
      print '%s %s' % (y,x)
   else:
      print '%s %s' % (x,y)
a,b = map(int, raw_input().split())
c = a*b
d = 2*(a+b)
print'%d %d'%(c,d

### FIXED CODE ###

a,b = map(int, raw_input().split())
c = a*b
d = 2*(a+b)
print'%d %d'%(c,d)
from collections import defaultdict
n = int(input())
s = [list(map(int,input().split())) for i in range(n-1)]
c = list(map(int,input().split()))
c.sort()
t = [-1] * n 
p = sum(c[:n-1])
q = defaultdict(list)
for i in range(n-1):
    q[s[i][0]] += [s[i][1]]
    q[s[i][1]] += [s[i][0]]

t1 = [t,1]

def find(q,x,t1):
    r = q[x]
    t1[0][x-1] = 0
    for i in range(len(r)):
        if t1[0][r[i]-1] == 0:
            continue
        else:
            t1 = find(q,r[i],t1)
    t1[0][x-1] = t1[1]
    t1[1] += 1
    return t1

o = find(q,1,t1)
o1 = o[0]
print(p)
b = ""
for i in range(n):
    b += str(c[o1[i]-1]) + " "

print(b)

### FIXED CODE ###

from collections import defaultdict
import sys

sys.setrecursionlimit(10 ** 7)
n = int(input())
s = [list(map(int,input().split())) for i in range(n-1)]
c = list(map(int,input().split()))
c.sort()
t = [-1] * n 
p = sum(c[:n-1])
q = defaultdict(list)
for i in range(n-1):
    q[s[i][0]] += [s[i][1]]
    q[s[i][1]] += [s[i][0]]

t1 = [t,1]

def find(q,x,t1):
    r = q[x]
    t1[0][x-1] = 0
    for i in range(len(r)):
        if t1[0][r[i]-1] == 0:
            continue
        else:
            t1 = find(q,r[i],t1)
    t1[0][x-1] = t1[1]
    t1[1] += 1
    return t1

o = find(q,1,t1)
o1 = o[0]
print(p)
b = ""
for i in range(n):
    b += str(c[o1[i]-1]) + " "

print(b)
A=int(input())
B=input().split()
ans=111111111
for i in range(A):
    C=B[i]
    cnt=0
    while C%2==0:
        C//=2
        cnt+=1
    if ans>cnt:
        ans=cnt
print(ans)

### FIXED CODE ###

A=input()
cnt=0
if A[0]=='1':
    cnt+=1
if A[1]=='1':
    cnt+=1
if A[2]=='1':
    cnt+=1
print(cnt)
for i in range(2):
  input = input()
  lines.append(int(input))
searchList = []  
for i in range(lines[0]):
  split = lines[1].split()
  if split[i] % 2 == 0:
    searchList.appned(split[i])
out = "APPROVED"
for s in searchList:
  if s % 3 != 0 and s % 5 != 0:
    out = "DENIED"
    print(out)
    break
print(out)
    

### FIXED CODE ###

lines = []
for i in range(2):
  inp = input()
  lines.append(inp)
searchList = []  
for i in range(int(lines[0])):
  split = lines[1].split()
  if int(split[i]) % 2 == 0:
    searchList.append(int(split[i]))
out = "APPROVED"
for s in searchList:
  if s % 3 != 0 and s % 5 != 0:
    out = "DENIED"
    print(out)
    break
if out == "APPROVED":
    print(out)