Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

s = input()
K = int(input())
d = list()
for l in range(len(s)):
  for r in range(l,len(s)): #左からl番目、右からr番目までの文字列
    n = s[l:r+1]
    if n not in d:
      d.append(n)
    d.sort()
    d = d[:6]
print(d[K-1])

### FIXED CODE ###

s = input()
K = int(input())
d = list()
for l in range(len(s)):
  for r in range(l,min(l+K+1, len(s))):#左からl番目、右からr番目までの文字列
    n = s[l:r+1]
    if n not in d:
      d.append(n)
    d.sort()
    d = d[:5]
print(d[K-1])
### BUGGY CODE ###

N=int(input())
A=list(map(int, input().split()))
ans=1
flag=True
for i in range(len(A)):
  ans*=A[i]

if ans>10**18:
  flag=False
    
print(ans) if flag else print(-1)

### FIXED CODE ###

N=int(input())
A=list(map(int,input().split()))
A.sort()
ans=1
for i in range(N):
  ans=ans*A[i]
  if ans==0 or ans>10**18:
    break
    
    
if ans>10**18:
  print(-1)
else:
  print(ans)
### BUGGY CODE ###

# -*- coding: utf-8 -*-
import sys

def main():
	A, B = map(int, input().split(" "))
	
	ans = A
	for i in range(A+1, B+1):
		ans = ans ^ i
		
	print(ans)
	
if __name__ == "__main__":
	main()
	

### FIXED CODE ###

# -*- coding: utf-8 -*-
import sys

def main():
	A, B = map(int, input().split(" "))
	
	B0 = 0
	if B % 2 == 1:
		tmp = (B + 1) // 2
		if tmp % 2 == 1: B0 = 1
		else: B0 = 0
	else:
		tmp = B // 2
		if tmp % 2 == 1: B0 = 1
		else: B0 = 0
		B0 = B0 ^ B
		
	A0 = 0
	if (A-1) % 2 == 1:
		tmp = A // 2
		if tmp % 2 == 1: A0 = 1
		else: A0 = 0
	else:
		tmp = (A-1) // 2
		if tmp % 2 == 1: A0 = 1
		else: A0 = 0
		A0 = A0 ^ (A-1)
		
	print(B0 ^ A0)
		
if __name__ == "__main__":
	main()
### BUGGY CODE ###

N, K = map(int, input().split())
A = list(map(int, input().split()))
scrlst = []
for i in range(N - K + 1):
  scr = 1
  for j in range(K):
    scr *= A[i+j]
  scrlst.append(scr)
for i in range(N - K):
  print('Yes' if scrlst[i+1] > scrlst[i] else 'No')

### FIXED CODE ###

N, K = map(int, input().split())
A = tuple(map(int, input().split()))
for i in range(N - K): print('Yes' if A[K + i] > A[i] else 'No')
### BUGGY CODE ###

# 期待値自体が苦手なので厳しい
# 解説AC
def main():
    import sys
    sys.setrecursionlimit(10**6)
    N = int(input())
    A = [int(i) for i in input().split()]
    dp = [[[0]*(N+1) for _ in range(N+1)] for _ in range(N+1)]
    c = [0]*4
    for a in A:
        c[a] += 1

    def rec(c1, c2, c3):
        if c1 == c2 == c3 == 0:
            return 0
        if dp[c1][c2][c3] != 0:
            return dp[c1][c2][c3]
        ret = N
        if c1 > 0:
            ret += rec(c1-1, c2, c3) * c1
        if c2 > 0:
            ret += rec(c1 + 1, c2-1, c3) * c2
        if c3 > 0:
            ret += rec(c1, c2 + 1, c3-1) * c3
        ret /= c1 + c2 + c3
        dp[c1][c2][c3] = ret
        return ret

    print(rec(*c[1:]))


if __name__ == '__main__':
    main()


### FIXED CODE ###

