Harryxun/stf_run huggingface dataset:
s=input()
if s[0]=="1":
  print(s[1])
else:
  print(s[0])


### FIXED CODE ###

s=input()
k=int(input())
if k<=len(s):
  if len(set(s[:k]))==1 and s[0]=="1":
    print(1)
    exit(0)
ans="1"
for c in s:
  if c!="1":
    ans=c
    break
print(ans)
h, w = map(int, input().split())
grid = [[c == "." for c in input()] for i in range(h)]
if not (grid[0][0] and grid[-1][-1]):
    print(-1)
else:
    print(grid[1000000])

### FIXED CODE ###

from collections import deque
h, w = map(int, input().split())
grid = [[c == "." for c in input()] for i in range(h)]
q = deque()
q.append((0,0,1))
visited = set()
min_dist = 0
while q:
    y, x, d = q.popleft()
    # 訪問済み、黒マスならスキップ
    if (y,x) in visited or not grid[y][x]:
        continue
    visited.add((y,x))
    # 終了条件
    if y == h-1 and x == w-1:
        min_dist = d
        break

    for dy, dx in [[-1,0],[1,0],[0,1],[0,-1]]:
        yn = y + dy
        xn = x + dx
        if 0<=yn<h and 0<=xn<w:
            q.append((yn, xn, d+1))
if min_dist:
    white = sum(sum(i) for i in grid)
    #print(white, min_dist)
    print(white - min_dist)
else:
    print(-1)
def main():

    n, m = map(int, input().split())

    import numpy as np
    import scipy.sparse as sp
    ab = [list(map(int, input().split())) for _ in [0]*m]
    g = [[] for _ in [0]*n]
    [g[a-1].append(b-1) for a, b in ab]
    [g[b-1].append(a-1) for a, b in ab]

    data = [1 for a, b in ab]
    row = [a-1 for a, b in ab]
    col = [b-1 for a, b in ab]
    matrix = sp.csr_matrix((data, (row, col)), shape=(n, n), dtype=np.int32)
    d = sp.csgraph.dijkstra(matrix, indices=0)

    print("Yes")
    for i in range(1, n):
        minimum = 10**9
        dire = None
        for j in g[i]:
            if d[j] < minimum:
                minimum = d[j]
                dire = j
        print(dire+1)


main()


### FIXED CODE ###

def main():

    n, m = map(int, input().split())
    ab = [list(map(int, input().split())) for _ in [0]*m]
    g = [[] for _ in [0]*n]
    [g[a-1].append(b-1) for a, b in ab]
    [g[b-1].append(a-1) for a, b in ab]

    import heapq
    h = [(0, 0)]
    heapq.heapify(h)
    d = [10**10]*n
    while h:
        dis, i = heapq.heappop(h)
        if d[i] == 10**10:
            d[i] = dis
            for j in g[i]:
                if d[j] == 10**10:
                    heapq.heappush(h, (dis+1, j))

    print("Yes")
    for i in range(1, n):
        minimum = 10**9
        dire = None
        for j in g[i]:
            if d[j] < minimum:
                minimum = d[j]
                dire = j
        print(dire+1)


main()
base1 = 1009
base2 = 1013
mask = (1 << 32) - 1
def calc_hash(f, r, c):
    global ph, pw, h
    tmp = [[0] * c for _ in range(r)]
    dr, dc = r - ph, c - pw
    t1 = 1
    for _ in range(pw):
        t1 = (t1 * base1) & mask
    for i in range(r):
        e = 0
        for j in range(pw):
            e = e * base1 + f[i][j]
        for j in range(dc):
            tmp[i][j] = e
            e = (e * base1 - t1 * f[i][j] + f[i][j + pw]) & mask
        tmp[i][dc] = e
    t2 = 1
    for _ in range(ph):
        t2 = (t2 * base2) & mask
    for j in range(dc + 1):
        e = 0
        for i in range(ph):
            e = e * base2 + tmp[i][j]
        for i in range(dr):
            h[i][j] = e
            e = (e * base2 - t2 * tmp[i][j] + tmp[i + ph][j]) & mask
        h[dr][j] = e
