Harryxun/stf_run huggingface dataset:
print('Yes' if sorted(input()) < sorted(input(), reverse=True) else 'No')


### FIXED CODE ###

a, b = map(int, input().split())
print((a+b+1)//2)
from collections import Counter


def solve(V):
    n = len(V)
    odd = Counter(V[1::2])
    even = Counter(V[::2])

    even_max = even.most_common(2)
    odd_max = odd.most_common(2)

    if odd_max[0][0] != even_max[0][0]:
        return n - odd_max[0][0] - even_max[0][0]
    elif len(odd_max[0][0]) != 1 and len(even_max[0][0]) == 1:
        return n - odd_max[1][0] - even_max[0][1]
    elif len(odd_max[0][0]) == 1 and len(even_max[0][0]) != 1:
        return n - odd_max[0][1] - even_max[1][1]
    else:
        return n - max(even_max[0][1] + odd_max[1][1],
                       even_max[1][1] + odd_max[0][1])

if __name__ == "__main__":
    n = int(input())
    l = input()
    print(solve(l.split(" ")))


### FIXED CODE ###

import collections
 
n = int(input())
v = list(map(int, input().split()))
a = v[::2]
b = v[1::2]
ac = collections.Counter(a).most_common(2)
bc = collections.Counter(b).most_common(2)
if ac[0][0] != bc[0][0]:
    print(n - ac[0][1] - bc[0][1])
else:
    if len(ac) == 1:
        print(n // 2)
    else:
        print(n - max(ac[0][1] + bc[1][1], ac[1][1] + bc[0][1]))
import math
def combination(n, r):
    return math.factorial(n) // (math.factorial(r) * math.factorial(n - r))

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

print(combination(n, 2) + combination(m,2))

### FIXED CODE ###

import math
def combination(n, r):
    if n <= 0 or n is 1:
        return 0
    return math.factorial(n) // (math.factorial(r) * math.factorial(n - r))

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

print(combination(n, 2) + combination(m,2))
def main():
    N, K = map(int, input().split())
    X = list(map(int, input().split()))
    D = [0]*(N - 1)
    for i in range(1, N):
        D[i-1] = X[i] - X[i - 1]
    ans = 0
    t = 0
    T = [0]*(N - K + 1)
    for i in range(1, N):
        t += D[i-1]
        if i < K:
            if i == K - 1:
                T[0] = t
            continue
        t -= D[i - K]
        T[i - K + 1] = t
    # print(D, T)
    ans = K * 10**8
    for i in range(N - K + 1):
        a = T[i] + min(abs(X[i]), abs[X[i + K - 1])]
        ans = min(a, ans)
    print(ans)

if __name__ == '__main__':
    main()


### FIXED CODE ###

def main():
    N, K = map(int, input().split())
    X = list(map(int, input().split()))
    D = [0]*(N - 1)
    for i in range(1, N):
        D[i-1] = X[i] - X[i - 1]
    ans = 0
    t = 0
    T = [0]*(N - K + 1)
    for i in range(1, N):
        t += D[i-1]
        if i < K:
            if i == K - 1:
                T[0] = t
            continue
        t -= D[i - K]
        T[i - K + 1] = t
    # print(D, T)
    ans = K * 10**8
    for i in range(N - K + 1):
        a = T[i] + min(abs(X[i]), abs(X[i + K - 1]))
        ans = min(a, ans)
    print(ans)

if __name__ == '__main__':
    main()
r,g,b = input().split(" ")

if (int(r)*100+int(g)*10+int(b))%4==0 :
    print("YES")
else :
    print("NO")

### FIXED CODE ###

r,g,b = input().split(" ")

if (int(r)*100+int(g)*10+int(b))%4==0 :
    print("YES")
else :
    print("NO")
from collections import deque

INF = float('inf')

H,W=map(int,input().split())
grid = [input() for i in range(H)]

# 初期の黒('#')の位置からの距離
dist = [[-1]*W for _ in range(H)]

## '#'の位置をキューに追加（＝今回はこれが複数あるので、複数スタートとなる）
black_cells = deque()
for i in range(H):
    for j in range(W):
        if grid[i][j]=="#":
            dist[i][j]=0
            black_cells.append((i,j))

whileblack_cells:
    x,y=black_cells.popleft()#黒マスのスタート地点
    d=dist[x][y]#スタート地点からの距離
    for dy, dx in ((1, 0), (0, 1), (-1, 0), (0, -1)):
        new_x=x+dx
        new_y=y+dy
        if new_y < 0 or H <= new_y or new_x < 0 or W <= new_x:#範囲からはみ出すとき
            continue
        if dist[new_x][new_y]==-1:
            dist[new_x][new_y]=d+1
            black_cells.append((new_x,new_y))
print(d)


### FIXED CODE ###

from collections import deque

H, W = map(int, input().split())
grid = [input() for i in range(H)]

# 初期の黒('#')の位置からの距離
dist = [[-1]*W for _ in range(H)]

# '#'の位置をキューに追加（＝今回はこれが複数あるので、複数スタートとなる）
black_cells = deque()
for h in range(H):
    for w in range(W):
        if grid[h][w] == '#':
            black_cells.append((h, w))
            dist[h][w] = 0

def bfs(black_cells, dist):
    """
    BFSを用いて、全マス目を黒くする回数を求める

    Args:
        black_cells: 「開始時の黒マス」の座標が入ったキュー（複数座標あり）
        dist: 「開始時の黒マス」からの距離の入ったリスト  [[-1, -1, 0], ...]
        　　　（白マスの初期値は0）

    Returns:
        g: 操作を繰り返した数
    """
    d = 0
    while black_cells:
        # キューとして使うのでpop()ではなくpopleft()
        h, w = black_cells.popleft()
        d = dist[h][w]
        for dy, dx in ((1, 0), (0, 1), (-1, 0), (0, -1)):
            new_h = h + dy
            new_w = w + dx
            if new_h < 0 or H <= new_h or new_w < 0 or W <= new_w:
                continue
            if dist[new_h][new_w] == -1:  # セルが白('.')であるのと同義
                dist[new_h][new_w] = d+1
                black_cells.append((new_h, new_w))
    return d

d = bfs(black_cells, dist)
print(d)
b=map(str.input())
if b=="A":
  print("T")
elif b="G":
  print("C")
elif b=="T":
  print("A")
elif b=="C":
  print("G")


### FIXED CODE ###

b=input()

if b == 'A':
    ans='T'
elif b == 'T':
    ans='A'
elif b == 'G':
    ans='C'
elif b == 'C':
    ans='G'

print(ans)
t,a,b=int(input())
print(min(t*a,b))

### FIXED CODE ###

t,a,b=map(int,input().split())
print(min(t*a,b))
d ,t,s = map(int.input().split())
if d/s > t:
  print(No)
else:
  print(Yes)

### FIXED CODE ###

d,t,s = map(int,input().split())
if d/s > t:
  print("No")
else:
  print("Yes")
n=int(input())
h=map(int,input().split())
ans="Yes"
for i in range(n:0:-1):
  if h[i-1]<=h[i]:
    continue
  elif h[i-1]==h[i]+1:
    h[i-1]=h[i-1]-1
  else:
    ans="No"
    break
print(ans)
    
    

### FIXED CODE ###

n=int(input())
h=list(map(int,input().split()))
ans="Yes"
for i in range(n-1,0,-1):
  if h[i-1]<=h[i]:
    continue
  elif h[i-1]==h[i]+1:
    h[i-1]=h[i-1]-1
  else:
    ans="No"
    break
print(ans)
import heapq
N=int(input())
xy=[list(map(int,input().split()))+[i] for i in range(N)]
xy.sort()
path = []

def get_par(n):
    if par[n] is None:return n
    return get_par(par[n])

def same(i,j):
    return get_par(i) == get_par(j)

def unite(i,j):
    j = get_par(j)
    par[j] = i
    return

for k in range(N-1):
    x,y,i = xy[k]
    x2,y2,j = xy[k+1]
    if i>j:i,j = j,i
    heapq.heappush(path,(abs(x-x2),i,j))
xy.sort(key=lambda x:x[1])
for k in range(N-1):
    x,y,i = xy[k]
    x2,y2,j = xy[k+1]
    if i>j:i,j = j,i
    heapq.heappush(path,(abs(y-y2),i,j))
par = [None]*N
cnt = 0
ans = 0
while cnt < N-1:
    c,i,j = heapq.heappop(path)
    if same(i,j):continue
    unite(i,j)
    ans += c
    cnt += 1
print(ans)

### FIXED CODE ###

import sys
sys.setrecursionlimit(100000)
N=int(input())
xy=[list(map(int,input().split()))+[i] for i in range(N)]
xy.sort()
path = []

def get_par(n):
    if par[n] is None:return n
    par[n] = get_par(par[n])
    return par[n]

def same(i,j):
    return get_par(i) == get_par(j)

def unite(i,j):
    j = get_par(j)
    par[j] = get_par(i)
    return

for k in range(N-1):
    x,y,i = xy[k]
    x2,y2,j = xy[k+1]
    path.append((abs(x-x2),i,j))
xy.sort(key=lambda x:x[1])
for k in range(N-1):
    x,y,i = xy[k]
    x2,y2,j = xy[k+1]
    path.append((abs(y-y2),i,j))
path.sort(key = lambda x:x[0],reverse=True)
par = [None]*N
cnt = 0
ans = 0
while cnt < N-1:
    c,i,j = path.pop()
    if same(i,j):continue
    unite(i,j)
    ans += c
    cnt += 1
print(ans)
#nの約数とn-1の約数全部愚直
n = int(input())
fct1 = []
fct2 = []
for i in range(1,int(n**(1/2))+10):
    if n%i==0:
        fct1.append(i)
        fct2.append(n//i)
    if (n-1)%i==0:
        fct1.append(i)
        fct2.append((n-1)//i)

fct = set(fct1+fct2)
if 1 in fct:
    fct.remove(1)
ans = 0
for k in fct:
    n2 = n
    while n2 and n2%k==0:
        n2//=k
        test += 1
    n2%=k
    if n2==1:
        ans += 1
print(ans)

### FIXED CODE ###

#nの約数とn-1の約数全部愚直
n = int(input())
fct1 = []
fct2 = []
for i in range(1,int(n**(1/2))+10):
    if n%i==0:
        fct1.append(i)
        fct2.append(n//i)
    if (n-1)%i==0:
        fct1.append(i)
        fct2.append((n-1)//i)

fct = set(fct1+fct2)
if 1 in fct:
    fct.remove(1)
ans = 0
for k in fct:
    n2 = n
    while n2 and n2%k==0:
        n2//=k
    n2%=k
    if n2==1:
        ans += 1
print(ans)
n,k,s = list(map(int, input().split()))
if s<10**9:
    ans=[s]*k+[s+1]*(n-k)
else:
    ans=[s]*k+[1]*(n-k)
print(*ans)

### FIXED CODE ###

h = int(input())
w = int(input())
n = int(input())

q,r = divmod(n, max(h,w))
print(q + int(bool(r)))
N = int(input())
A = [int(input()) for _ in range(N)]

maxims = [A[0]]
ans = 1
minim = A[0]
for a in A[1:]:
    if a > minim:
        for j,m in reversed(enumerate(maxims)):
            if a > m:
                if m == minim:
                    minim = a
                maxims[j] = a
                break
    else:
        maxims.append(a)
        ans += 1
        minim = a
print(ans)
    
    
    

### FIXED CODE ###

import bisect
import sys
input = sys.stdin.readline

N = int(input())
A = [-1*int(input()) for _ in range(N)]

maxims = [A[0]]
ans = 1
for a in A[1:]:
    if maxims[-1] > a:
        idx = bisect.bisect(maxims,a)
        maxims[idx] = a
    else:
        maxims.append(a)
        ans += 1
    
print(ans)
b,c,a=1,M=1e9+7;main(s){for(scanf("%d",&s);s-->2;c=(a+b)%M)a=b,b=c;printf("%d",c);}

### FIXED CODE ###

M = 10**9 + 7
s = int(input())

f = [1]
for i in range(1, s - 2):
  f.append(f[-1] * i % M)

r = 0
for k in range(s // 3):
  t = s - 2 * k - 3
  r += f[t] * pow(f[k], M - 2, M) * pow(f[t - k], M - 2, M)

print(r % M)
count=0
N=input()
S=input()
N=int(N)
for i in range(N-2):
  if(S[i]=="A" and S[i+1]=="B" and S[i+2]=="C"):
    count++
print(count)

### FIXED CODE ###

count=0
N=input()
S=input()
N=int(N)
for i in range(N-2):
  if(S[i]=="A" and S[i+1]=="B" and S[i+2]=="C"):
    count+=1
print(count)
import collections
import operator

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

D_dict = collections.Counter(D)
D_dict_sorted = sorted(D_dict.items(), key=operator.itemgetter(0))

if not D[0] != 0:
    ans = 1
    for i in range(int(max(D))):
        ans *= D_dict_sorted[i][1] ** D_dict_sorted[i+1][1] % 998244353
else:
    ans = 0

print(ans)

### FIXED CODE ###

import collections
import operator

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

D_dict = collections.Counter(D)
D_dict_sorted = sorted(D_dict.items(), key=operator.itemgetter(0))

# l = []
# for i in range(int(max(D))):
#     if D_dict_sorted[i][0] + 1 == D_dict_sorted[i+1][0]
#     l.append()

if (D[0] == 0) and (D_dict_sorted[0][1] == 1) :
    ans = 1
    for i in range(len(D_dict_sorted)-1):
        if D_dict_sorted[i][0] + 1 == D_dict_sorted[i+1][0]:
            ans *= D_dict_sorted[i][1] ** D_dict_sorted[i+1][1]
            if ans >= 998244353:
                ans = ans % 998244353
        else:
            ans = 0
else:
    ans = 0

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

for i in range(1, N):
    if H[i] > H[i+1]:
        H[i] -= 1

if H == sorted(H):
    print('Yes')
else:
    print('No')

### FIXED CODE ###

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

for i in range(N):
    H[i] -= 1

for j in range(N-1):
    if H[j] > H[j+1]:
        H[j+1] += 1

if H == sorted(H):
    print('Yes')
else:
    print('No')
a,v=map(int,input().split())
b,w=map(int,input().split())
t=int(input())
flag=0
if v<=w:
    if (a>=b):
        if (a-b)/(w-v)<=t:
            flag=1
if (a==b):
    flag=1
elif (b-a)/(v-w)<=t:
    flag=1
if flag==1:
    print('YES')
else:
    print('NO')

### FIXED CODE ###

a,v=map(int,input().split())
b,w=map(int,input().split())
t=int(input())
flag=0
ky=abs(a-b)
if b==a:
    flag=1
elif w>=v:
    pass
elif abs((b-a)/(v-w))<=t:
    flag=1
if flag==1:
    print('YES')
else:
    print('NO')
n,k = map(int,input().split())
a = [int(i)-1 for i in input().split()]
edg = [[] for i in range(n)]
for i in range(n):
  edg[a[i]].append(i)
ans = a[0] != 0
c = [1] * n
def dfs(now, time):
  global ans
  c[now] = 0
  for e in edg[now]:
    if c[e]:
      if time == k:
        ans += 1
        dfs(e, 1)
      else:
        dfs(e, time + 1)
dfs(0, 0)
print(ans)

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**6)
n,k = map(int,input().split())
a = [int(i)-1 for i in input().split()]
edg = [[] for i in range(n)]
for i in range(1,n):
  edg[a[i]].append(i)
ans = [0] * n
ans[0] = a[0] != 0
def dfs(now):
  res = 0
  for e in edg[now]:
    res = max(res, dfs(e)+1)
  if res == k - 1 and a[now] != 0:
    ans[now] = 1
    res = -1
  return res
      
dfs(0)
print(sum(ans))
a=int(input())
b=int(input())
s,t,u=a+b,a-b,a*b
if s>t and s>u:
  print(s)
elif t>s and t>u:
  print(t)
else:
  print(u)

### FIXED CODE ###

a,b = map(int, input().split())
s,t,u=a+b,a-b,a*b
if s>=t and s>=u:
  print(s)
elif t>=s and t>=u:
  print(t)
else:
  print(u)
import numpy as np
a,b,c = map(int,input().split())
if np.sqrt(c) - np.sqrt(a) - np.sqrt(b) > 0
  print('Yes')
else:
  print('No')

### FIXED CODE ###

a,b,c = map(int,input().split())
if (c-a-b > 0) & (4*a*b < (c-a-b) ** 2):
  print('Yes')
else:
  print('No')
H, W = list(map(int, input().split()))
h, w = list(map(int, input().split()))

white = H*W
if h 
black = h*W + w*(H-h)

print(white-black)

### FIXED CODE ###

H, W = list(map(int, input().split()))
h, w = list(map(int, input().split()))

white = H*W
black = h*W + w*(H-h)

print(white-black)
from collections import defaultdict

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

dict = defaultdict(int)

for i in range(M):
  B, C = map(int, input().split())
  dict[C] += B

idx = 0
for k, v in sorted(dict.items(), key=lambda x: -x[0]):
  for _ in range(v):
    if A[idx] < k and idx-1 <= len(A):
      A[idx] = k
      idx += 1
    else:
      print(sum(A))
      exit()

print(sum(A))
  

### FIXED CODE ###

import sys
sys.setrecursionlimit(1000000)

from collections import defaultdict

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

dict = defaultdict(int)

for i in range(M):
  B, C = map(int, input().split())
  dict[C] += B

idx = 0
for k, v in sorted(dict.items(), key=lambda x: -x[0]):
  for _ in range(v):
    if idx+1 <= len(A):
      if A[idx] < k:
      	A[idx] = k
      	idx += 1
      else:
        print(sum(A))
        exit()
    else:
      print(sum(A))
      exit()
      
      
print(sum(A))
listNAB = input().split()
listNABint = [int(s) for s in A]

def Placesum(x):
    y = str(x)
    counter = 0
    for i in range(len(y)):
        counter += int(y[i])
    return counter

sumcounter = 0
for i in range(N):
    if A <= Placesum(i+1) & Placesum(i+1) <= B:
        sumcounter += i+1
        print(sumcounter)
print(sumcounter)

### FIXED CODE ###

listNAB = input().split()
listNABint = [int(s) for s in listNAB]

def Placesum(x):
    y = str(x)
    counter = 0
    for i in range(len(y)):
        counter += int(y[i])
    return counter

sumcounter = 0
for i in range(listNABint[0]):
    if listNABint[1] <= Placesum(i+1) & Placesum(i+1) <= listNABint[2]:
        sumcounter += i+1
print(sumcounter)
n,p=map(int,input().split())
s=input()
def U(x):
    return int(s[x:])
if p in [2,5]:
    keta=0
    ans=0
    for i in range(n):
        keta+=1
        if int(s[i])%p==0:
            ans+=keta
    print(ans)
    exit()


ikeru=[0 for i in range(p)
for i in range(n):
    a=U(i) % p
    ikeru[a]+=1
ans=0
for t in ikeru:
    if t in [0,1]:continue
    ans+= t*(t-1)//2
print(ans)

### FIXED CODE ###

from collections import Counter
n,p=map(int,input().split())
A=list(map(int,input()))
def U(x):
    return int(A[x:])
if p in [2,5]:
    keta=0
    ans=0
    for i in range(n):
        keta+=1
        if int(A[i])%p==0:
            ans+=keta
    print(ans)
    exit()
    
acc = [0 for i in range(n)] 
cur = A[-1] % p
acc[-1] = cur
k = 1
for i in range(n-2, -1, -1):
    cur += pow(10, k, p) * A[i]
    cur %= p
    acc[i] = cur
    k += 1
acc = acc + [0]
 
C = Counter(acc)
ans = 0
for v in C.values():
    ans += v * (v-1) // 2
print(ans)
N, K = map(int,input().split()) 
P = list(map(int,input().split()))
maxsize = 0
expectsum = 0
for i in range(N-K):
    if P[i]>P[i+K]:
        pass 
    else:
        sum_3 = sum(P[i+1:i+K+1])
        if sum_3 >= max_size:
            max_size = sum_3
            expect = 0
            for j in range(K):
                expect += (P[i+1+j]+1)/2
                if expect > expectsum:
                    expectsum = expect
print(expectsum)

### FIXED CODE ###

def expect(n):
    return (int(n)+1)/2
N, K = map(int,input().split()) 
P = list(map(expect,input().split()))
sumlist = [sum(P[0:K])]
sumnumber = sum(P[0:K])
for i in range(N-K):
    sumnumber -=P[i]
    sumnumber +=P[i+K]
    sumlist.append(sumnumber)
print(max(sumlist))
D, N = map(int,input().split())
if N != 100:
    print(N*100**D)
else:
    print(N*100**D + 1)
D, N = map(int,input().split())
if N != 100:
    print(N*100**D)
else:
    print((N+1)*100**D)


### FIXED CODE ###

D, N = map(int,input().split())
if N != 100:
    print(N*100**D)
else:
    print((N+1)*100**D)
s=input()
n=len(s)
li=[]
c=0
for i in range(n):
	if(s[i]=='R'):
		c=c+1
    else:
		li.append(c)
		c=0
li.append(c)
print(max(li))

### FIXED CODE ###

s=input()
n=len(s)
c=0
li=[]
for i in range(n):
  if(s[i]=='R'):
    c=c+1
  else:
    li.append(c)
    c=0
li.append(c)
print(max(li))
a, b, c =map(int, input().split())
print("YES" if b-a=c-b else "NO")

### FIXED CODE ###

a, b, c = map(int, input().split())
print("YES" if b-a==c-b else "NO")
n, k = map(int, input().split())
a = list(map(int, input().split()))
mod = 10 ** 9 + 7

mia = sorted([i for i in a if i < 0], reverse=True)
pla = sorted([i for i in a if i >= 0])
ans, num = 1, []

if len(pla) == 0 and k % 2 == 1:
    for i in mia[:k]:
        ans = ans * i % mod
    print(ans)
    exit()

for _ in range(k):
    if len(mia) > 0 and len(pla) > 0:
        if abs(mia[-1]) <= pla[-1]:
            tmp = pla.pop()
        elif abs(mia[-1]) > pla[-1]:
            tmp = mia.pop()
    elif len(mia) == 0:
        tmp = pla.pop()
    elif len(pla) == 0:
        tmp = mia.pop()
    num.append(tmp)

cnt = sum(i < 0 for i in num)
for i in num:
    ans = ans * i % mod

if cnt % 2 == 1:
    if len(mia) > 0:
        for i in num[::-1]:
            if i >= 0:
                p, q = i, mia.pop()
                break
        if len(pla) == 0:
            ans *= q * pow(p, mod - 2, mod)
    if len(pla) > 0:
        for i in num[::-1]:
            if i < 0:
                r, s = i, pla.pop()
                break
        if len(mia) == 0:
            ans *= s * pow(r, mod - 2, mod)
    if len(mia) > 0 and len(pla) > 0:
        if p * r >= q * s:
            ans *= s * pow(r, mod - 2, mod)
        if p * r < q * s:
            ans *= q * pow(p, mod - 2, mod)
    ans %= mod
print(ans)


### FIXED CODE ###

#with open('random_pm00.txt') as f:
    #n, k = map(int, f.readline().split())
    #a = list(map(int, f.readline().split()))
n, k = map(int, input().split())
a = list(map(int, input().split()))
mod = 10 ** 9 + 7

mia, pla = [], []
for ai in a:
    if ai < 0:
        mia.append(ai)
    elif ai >= 0:
        pla.append(ai)
mia.sort(reverse=True)
pla.sort()

cnt = 1
if len(pla) == 0 and k % 2 == 1:
    for i in mia[:k]:
        cnt = cnt * i % mod
else:
    while k > 0:
        if k == 1 or len(mia) <= 1:
            if len(pla) == 0:
                cnt = cnt * mia.pop() % mod
            elif len(pla) > 0:
                cnt = cnt * pla.pop() % mod
            k -= 1
        elif len(pla) <= 1:
            if k == 1:
                cnt = cnt * pla.pop() % mod
                k -= 1
            elif k > 1:
                cnt = cnt * mia.pop() * mia.pop() % mod
                k -= 2
        elif len(pla) >= 2 and len(mia) >= 2:
            if pla[-1] * pla[-2] > mia[-1] * mia[-2]:
                cnt = cnt * pla.pop() % mod
                k -= 1
            elif pla[-1] * pla[-2] <= mia[-1] * mia[-2]:
                cnt = cnt * mia.pop() * mia.pop() % mod
                k -= 2
print(cnt)
def resolve():
	n, m = map(int, input().split())
	w = list()
	for _ in range(m):
		w.append(input())
	w.sort()
	print("".join(w))

resolve()

### FIXED CODE ###

def resolve():
	n, m = map(int, input().split())
	w = list()
	ans = ""
	for _ in range(n):
		w.append(input())
	w.sort()
	for word in w:
		ans += word
	print(ans)

resolve()
def gcdf(a,n,gcdv):
#    print("a:",a)
    a0=a[0]
    ramin=10**9
    ramin0=20**9
    while ramin0!=ramin:
        ramin0=ramin
        for i in range(n):
            a[i]=a[i]%a0
            if a[i]==0:
                a[i]=a0
            if ramin>a[i]:
                ramin=a[i]
            if ramin<=gcdv:
                return gcdv
        a0=min(a)
#        print("a:",a,ramin)
    return ramin


#n=2
#a=[1000000000, 1000000000]
#n=4
#a=[15, 18, 24, 36]
n=int(input())

a=[]
for i in map(int,input().split()):
    a.append(i)

#print(a)
if n==2:
    print(max(a))
elif n<-16:
    a.sort()
    ns=int(n/4)
    a1=a[0:ns]
    a2=a[ns:ns*2]
    a3=a[ns*2:ns*3]
    a4=a[ns*3:n]
    gcdv=0
    gcd1=gcdf(a1,len(a1),gcdv)
    gcd2=gcdf(a2,len(a2),gcdv)
    gcd3=gcdf(a3,len(a3),gcdv)
    gcd4=gcdf(a4,len(a4),gcdv)
    for i in range(ns):
        acpy=list(a1)
        acpy.append(gcd2)
        acpy.append(gcd3)
        acpy.append(gcd4)
        del acpy[i]
        gcdx=gcdf(acpy,len(acpy),gcdv)
        if gcdx>gcdv:
            gcdv=gcdx
    for i in range(ns):
        acpy=list(a2)
        acpy.append(gcd1)
        acpy.append(gcd3)
        acpy.append(gcd4)
        del acpy[i]
        gcdx=gcdf(acpy,len(acpy),gcdv)
        if gcdx>gcdv:
            gcdv=gcdx
    for i in range(ns):
        acpy=list(a3)
        acpy.append(gcd1)
        acpy.append(gcd2)
        acpy.append(gcd4)
        del acpy[i]
        gcdx=gcdf(acpy,len(acpy),gcdv)
        if gcdx>gcdv:
            gcdv=gcdx
    for i in range(ns):
        acpy=list(a4)
        acpy.append(gcd1)
        acpy.append(gcd2)
        acpy.append(gcd3)
        del acpy[i]
        gcdx=gcdf(acpy,len(acpy),gcdv)
        if gcdx>gcdv:
            gcdv=gcdx
    print(gcdv)
    
else:
    gcdv=0
    a.sort()
    for i in range(n):
        acpy=list(a)
        del acpy[i]
        gcdx=gcdf(acpy,n-1,gcdv)
        if gcdx>gcdv:
            gcdv=gcdx
    print(gcdv)


### FIXED CODE ###

icase=0
if icase==0:
    a,b,t=map(int,input().split())
    n=(t+0.5)//a
    print(b*int(n))
n, m = map(int ,input().split())
graph = [[] for _ in range(n)]
for i in range(m):
  a,b = map(int, input().split())
  graph[a-1].append(b-1)
  graph[b-1].append(a-1)
v = [0]*n
def dfs(node):
  v[node] = 1
  for i in graph[node]:
    if v[i] == 0: dfs(i)
dfs(0)
ans = 0
for i in range(n):
  if v[i] == 0: dfs(i); ans += 1
print(ans)

### FIXED CODE ###

from collections import deque
n, m = map(int ,input().split())
graph = [[] for _ in range(n)]
for i in range(m):
  a,b = map(int, input().split())
  graph[a-1].append(b-1)
  graph[b-1].append(a-1)
v = [0]*n
ans = 0
for i in range(n):
  if v[i] == 0:
    ans += 1
    q = deque()
    q.append(i)
    v[i] = 1
    while q:
      node = q.popleft()
      for j in graph[node]:
        if v[j] == 0:
          q.append(j)
          v[j] = 1
print(ans-1)
,b,c = map(int,raw_input().split())

count = 0
for n in range(a,b+1):
	if c % a == 0:
		count += 1
	a += 1

print('{0}'.format(count))

### FIXED CODE ###

a,b,c = map(int,input().split())
cnt = 0

for i in range(a,b+1):
    if(c%i==0):
        cnt+=1
print(cnt)
n=int(input())
arr=(list(map(int,input().split())))
dp=[0]*n
dp[0]=0
dp[1]=abs(arr[1]-arr[0])
for i in range(2,n):
     dp[i]=min(dp[i-2]+abs(arr[i]-arr[i-2]),dp[i-1]+abs(arr[i]-arr[i-1]))
print(dp[n])

### FIXED CODE ###

n=int(input())
arr=(list(map(int,input().split())))
dp=[0]*n
dp[0]=0
dp[1]=abs(arr[1]-arr[0])
for i in range(2,n):
     dp[i]=min(dp[i-2]+abs(arr[i]-arr[i-2]),dp[i-1]+abs(arr[i]-arr[i-1]))
print(dp[n-1])