# 期待値自体が苦手なので厳しい
# 解説AC
def main():
    import sys
    sys.setrecursionlimit(10**6)
    N = int(input())
    A = [int(i) for i in input().split()]
    dp = [0]*(N*((N+1)**2) + N*(N+1) + N + 1)
    c = [0]*4
    for a in A:
        c[a] += 1

    def rec(c1, c2, c3):
        if c1 == c2 == c3 == 0:
            return 0
        if dp[c1 * (N+1)**2 + c2 * (N+1) + c3] != 0:
            return dp[c1 * (N+1)**2 + c2 * (N+1) + c3]
        ret = N
        if c1 > 0:
            ret += rec(c1-1, c2, c3) * c1
        if c2 > 0:
            ret += rec(c1 + 1, c2-1, c3) * c2
        if c3 > 0:
            ret += rec(c1, c2 + 1, c3-1) * c3
        ret /= c1 + c2 + c3
        dp[c1 * (N+1)**2 + c2 * (N+1) + c3] = ret
        return ret

    print(rec(*c[1:]))


if __name__ == '__main__':
    main()
### BUGGY CODE ###


def s0():return input()
def s1():return input().split()
def s2(n):return [input() for x in range(n)]
def s3(n):return [input().split() for _ in range(n)]
def s4(n):return [[x for x in s] for s in s2(n)]
def n0():return int(input())
def n1():return [int(x) for x in input().split()]
def n2(n):return [int(input()) for _ in range(n)]
def n3(n):return [[int(x) for x in input().split()] for _ in range(n)]
def t3(n):return [tuple(int(x) for x in input().split()) for _ in range(n)]
def p0(b,yes="Yes",no="No"): print(yes if b else no)
# from sys import setrecursionlimit
# setrecursionlimit(1000000)
from collections import Counter,deque,defaultdict
# import itertools
# import math
# import networkx as nx
# from bisect import bisect_left,bisect_right
# from heapq import heapify,heappush,heappop
n=n0()
A=n1()

A.sort()
A=deque(A)
d=defaultdict(int)
for j in A:
    d[j]+=1

ans=0
while len(A)>0:
    a=A.popleft()
    if d[a]<=1:
        ans+=1
    B=[]
    for i in A:
        if i%a!=0:
            B.append(i)
    A=deque(B)
print(ans)          

### FIXED CODE ###


def s0():return input()
def s1():return input().split()
def s2(n):return [input() for x in range(n)]
def s3(n):return [input().split() for _ in range(n)]
def s4(n):return [[x for x in s] for s in s2(n)]
def n0():return int(input())
def n1():return [int(x) for x in input().split()]
def n2(n):return [int(input()) for _ in range(n)]
def n3(n):return [[int(x) for x in input().split()] for _ in range(n)]
def t3(n):return [tuple(int(x) for x in input().split()) for _ in range(n)]
def p0(b,yes="Yes",no="No"): print(yes if b else no)
# from sys import setrecursionlimit
# setrecursionlimit(1000000)
from collections import Counter,deque,defaultdict
# import itertools
# import math
# import networkx as nx
# from bisect import bisect_left,bisect_right
# from heapq import heapify,heappush,heappop
n=n0()
A=n1()

A.sort()
m=A[-1]

d=defaultdict(int)
d2=defaultdict(int)

for i in A:
    d2[i]+=1

ans=0
for a in A:
    if d[a]==0:
        if d2[a]<=1:
            ans+=1
        i=a
        while i<=m:
            d[i]=1
            i+=a
print(ans)
### BUGGY CODE ###

# -*- coding: utf-8 -*-
N = int(input())


ans_len = 0
ans_num = 0
zero = []
for i in range(1,N+1):
    temp = i * (i+1) // 2
    zero.append(temp)
    if temp == N:
        ans_len = i+1
        ans_num = i

ans_list = [[] for _ in range(ans_len)]

if N in zero:
    print('Yes')
else:
    print('No')
    exit()


low_idx = 0
up_idx = 1
for i in range(1,N+1):
    ans_list[low_idx].append(i)
    ans_list[up_idx].append(i)
    if i in zero:
        low_idx = 0
        up_idx += 1
    else:
        low_idx += 1