th, tw = map(int, input().split())
t = tuple(tuple(ord(c) for c in input()) for _ in range(th))
ph, pw = map(int, input().split())
p = tuple(tuple(ord(c) for c in input()) for _ in range(ph))
ans = []
if th >= ph and tw >= pw:
    h = [[0] * tw for _ in range(th)]
    calc_hash(p, ph, pw)
    key = h[0][0] & mask
    calc_hash(t, th, tw)
    for i in range(th - ph + 1):
        for j in range(tw - pw + 1):
            if h[i][j] & mask == key:
			    ans.append(f"{i} {j}")
if ans:
    print("\n".join(a for a in ans))


### FIXED CODE ###

base1 = 1009
base2 = 1013
mask = (1 << 32) - 1
def calc_hash(f, r, c):
    global ph, pw, h
    tmp = [[0] * c for _ in range(r)]
    dr, dc = r - ph, c - pw
    # t1 = 1
    t1 = (base1 ** pw) & mask
    # for _ in range(pw):
        # t1 = (t1 * base1) & mask
    for i in range(r):
        e = 0
        for j in range(pw):
            e = e * base1 + f[i][j]
        for j in range(dc):
            tmp[i][j] = e
            e = (e * base1 - t1 * f[i][j] + f[i][j + pw]) & mask
        tmp[i][dc] = e
    t2 = 1
    for _ in range(ph):
        t2 = (t2 * base2) & mask
    for j in range(dc + 1):
        e = 0
        for i in range(ph):
            e = e * base2 + tmp[i][j]
        for i in range(dr):
            h[i][j] = e
            e = (e * base2 - t2 * tmp[i][j] + tmp[i + ph][j]) & mask
        h[dr][j] = e
th, tw = map(int, input().split())
t = tuple(tuple(ord(c) for c in input()) for _ in range(th))
ph, pw = map(int, input().split())
p = tuple(tuple(ord(c) for c in input()) for _ in range(ph))
ans = []
if th >= ph and tw >= pw:
    h = [[0] * tw for _ in range(th)]
    calc_hash(p, ph, pw)
    key = h[0][0] & mask
    calc_hash(t, th, tw)
    for i in range(th - ph + 1):
        for j in range(tw - pw + 1):
            if h[i][j] & mask == key:
                ans.append(f"{i} {j}")
if ans:
    print("\n".join(a for a in ans))
a,b=int(input())
if (a+b)%2==0:
  print((a+b)/2)
else:
  print((1+a+b)/2)

### FIXED CODE ###

a,b=map(int,input().split())
if (a+b)%2==0:
  print(int((a+b)/2))
else:
  print(int((1+a+b)/2))
S = int(input())
W = int(input())
if W >= S:
    print("unsafe")
else:
    print("safe")



### FIXED CODE ###

S, W = map(int, input().split())
if W >= S:
    print("unsafe")
else:
    print("safe")
import sys
a,b,c = map(int,input())
for i in range(b):
  if(a*i%b==c):
    print("YES")
    sys.exit()
    
print("NO")

### FIXED CODE ###

a,b,c = map(int,input().rstrip().split())
ans = False
for i in range(b):
  if(a*i%b==c and not(ans)):
    print("YES")
    ans = True
    
if(not(ans)):
  print("NO")
if x[0] == sum(x) / len(x):
    print("Yes")
else:
    print("No")

### FIXED CODE ###

x = list(map(int, input().split()))

if x[0] == sum(x) / len(x):
    print("Yes")
else:
    print("No")
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

cooking_time = [a,b,c,d,e]

mindiv10 = min(list(filter(lambda n:n>0, [x%10 for x in cooking_time])))

# search
last_food = 0
for x in cooking_time:
    if x%10 == mindiv10:
        last_food = x
        
cooking_time.remove(last_food)

time = 0
for x in cooking_time:
    time += x + (0 if x%10==0 else 10-x%10)

time += last_food

print(time)

### FIXED CODE ###

# coding: utf-8
# Your code here!

a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

cooking_time = [a,b,c,d,e]

l = [x%10 for x in cooking_time]
if sum(l)==0:
    mindiv10=0
else:
    mindiv10 = min(list(filter(lambda n:n>0, l)))

# search
last_food = 0
for x in cooking_time:
    if x%10 == mindiv10:
        last_food = x
        