# print(ans_list)
print(len(ans_list))
for a in ans_list:
    print(len(a)," ".join([str(x) for x in a]))


"""
1 2 3 4 5  6  7
2 4 6 8 10 12 14 16 18 20
2   3      4           5
1   2      3           4
0 1 0 1 2  0  1  2  3  0

12
13
23

1347
1258
2369
456 10
789 10

124
135
236
456

"""


### FIXED CODE ###

# -*- coding: utf-8 -*-
N = int(input())

ans_len = 0
ans_num = 0
zero = []
for i in range(1,N+1):
    temp = i * (i+1) // 2
    zero.append(temp)
    if temp == N:
        ans_len = i+1
        ans_num = i
        break

ans_list = [[] for _ in range(ans_len)]

if N in zero:
    print('Yes')
else:
    print('No')
    exit()


low_idx = 0
up_idx = 1
for i in range(1,N+1):
    ans_list[low_idx].append(i)
    ans_list[up_idx].append(i)
    if i in zero:
        low_idx = 0
        up_idx += 1
    else:
        low_idx += 1

# print(ans_list)
print(len(ans_list))
for a in ans_list:
    print(len(a)," ".join([str(x) for x in a]))


"""
1 2 3 4 5  6  7
2 4 6 8 10 12 14 16 18 20
2   3      4           5
1   2      3           4
0 1 0 1 2  0  1  2  3  0

12
13
23

1347
1258
2369
456 10
789 10

124
135
236
456

"""
### BUGGY CODE ###

import collections
import bisect
import sys
input = sys.stdin.readline
N, M, Q = map(int, input().split())
LR = [tuple(map(int, input().split())) for i in range(M)]


table = collections.defaultdict(list)
for L, R in LR:
    table[L].append(R)

for x in table:
    table[x].sort()

for _ in range(Q):
    p, q = map(int, input().split())
    ans = 0
    for i in range(p, q+1):
      if i in table:
        ans += bisect.bisect_right(table[i], q)
    print(ans)


### FIXED CODE ###

import collections
import bisect
import sys
input = sys.stdin.readline
N, M, Q = map(int, input().split())
LR = [tuple(map(int, input().split())) for i in range(M)]
dp = [[0]*(N+1) for i in range(N+1)]

for L, R in LR:
    dp[L][R] += 1
for i in reversed(range(1, N)):
    for j in range(1, N+1):
        dp[i][j] += dp[i+1][j]

for i in range(1, N+1):
    for j in range(1, N+1):
        dp[i][j] += dp[i][j-1]


for _ in range(Q):
    p, q = map(int, input().split())
    print(dp[p][q])
### BUGGY CODE ###

import math
n, m = [int(i) for i in input().split()]
p = [int(input()) for i in range(m)]
 
a = []
a.append(1)
if 1 in p:
    a.append(0)
else:
    a.append(1)
for i in range(2, n + 1):
    if i in p:
        a.append(0)
    else:
        a.append((a[i - 2] + a[i - 1]) % 1000000007)
    
print(a[n])

### FIXED CODE ###

import math
n, m = [int(i) for i in input().split()]
p = [0 for i in range(n + 1)]
for _ in range(m):
    p[int(input())] = 1
    
a = []
a.append(1)
if p[1] == 1:
    a.append(0)
else:
    a.append(1)
for i in range(2, n + 1):
    if p[i] == 1:
        a.append(0)
    else:
        a.append((a[i - 2] + a[i - 1]) % 1000000007)
    
print(a[n])
### BUGGY CODE ###

import sys


def solve():
    readline = sys.stdin.buffer.readline
    mod = 10 ** 9 + 7
    l, r = list(map(int, readline().split()))
    t = 10 ** 20
    for i in range(l, r + 1):
        for j in range(i + 1, r + 1):
            t = min(t, i * j % 2019)
        if t == 0:
            break
    print(t)


if __name__ == '__main__':
    solve()


### FIXED CODE ###

l, r = map(int, input().split())
ans = 10 ** 9
for i in range(l, r + 1):
    for j in range(i + 1, r + 1):
        ans = min(ans, (i * j) % 2019)
        if ans == 0:
            print(ans)
            exit()
print(ans)
### BUGGY CODE ###

from operator import mul
from functools import reduce

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


S = input()
l = len(S)
d = {}


ans = 0
for i in range(l):
    m = int(S) % 2019
    if m in d:
        d[m] += 1
    else:
        d[m] = 1
    S = S[1:]

for k, v in d.items():
    if v >= 2:
        ans += cmb(v, 2)
    if k == 0:
        ans += v
print(ans)



### FIXED CODE ###

S = input()
l = len(S)
d = {}

m = 0

ans = 0
for i in range(l):
    m  = (m + int(S[l-1-i]) * pow(10,i,2019)) % 2019
    if m in d:
        d[m] += 1
    else:
        d[m] = 1

for k, v in d.items():
    if v >= 2:
        ans += int(v * (v-1)/2)
    if k == 0:
        ans += v
print(ans)
### BUGGY CODE ###

from collections import deque
import numpy as np
h, w = map(int, input().split())
mass = [input() for _ in range(h)]

dx = [0, 0, 1, -1]
dy = [1, -1, 0, 0]


def bfs(s, t):
    if mass[s][t] == "#":
        return 0
    visited = np.zeros((h, w))
    depth = np.zeros((h, w))
    q = deque([[s, t]])
    while q:
        x, y = q.popleft()
        visited[x][y] += 1
        for d in range(4):
            nx = x + dx[d]
            ny = y + dy[d]
            if nx < 0 or h - 1 < nx:
                continue
            if ny < 0 or w - 1 < ny:
                continue

            if mass[nx][ny] == "#":
                continue
            if visited[nx][ny]:
                continue

            q.append([nx, ny])
            depth[nx][ny] = depth[x][y] + 1
    return np.max(depth)


ans = 0
for i in range(h):
    for j in range(w):
        ans = max(ans, bfs(i, j))
print(int(ans))



### FIXED CODE ###

import numpy as np
from collections import deque
h, w = map(int, input().split())
r = [list(input()) for i in range(h)]


def dist(s, t):
    if r[s][t] == "#":
        return 0
    else:
        visited = np.zeros((h, w))
        visited[s][t] += 1
        distance = np.zeros((h, w))
        q = deque([[s, t]])
        while len(q) > 0:
            i, j = q.popleft()
            d = distance[i][j] + 1
            if j != w-1:
                if r[i][j+1] == "." and not visited[i][j+1]:
                    q.append([i, j + 1])
                    visited[i][j+1] += 1
                    distance[i][j+1] += d
            if j != 0:
                if r[i][j-1] == "." and not visited[i][j-1]:
                    q.append([i, j - 1])
                    visited[i][j - 1] += 1
                    distance[i][j - 1] += d
            if i != 0:
                if r[i-1][j] == "." and not visited[i-1][j]:
                    q.append([i - 1, j])
                    visited[i-1][j] += 1
                    distance[i-1][j] += d
            if i != h-1:
                if r[i+1][j] == "." and not visited[i+1][j]:
                    q.append([i + 1, j])
                    visited[i+1][j] += 1
                    distance[i+1][j] += d
        return np.max(distance)


ans = 0
for s in range(h):
    for t in range(w):
        ans = max(ans, dist(s, t))

print(int(ans))
### BUGGY CODE ###

from collections import deque
N = int(input())
S = list(list(input()) for i in range(N))
for i in range(N):
    for j in range(N):
        S[i][j] = int(S[i][j])
ans = 0
for i in range(N):
    V = [0]*N
    T = [[0]*N for i in range(N)]
    for i in range(N):
        for j in range(N):
            T[i][j] = S[i][j]
    V[i] = 1
    queue = deque([i])
    while queue:
        q = queue.popleft()
        for i in range(N):
            if T[q][i] == 1:
                queue.append(i)
                if not(V[i] == 0 or V[i] == V[q]+1):
                    print(-1)
                    exit()
                V[i] = V[q]+1
                T[i][q] = 0
                T[q][i] = 0
    ans = max(max(V),ans)