cooking_time.remove(last_food)

time = 0
for x in cooking_time:
    time += x + (0 if x%10==0 else 10-x%10)

time += last_food

print(time)
s = input()
p = "No"
a = 0
if len(s) % 2 == 0:
  for i in range(len(s)//2+1):
    if str(s[a]+s[a+1]) == "hi":
      p = "Yes"
      a = a + 2
    else:
      p = "No"
      break;
print(p)

### FIXED CODE ###

s = input()
p = "No"
a = 0
if len(s) % 2 == 0:
  for i in range(len(s)//2):
    if str(s[a]+s[a+1]) == "hi":
      p = "Yes"
      a = a + 2
    else:
      p = "No"
      break;
print(p)
import numpy as np

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

"""
任意の2組みの数字の符号を変えることができる
したがって負の数が偶数個の場合全てを正にして総和をとれば良い
負の数が奇数個の場合絶対値の最小のもののみ負にして総和をとればよい
0が存在する場合はすべて正にできる
"""

A_abs = np.abs(A)

if 0 in A:
    print(np.sum(A_abs))

else:
    num = 0
    for i in range(N):
        if A[i] < 0:
            num += 1

    if num % 2 == 0:
        print(np.sum(A_abs))
    else:
        print(np.sum(A_abs) - 2 * min(A_abs))

### FIXED CODE ###

import numpy as np

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

"""
任意の2組みの数字の符号を変えることができる
したがって負の数が偶数個の場合全てを正にして総和をとれば良い
負の数が奇数個の場合絶対値の最小のもののみ負にして総和をとればよい
0が存在する場合はすべて正にできる
"""

A_abs = np.abs(A)

if 0 in A:
    print(np.sum(A_abs))

else:
    num = 0
    for i in range(N):
        if A[i] < 0:
            num += 1

    if num % 2 == 0:
        print(np.sum(A_abs))
    else:
        print(np.sum(A_abs) - 2 * min(A_abs))
import heapq

N, M = [int(v) for v in input().split(' ')]

class Key:
    def __init__(self, cost, C):
        self.cost = cost
        self.C = C

key_array = []
for m in range(0, M):
    a, b = [int(v) for v in input().split(' ')]
    C = [int(v) - 1 for v in input().split(' ')]

    key_array.append(Key(a, C))


cost_heap = []

def search(box, choice, index, cost):
    if len(choice) == index:
        return

    key = key_array[index]

    choice[index] = 0
    next_index = index + 1
    search(box[:], choice, next_index, cost)

    for o in key.C:
        box[o] = True

    if all_open(box):
        enabled_cost = cost + key.cost
        heapq.heappush(cost_heap, enabled_cost)
        return

    choice[index] = 1
    search(box, choice, next_index, cost + key.cost)

def all_open(box):
    for b in box:
        if b == False:
            return False
    return True

box = [False] * N
choice = [0] * M 

search(box, choice, 0, 0)

if len(cost_heap) == 0:
    print(-1)
    exit()

print(heapq.heappop(cost_heap))

### FIXED CODE ###

N, M = [int(v) for v in input().split(' ')]

a_array = []
b_array = []
c_array = []


for i in range(M):
    a, b = [int(v) for v in input().split(' ')]
    bit = 0
    for c in input().split(' '):
        bit |= 1 << (int(c) - 1)

    a_array.append(a)
    b_array.append(b)
    c_array.append(bit)

key = 0
for c in range(N):
    key |= (1 << c)

dp = [-1 for i in range(key+1)]
dp[0] = 0

for item in range(0, M):
    now = c_array[item]

    for bits in range(0, 1 << N):
        cost1 = dp[bits]
        if cost1 < 0:
            continue

        cost1 += a_array[item]
        cost = dp[bits | now]
        if cost < 0 or cost > cost1:
            dp[bits | now] = cost1
    
print(dp[key])
a, b = map(int, input().split())

if b==1:
    tmp = 0

else:
    tmp = 1

    while tmp*a-tmp+1 < b:
        tmp += 1

print(tmp)

### FIXED CODE ###

s = str(input())
t = str(input())

if s[0] == t[0]:
    a = 1
else:
    a = 0

if s[1] == t[1]:
    b = 1
else:
    b = 0

if s[2] == t[2]:
    c = 1
else:
    c = 0

print(a + b + c)
import sys
sys.setrecursionlimit(10 ** 9)

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

CSUM = [0 for _ in range(N)]
CSUM[0] = A[0]
for i in range(1,N):
  CSUM[i] = CSUM[i-1] + A[i]
#print(CSUM)
def csum(i,j):
  if i == 0:
    return CSUM[j]
  else:
    return CSUM[j]-CSUM[i-1]

dp = [[0 for _ in range(N)] for _ in range(N)]

for k in range(1,N):
  for i in range(N-k):
    j = i+k
    tmp = 10**10
    for l in range(i,j):
      tmp = min(tmp,dp[i][l]+dp[l+1][j])
    dp[i][j] = tmp + sum(S[i:j+1])

print(dp[0][N-1])
#print(dp)


### FIXED CODE ###

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

CSUM = [0 for _ in range(N)]
CSUM[0] = A[0]
for i in range(1,N):
  CSUM[i] = CSUM[i-1] + A[i]
#print(CSUM)
def csum(i,j):
  if i == 0:
    return CSUM[j]
  else:
    return CSUM[j]-CSUM[i-1]

dp = [[0 for _ in range(N)] for _ in range(N)]

for k in range(1,N):
  for i in range(N-k):
    j = i+k
    tmp = 10**18
    for l in range(i,j):
      tmp = min(tmp,dp[i][l]+dp[l+1][j] + csum(i,j))
    dp[i][j] = tmp

print(dp[0][N-1])
#print(dp)
'''
自宅用PCでの解答
'''
import math
#import numpy as np
import itertools
import queue
import bisect
from collections import deque,defaultdict
import heapq as hpq
from sys import stdin,setrecursionlimit
#from scipy.sparse.csgraph import dijkstra
#from scipy.sparse import csr_matrix
ipt = stdin.readline
setrecursionlimit(10**7)
mod = 10**9+7
alp = "abcdefghijklmnopqrstuvwxyz"

def main():
    n,q = map(int,ipt().split())
#    n = 5*10**5
#    q = 5*10**5
#    c = [int(i)+1 for i in range(n)]
    c = list(ipt().split())
    qi = []
    for i in range(q):
        l,r = map(int,ipt().split())
        qi.append(r*((10**6+1)**2)+l*(10**6+1)+i)

    qi.sort()

    ans = [0]*q
    ln = [-1]*(n+1)
    bq_al = [0]*(n+1)

    #Bit_Indexed_Tree
    #A1 ... AnのBIT(1-indexed)
    BIT = [0]*(n+1)

    #A1 ~ Aiまでの和 O(logN)
    def BIT_query(idx):
        res_sum = 0
        while idx > 0:
            res_sum += BIT[idx]
            idx -= idx&(-idx)
        return res_sum

    #Ai += x O(logN)
    def BIT_update(idx,x):
        while idx <= n:
            BIT[idx] += x
            idx += idx&(-idx)
        return

    pr = 0
    for ist in qi:
        i = ist%(10**6+1)
        l = (ist//(10**6+1))%(10**6+1)
        r = ist//(10**6+1)**2
        for j in range(pr,r):
            cj = c[j]
            ij = ln[cj]
            if ij != -1:
                BIT_update(ij,-1)
            ln[cj] = j+1
            BIT_update(j+1,1)
        pr = r

        ans[i] = BIT_query(r)-BIT_query(l-1)


    for i in ans:
        print(i)

    return None

if __name__ == '__main__':

    main()


### FIXED CODE ###

'''
自宅用PCでの解答
'''
import math
#import numpy as np
import itertools
import queue
import bisect
from collections import deque,defaultdict
import heapq as hpq
from sys import stdin,setrecursionlimit
#from scipy.sparse.csgraph import dijkstra
#from scipy.sparse import csr_matrix
ipt = stdin.readline
setrecursionlimit(10**7)
mod = 10**9+7
alp = "abcdefghijklmnopqrstuvwxyz"

def main():
    n,q = map(int,ipt().split())
#    n = 5*10**5
#    q = 5*10**5
#    c = [int(i)+1 for i in range(n)]
    c = [int(i) for i in ipt().split()]
    qi = []
    for i in range(q):
        l,r = map(int,ipt().split())
        qi.append(r*((10**6+1)**2)+l*(10**6+1)+i)

    qi.sort()

    ans = [0]*q
    ln = [-1]*(n+1)
    bq_al = [0]*(n+1)

    #Bit_Indexed_Tree
    #A1 ... AnのBIT(1-indexed)
    BIT = [0]*(n+1)

    #A1 ~ Aiまでの和 O(logN)
    def BIT_query(idx):
        res_sum = 0
        while idx > 0:
            res_sum += BIT[idx]
            idx -= idx&(-idx)
        return res_sum

    #Ai += x O(logN)
    def BIT_update(idx,x):
        while idx <= n:
            BIT[idx] += x
            idx += idx&(-idx)
        return

    pr = 0
    for ist in qi:
        i = ist%(10**6+1)
        l = (ist//(10**6+1))%(10**6+1)
        r = ist//(10**6+1)**2
        for j in range(pr,r):
            cj = c[j]
            ij = ln[cj]
            if ij != -1:
                BIT_update(ij,-1)
            ln[cj] = j+1
            BIT_update(j+1,1)
        pr = r

        ans[i] = BIT_query(r)-BIT_query(l-1)


    for i in ans:
        print(i)

    return None

if __name__ == '__main__':

    main()
a_hands = [*input()]
b_hands = [*input()]
c_hands = [*input()]
turn = 'a'

while True:
    if turn == 'a':
        if len(a_hands) == 0:
            print('A')
            break
        turn = a_hands.pop(0)
    elif turn == 'b':
        if len(b_hands) == 0:
            print('B')
            break
        turn = b_hands.pop(0)
    elif turn == 'c':
        if len(c_hands) == 0:
            print('C')
            break
        turn = c_hands.pop(0)


### FIXED CODE ###

a_hands = list(input())
b_hands = list(input())
c_hands = list(input())
turn = 'a'

while True:
    if turn == 'a':
        if len(a_hands) == 0:
            print('A')
            break
        turn = a_hands.pop(0)
    elif turn == 'b':
        if len(b_hands) == 0:
            print('B')
            break
        turn = b_hands.pop(0)
    elif turn == 'c':
        if len(c_hands) == 0:
            print('C')
            break
        turn = c_hands.pop(0)
def gcd(a, b,c):
    while b:
        a, b = b, a % b
    while c:
        b,c = c, b % c
    return b

""" 
l = []
for a in range(1,int(input())+1):
    for b in range(1, int(input())+1):
        for c in range(1,int(input())+1):
            l.append(gcd(a,b,c))
"""
l = (gcd(a,b,c) for a in range(1,int(input())+1) for b in range(1,int(input())+1) for c in range(1,int(input())+1))

print(sum(l))

### FIXED CODE ###

import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)
 
'''
l = []
for a in range(1,int(input())+1):
    for b in range(1, int(input())+1):
        for c in range(1,int(input())+1):
            l.append(gcd(a,b,c))
'''
N = input() 
N = int(N)+1
l = (gcd(a,b,c) for a in range(1,N) for b in range(1,N) for c in range(1,N))
print(sum(l))
import itertools as it

T = input()

def goodset(a, b, c):
    return (a == b and b == c) or (a + 1 == b and b + 1 == c)

def win(c):
    return goodset(c[0], c[1], c[2]) and goodset(c[3], c[4], c[5]) and goodset(c[6], c[7], c[8])

for i in range(T):
    cards = map(int, raw_input().split())
    color = raw_input().split()
    for j in range(9):
        if color[j] == "G":
            cards[j] += 100
        elif color[j] == "B":
            cards[j] += 200
    w = 0
    for p in it.permutations(range(9)):
        c = [cards[p[j]] for j in range(9)]
        if win(c):
            w = 1
            break
    print w

### FIXED CODE ###

import itertools as it

T = input()

def goodset(a, b, c):
    return (a == b and b == c) or (a + 1 == b and b + 1 == c)

def win(c):
    return goodset(c[0], c[1], c[2]) and goodset(c[3], c[4], c[5]) and goodset(c[6], c[7], c[8])

for i in range(T):
    cards = map(int, raw_input().split())
    color = raw_input().split()
    for j in range(9):
        if color[j] == "G":
            cards[j] += 100
        elif color[j] == "B":
            cards[j] += 200
    w = 0
    for c in it.permutations(cards):#range(9)):
        #c = [cards[p[j]] for j in range(9)]
        if win(c):
            w = 1
            break
    print w
import sys
sys.setrecursionlimit(15000)

*D, = open(0)
n = int(D[0])
 
v = [[] for _ in range(n+1)]
 
dist = {}
 
for i in range(1, n):
    a, b, d = map(int, D[i].split())
    v[a].append(b)
    v[b].append(a)
    dist[(a,b)]=d
    dist[(b,a)]=d
 
def visit(current, v, dist, color):
   
    for it in v[current]:
        if color[it] != None:
            continue
        if dist[(it, current)]%2 == 0:
            color[it] = color[current]
        else:
            color[it] = not color[current]
        visit(it, v, dist, color)
        
color = [None for _ in range(n+1)]
color[1]=True
visit(1, v, dist, color)
 
for i in range(1, n+1):
    if color[i]:
        print('0')
    else:
        print('1')

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**7)
 
*D, = open(0)
n = int(D[0])
 
v = [[] for _ in range(n+1)]
 
dist = {}
 
for i in range(1, n):
    a, b, d = map(int, D[i].split())
    v[a].append(b)
    v[b].append(a)
    dist[(a,b)]=d
    dist[(b,a)]=d
 
def visit(current, v, dist, color):
   
    for it in v[current]:
        if color[it] != None:
            continue
        if dist[(it, current)]%2 == 0:
            color[it] = color[current]
        else:
            color[it] = not color[current]
        visit(it, v, dist, color)
        
color = [None for _ in range(n+1)]
color[1]=True
visit(1, v, dist, color)
 
for i in range(1, n+1):
    if color[i]:
        print('0')
    else:
        print('1')
x,t =map(int,input())
print(float(x/t))

### FIXED CODE ###

x,t =map(int,input().split())
print(x/t)
N = 50001
lst = [True] * N
lst[0] = False
lst[1] = False
for i in range(2, int(N ** 0.5) + 1):
    if lst[i]:
        for j in range(i * i, N, i):
            lst[j] = False

primes = [i for i in range(1, N) if lst[i]]

for s in sys.stdin:
    n = int(s)
    if n == 0:
        break
    elif n % 2 == 1:
        if lst[n - 2]:
            print(1)
        else:
            print(0)
    elif n == 4:
        print(1)
    else:
        counter = 0
        for prime0 in primes:
            prime1 = n - prime0
            if prime0 <= prime1 and lst[prime1]:
                #print(prime0, prime1)
                counter += 1
        print(counter)

### FIXED CODE ###

import sys

N = 50001
lst = [True] * N
lst[0] = False
lst[1] = False
for i in range(2, int(N ** 0.5) + 1):
    if lst[i]:
        for j in range(i * i, N, i):
            lst[j] = False

primes = [i for i in range(1, N) if lst[i]]

for s in sys.stdin:
    n = int(s)
    if n == 0:
        break
    elif n % 2 == 1:
        if lst[n - 2]:
            print(1)
        else:
            print(0)
    elif n == 4:
        print(1)
    else:
        counter = 0
        for prime0 in primes:
            prime1 = n - prime0
            if prime0 <= prime1 and lst[prime1]:
                #print(prime0, prime1)
                counter += 1
        print(counter)
N=int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
B.sort(reverse=True)
Arev=sorted(A, reverse=True)
Brev=sorted(B)
atai=0
s=0
for i in range(len(A)):
    if A[i]==B[i]:
        atai=A[i]
        s+=1
C=[]
for i in range(len(A)):
    C.append(A[i]-B[i])
hajime=C.index(0)
if s==0:
    print("Yes")
    print(*B)
else:
    Acount=A.count(atai)
    Bcount=B.count(atai)
    if N-Acount<Bcount:
        print("No")
    else:
        afirst=A.index(atai)
        alast=N-1-Arev.index(atai)
        bfirst=B.index(atai)
        blast=N-1-Brev.index(atai)
        t=min(afirst,bfirst)
        if t>=s:
            for i in range(0,s):
                B[hajime+i]=B[i]
                B[i]=atai
        else:
            for i in range(0,t):
                B[hajime+i]=B[i]
                B[i]=atai
            ss=s-t
            for i in range(0,ss):
                B[hajime+t+i]=B[-i-1]
                B[-i-1]=atai
        print("Yes")
        print(*B)

### FIXED CODE ###

N=int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
B.sort(reverse=True)
Arev=sorted(A, reverse=True)
Brev=sorted(B)
atai=0
s=0
for i in range(len(A)):
    if A[i]==B[i]:
        atai=A[i]
        s+=1
C=[]
for i in range(len(A)):
    C.append(A[i]-B[i])
if s>0:
    hajime=C.index(0)
if s==0:
    print("Yes")
    print(*B)
else:
    Acount=A.count(atai)
    Bcount=B.count(atai)
    if N-Acount<Bcount:
        print("No")
    else:
        afirst=A.index(atai)
        alast=N-1-Arev.index(atai)
        bfirst=B.index(atai)
        blast=N-1-Brev.index(atai)
        t=min(afirst,bfirst)
        if t>=s:
            for i in range(0,s):
                B[hajime+i]=B[i]
                B[i]=atai
        else:
            for i in range(0,t):
                B[hajime+i]=B[i]
                B[i]=atai
            ss=s-t
            for i in range(0,ss):
                B[hajime+t+i]=B[-i-1]
                B[-i-1]=atai
        print("Yes")
        print(*B)
n,m = (int(x) for x in input('').split(''))
sum = (n * (n - 1) / 2) + (m * (m - 1) / 2)
print(sum)

### FIXED CODE ###

n,m=(int(x) for x in input().split())
sum=int((n*(n-1)/2)+(m*(m-1)/2))
print(sum)
S = input()
if S[3] == S[4] and S[5]==S[6]:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

S = input()
if S[3] == S[2] and S[5]==S[4]:
  print("Yes")
else:
  print("No")
from sys import stdin
ans = 'No'
n,m,k = map(int,stdin.readline())
for i in xrange(n+1):
 for j in xrange(m+1):
  if i*m - b*j==k:
   ans = 'Yes'
print ans

### FIXED CODE ###

from sys import stdin
ans = 'No'
n,m,k = map(int,stdin.readline().split())
for i in xrange(n+1):
    for j in xrange(m+1):
        if i*m - 2*j*i + j*n==k:
            ans = 'Yes'
print ans
a,b,c=map(input().split())
if a==b==c:
  print(-1)
elif a%2==1 or b%2==1 or c%2==1:
  print(0)
else:
  ans=0
  while a%2==0 and b%2==0 and c%2==0:
    ans+=1
    a1=(b+c)//2
    b1=(c+a)//2
    c1=(a+b)//2
    a=a1
    b=b1
    c=c1
print(ans)

### FIXED CODE ###

a,b,c=map(int,input().split())
if a%2==1 or b%2==1 or c%2==1:
  print(0)
elif a==b==c:
  print(-1)
else:
  ans=0
  while a%2==0 and b%2==0 and c%2==0:
    ans+=1
    a1=(b+c)//2
    b1=(c+a)//2
    c1=(a+b)//2
    a=a1
    b=b1
    c=c1
  print(ans)
a = input()
sum = 0
for i in range(len(a)):
  if a[i] == "0" and a[i+1] == "1" and i < len(a-2):
    sum += 2
    a = a[:i] + a[i+2:]
  elif a[i] == "1" and a[i+1] == "0" and i < len(a-2):
    sum += 2
    a = a[:i] + a[i+2]
  elif a[i] == "0" and a[i+1] == "1" and i == len(a-2):
    sum += 2
    a = a[:i]
  elif a[i] == "1" and a[i+1] == "0" and i == len(a-2):
    sum += 2
    a = a[:i]
  else:
    pass
print(sum)

### FIXED CODE ###

s = list(input())
#print(s)
#print(s.count("0"))
print(2*min(s.count("1"),s.count("0")))