print(ans)


### FIXED CODE ###

from collections import deque
N = int(input())
S = list(input() for i in range(N))
ans = -1
for i in range(N):
    queue = deque([i])
    V = [0]*N
    V[i] = 1
    while queue:
        q = queue.popleft()
        m = V[q]
        for i in range(N):
            if S[q][i] == "1":
                if V[i] == 0:
                    V[i] = m+1
                    queue.append(i)
                elif abs(V[i]-m) != 1:
                    print(-1)
                    exit()
    ans = max(max(V),ans)
print(ans)
### BUGGY CODE ###


a, b = map(int, input().split())
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a
n = gcd(a, b)

def cd(num):
    k = []
    for i in range(1,num+1):
        if num%i == 0:
            if is_prime(i):
                k.append(i) 
    return k

def is_prime(num):
    for i in range(2, num):
        if num % i == 0:
            return False
    return True


gc = gcd(a,b)
c = cd(gc)

print(len(c))

### FIXED CODE ###

def f(n):
    res = set()
    for i in range(2, int(n ** 0.5)):
        if n % i: continue
        while not n % i: n //= i
        res.add(i)
    return res | {n}
 
a, b = map(int,input().split())
print(len(f(a) & f(b) | {1}))
### BUGGY CODE ###

from itertools import permutations
N, M, R = map(int, input().split())
r = list(map(lambda x: int(x) - 1, input().split()))
G = [[float('inf')] * N for i in range(N)]
for i in range(M):
    a, b, c = map(int, input().split())
    a, b = a - 1, b - 1
    G[a][b] = c
    G[b][a] = c


for k in range(N):
    G[k][k] = 0
    for i in range(N):
        for j in range(N):
            G[i][j] = min(G[i][j], G[i][k] + G[k][j])


ans = float('inf')
for perm in permutations(r):
    tmp = 0
    for i in range(R - 1):
        tmp += G[perm[i]][perm[i + 1]]
    ans = min(ans, tmp)

print(ans)


### FIXED CODE ###

from itertools import permutations

N, M, R = map(int, input().split())
r = list(map(int, input().split()))
ARSP = [[float('inf')] * (N+1) for i in range(N+1)]
for i in range(M):
    a, b, c = map(int, input().split())
    ARSP[a][b] = c
    ARSP[b][a] = c


def warshall_floyd(adj_array):
    for k in range(len(adj_array)):
        for i in range(len(adj_array)):
            for j in range(len(adj_array)):
                if adj_array[i][k] + adj_array[k][j] < adj_array[i][j]:
                    adj_array[i][j] = min(adj_array[i][j], adj_array[i][k] + adj_array[k][j])
    return adj_array


ARSP = warshall_floyd(ARSP)

# 訪れ方の全列挙(max 8! = 40320)
journey = list(permutations(r))

ans = float('inf')
for j in journey:
    cost = 0
    for i in range(1, R):
        if ARSP[j[i]][j[i-1]] == float('inf'):
            break
        cost += ARSP[j[i]][j[i-1]]
        if cost >= ans:
            break
    else:
        ans = cost

print(ans)
### BUGGY CODE ###

import numpy as np
from collections import deque
import sys
input = sys.stdin.readline

H, W = list(map(int, input().split()))
S = []
for _ in range(H):
    S.append(input())

ans = 0

d = ((0, 1), (0, -1), (1, 0), (-1, 0))


def bfs(x, y):
    global ans
    m = np.full((H, W), -1, dtype=np.int)

    q = deque()
    q.append([y, x, 0])

    while q:
        j, i, v = q.popleft()
        m[j][i] = v
        for dd in d:
            dj = j + dd[0]
            di = i + dd[1]
            if 0 <= dj < H and 0 <= di < W and m[dj][di] == -1 and S[dj][di] == ".":
                q.append([dj, di, v+1])
                if ans < v+1:
                    ans = v+1


for j in range(H):
    for i in range(W):
        if S[j][i] != ".":
            continue
        bfs(i, j)
print(ans)


### FIXED CODE ###

from collections import deque
import sys
input = sys.stdin.readline

H, W = list(map(int, input().split()))
S = ["#" * (W+2)] + ["#" + input().strip() +
                     "#" for _ in range(H)] + ["#" * (W+2)]

ans = 0

for j in range(1, H+1):
    for i in range(1, W+1):
        if S[j][i] != ".":
            continue
        m = [[-1] * (W+2) for _ in range(H+2)]

        q = deque()
        q.append((j, i, 0))
        m[j][i] = 0

        while q:
            y, x, v = q.popleft()
            if ans < v:
                ans = v
            for dj, di in ((y, x+1), (y, x-1), (y+1, x), (y-1, x)):
                if S[dj][di] == "#" or m[dj][di] != -1:
                    continue
                q.append((dj, di, v+1))
                m[dj][di] = v+1
print(ans)
### BUGGY CODE ###

# -*- coding: utf-8 -*-
N = int(input())
S = list()
word = {}
for i in range(N):
  s = input()
  S.append(s)
  if s in word:
    word[s] += 1
  else:
    word[s] = 1

max_k_list = [kv[0] for kv in word.items() if kv[1] == max(word.values())]
ans_list = sorted(max_k_list)
for ans in ans_list:
  print(ans)

### FIXED CODE ###

# -*- coding: utf-8 -*-
N = int(input())
S = list()
words = {}
for i in range(N):
  s = input()
  S.append(s)
  if s in words:
    words[s] += 1
  else:
    words[s] = 1

max_value = max(words.values())
max_list = list()
for k,v in words.items():
  if v == max_value:
    max_list.append(k)
ans_list = sorted(max_list)
for ans in ans_list:
  print(ans)
### BUGGY CODE ###

import math
import statistics
a=int(input())
#b,c=int(input()),int(input())
# c=[]
# for i in b:
#     c.append(i)
#e1,e2 = map(int,input().split())
# f = list(map(int,input().split()))
j = [input() for _ in range(a)]
# h = []
# for i in range(e1):
#     h.append(list(map(int,input().split())))
s=set(j)
s2=list(s)
s2.sort()
an = []
for i in s2:
    an.append(j.count(i))
s4=[i for i, v in enumerate(an) if v == max(an)]
for i in s4:
    print(s2[i])

### FIXED CODE ###

import math
import statistics
import collections
a=int(input())
#b,c=int(input()),int(input())
# c=[]
#  for i in b:
#     c.append(i)
#e1,e2 = map(int,input().split())
# f = list(map(int,input().split()))
g = [input() for _ in range(a)]
# h = []
# for i in range(e1):
#     h.append(list(map(int,input().split())))

g.sort()

ma=0
count=1
#最大値求める
for i in range(a-1):
    if g[i]==g[i+1]:
        count+=1
    else:
        ma=max(ma,count)
        count=1

ma=max(ma,count)
count=1
ans=[]
#最大値の位置
for i in range(a-1):
    if g[i]==g[i+1]:
        count+=1
    else:
        if count==ma:
            ans.append(g[i])
        count=1
if count==ma:
    ans.append(g[-1])

for i in ans:
    print(i)
### BUGGY CODE ###

import itertools,sys
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
N,W = LI()
wv = [LI() for _ in range(N)]
dp = [[0]*(W+1) for _ in range(N+1)] #1_indexed
for i,j in itertools.product(range(1,N+1),range(W+1)):
    w,v = wv[i-1]
    if j-w>=0:
        dp[i][j] = max(dp[i][j],dp[i-1][j-w]+v)
    dp[i][j] = max(dp[i][j],dp[i-1][j])
print(dp[-1][-1])


### FIXED CODE ###

import itertools,sys
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
N,W = LI()
wv = [LI() for _ in range(N)]
dp = [[0]*(W+1) for _ in range(N+1)] #1_indexed
for i,j in itertools.product(range(N),range(W+1)):
    w,v = wv[i]
    if j-w>=0:
        dp[i+1][j] = max(dp[i+1][j],dp[i][j-w]+v)
    dp[i+1][j] = max(dp[i+1][j],dp[i][j])
print(dp[-1][-1])
### BUGGY CODE ###

import time,sys
start=time.time()
while time.time()-start<=4.98:pass
for input in sys.stdin:print(sum(map(int,input.split())))

### FIXED CODE ###

import time,sys
s=time.time()
while time.time()-s<=4.9775:pass
for i in sys.stdin:print(sum(map(int,i.split())))
### BUGGY CODE ###

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

L = [0]*n
for i in range(n):
    L[i] = A.index(i+1)+1
print(*L)


### FIXED CODE ###

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

L = [0]*n
for i in range(n):
    L[A[i]-1] = i+1
print(*L)
### BUGGY CODE ###

import sys
n = int(sys.stdin.readline())
alist = [int(x) for x in sys.stdin.readline().split()]
attends = [alist.index(y) + 1 for y in sorted(alist)]
print(*attends)


### FIXED CODE ###

n = int(input())
attends = dict(enumerate(list(map(int, input().split())), start=1))
attends_sorted = sorted(attends.items(), key=lambda x: x[1])
arr = [x[0] for x in attends_sorted]
print(*arr)
### BUGGY CODE ###

n = int(input())
A = tuple(map(int, input().split()))
def fact(n):
    factors = set()
    while n%2 == 0:
        factors.add(2)
        n //=2

    for f in range(3, int(n**0.5)+ 1, 2):
        while n%f == 0:
            factors.add(f)
            n //= f
    if n != 1:
        factors.add(n)
    return factors

fact_and = fact(A[0])
fact_or = fact(A[0])

pairwise = True
for a in A[1:]:
    aset = fact(a)
    if len(fact_or & aset):
        # 今まで出てきた素因数と共通するものが見つかったらpairwiseではない
        pairwise = False
    fact_and = fact_and & aset
    fact_or = fact_or | aset

if pairwise:
    print('pairwise coprime')
else:
    if len(fact_and) == 0:
        # すべてに共通する素因数が見つからなかったら
        print('setwise coprime')
    else:
        print('not coprime')


### FIXED CODE ###

N = int(input())
A = tuple(map(int, input().split()))
maxa = max(A)
min_facts = [0] * (maxa+1)
def p(n):
    """ """
    is_prime = [True] * (n+1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, n+1):
        if not is_prime[i]:
            continue
        min_facts[i] = i
        
        for j in range(i*2, n+1, i):
            is_prime[j] = False
            if min_facts[j] == 0:
                min_facts[j] = i
p(maxa)
fact_counts = dict()
for a in A:
    while min_facts[a] > 0:
        f = min_facts[a]
        fact_counts.setdefault(f, 0)
        fact_counts[f] += 1
        while a%f == 0:
            a //= f

pairwise = True
for c in fact_counts.values():
    if c > 1:
        pairwise = False
        break

if pairwise:
    print('pairwise coprime')
else:
    if max(fact_counts.values()) == N:
        print('not coprime')
    else:
        print('setwise coprime')
### BUGGY CODE ###

N = int(input())
S = input()

dp = [[0 for _ in range(N+1)] for _ in range(N+1)]
for i in range(N-1, -1, -1):
    for j in range(N-1, i, -1):
        if S[i] == S[j]:
            dp[i][j] = dp[i+1][j+1]+1

ans = 0
for i in range(N):
    for j in range(i+1, N):
        now = min(dp[i][j], j-i)
        ans = max(ans, now)
print(ans)


### FIXED CODE ###

N = int(input())
S = input()

ans = 0
len_s = 1
for i in range(N):
    tmp_s = S[i:i+len_s]
    while tmp_s in S[i+len_s:]:
        len_s += 1
        tmp_s = S[i:i+len_s]
        ans += 1
print(ans)