Harryxun/stf_run huggingface dataset:
p = str(input())
s = list(p)
k = int(input())

ss = list(set(sorted(s)))
zis = []
for i in ss:
    zis.append(i)
    ones = i
    indexes = [p for p, x in enumerate(s) if x == i]
            
    for kk in indexes:
        st = s[kk]
        count = 0
        while count <= len(s) - kk + 1:
            count = count + 1
            try:
                st = st + s[kk + count]
                zis.append(st)
            except:
                pass
                
    if len(zis) > k:
        break
zissort = list(sorted(list(set(zis))))
print(zissort[k])
                


### FIXED CODE ###


s = str(input())
k = int(input())
kouho = [s]

for i in range(len(s)):
    for plus in range(k+1):
        st = s[i:i + plus]
        kouho.append(st)
so = list(sorted(set(kouho)))
if '' in so:
    so.remove('')
    
print(so[k-1])
N, M = map(int, input().split())
a_n = [int(input()) for i in range(M)]
def Fib(n):    
    if n == 1:
        return 0
    elif n == 2:
        return 1
    else:
        return Fib(n-1)+Fib(n-2)
now = 0
before = -9999
answer = 1

for a in a_n:
    if a - before == 1:
        answer = 0
        break    
    answer *= Fib( a - 1 - now + 2 )
    answer %= 1000000007
    now = a + 1
    before = a

if answer > 0:
    answer *= Fib( N - now + 2)
    answer %= 1000000007

print(answer)

### FIXED CODE ###

N, M = map(int, input().split())
a_n = [int(input()) for i in range(M)]
def Fib(n):
    a, b = 0, 1
    if n == 1:
        return a
    elif n == 2:
        return b
    else:
        for i in range(n-2):
            a, b = b, a + b
        return b
now = 0
before = -9999
answer = 1

for a in a_n:
    if a - before == 1:
        answer = 0
        break

    answer *= Fib( a - 1 - now + 2 )
    answer %= 1000000007
    now = a + 1
    before = a

if answer > 0:
    answer *= Fib( N - now + 2)
    answer %= 1000000007

print(answer)
N = int(input())
W = []
for i in range(N):
  w = int(input())
  if i == 0:
    W.append(w)
    continue
    
  W.append(w + W[i-1])
  
ans = [abs((2 * q) - W[N-1]) for q in W]
print(min(ans))


### FIXED CODE ###

N = int(input())
W = list(map(int, input().split()))
ww = []
for i in range(N):
  ww.append(sum(W[0:i+1]))
ans = [abs((2 * q) - ww[N-1]) for q in ww]
print(min(ans))
n = int(input())
a = list(map(int,input().split()))
s = sorted(a)
k = s[(n//2)-1]
ans = 0
for i in s:
  if i == s[k] or i == s[k]-1 or i ==s[k]+1:
    ans += 1
print(ans)


### FIXED CODE ###

N = int(input())
a = [int(x) for x in input().split()]
memo = [0]*(10**5+2)
ans = 1
for i in range(N):
  memo[a[i]] += 1
  memo[a[i]+1] += 1
  memo[a[i]-1] += 1
print(max(memo))
from functools import reduce
from collections import Counter

N, X = map(int, input().split())
loc = list(map(int, input().split()))

def prime_factors(n):
    i = 2
    factors = []
    while i*i <= n:
        if n % i == 0:
            factors.append(i)
            n = n // i
        else:
            i += 1
    if n > 1:
        factors.append(n)
    return factors

def find_shared_factors(factors):
    counters = [Counter(factor) for factor in factors]
    shared = []
    keys = reduce(lambda x,y: x|y, [set(c.keys()) for c in counters])
    for key in keys:
        r = [counter[key] for counter in counters]
        if min(r) > 0:
            for _ in range(min(r)):
                shared.append(key)
    return shared

d1 = find_shared_factors([prime_factors(abs(l-X)) for l in loc])
d2 = find_shared_factors([prime_factors(abs(loc[i] - loc[j])) for i in range(N) for j in range(N) if i <= j])
d3 = find_shared_factors([d1, d2])
r = reduce(lambda x,y: x*y, d3) if len(d3) > 0 else reduce(lambda x,y: x*y, d1)
print(r)

### FIXED CODE ###

from functools import reduce
N, X = map(int, input().split())
loc = list(map(int, input().split()))


def gcd(a,b):
    if b == 0:
        return a
    else:
        return gcd(b, a%b)


print(reduce(gcd, [abs(l-X) for l in loc]))
N = int(input())
x = [int(input()) for i in range(5)]


for i in range(5):
    if x[i] == min(x):
        break
    
del x[i+1:]

lenx = len(x)
for k in range(4):
    for w in range(lenx-1):
        cnt=0
        if x[w] =< x[w+1] :
            del x[w+1]
            lenx -=1
        else:
            cnt+=1
            
ans=0
if lenx==0:
    print(5)
else:
    if N%x[0]==0:
        ans+=N/x[0]
    else:
        ans+=N//x[0]+1

    for p in range(1,lenx):
        d = N-(ans-p)*x[p]
        if d%x[p] == 0:
            ans+=d/x[p]
        else:
            ans+=d//x[p]+1

    print(ans+5-lenx)
        

### FIXED CODE ###

import math
N = int(input())
x = [int(input()) for i in range(5)]


y = min(x)
print(math.ceil(N/y)+4)
from collections import deque
h, w = map(int, input().split())
grid = []
graph = [[10000 for i in range(w)] for j in range(h)]
#x,y渡すと、（ｈ、ｗ）に入ってるかどうか判定
def check(s,t):
    if (0 <=  s <= h - 1) and (0 <= t <= w - 1):
        return True
    else:
        return False

#graph => そこまでの距離を保存した二次元配列　grid=>与えられた迷路
def bfs(que):
    finished = set()
    while que:
        x , y, cost = que.popleft()
        if (not check(x,y)) or (grid[y][x] == '#' and cost != 0):
            continue
        if (x,y) not in finished and graph[y][x] > cost:
            finished.add((x,y))
            graph[y][x] = cost
            que.append([x+1,y,cost+1])
            que.append([x, y+1, cost+1])
            que.append([x-1,y,cost+1])
            que.append([x,y-1,cost+1])
for i in range(h):
    grid.append(list(input()))
for i in range(h):
    for j in range(w):
        if grid[i][j] == "#":
            que = deque([(j,i,0)])
            bfs(que)
ans = 0
for i in range(h):
    ans = max(ans, max(graph[i]))
print(ans)

### FIXED CODE ###

from collections import deque
import sys
input = sys.stdin.readline
h, w = map(int, input().split())
grid = []
graph = [[2000 for i in range(w)] for j in range(h)]
#x,y渡すと、（ｈ、ｗ）に入ってるかどうか判定
def check(s,t):
    if (0 <=  s <= h - 1) and (0 <= t <= w - 1):
        return True
    else:
        return False

#graph => そこまでの距離を保存した二次元配列　grid=>与えられた迷路
def bfs(que):
    finished = set()
    while que:
        x ,y = que.popleft()
        if y*w+x not in finished:
            finished.add(y*w+x)
            for n_x,n_y in [(x+1,y),(x,y+1),(x-1,y),(x,y-1)]:
                if check(n_y,n_x) and graph[n_y][n_x] > graph[y][x] + 1:
                    graph[n_y][n_x] = graph[y][x] + 1
                    que.append((n_x,n_y))
for i in range(h):
    grid.append(list(input()))
que = deque()
for i in range(h):
    for j in range(w):
        if grid[i][j] == "#":
            graph[i][j] = 0
            que.append((j,i))
bfs(que)
ans = 0
for i in range(h):
    ans = max(ans, max(graph[i]))
print(ans)
s=  input()
s[3] = '8'
print(s)

### FIXED CODE ###

s= input()
if s[:4]=='2017':
  print('2018'+s[4:])
else:
  print(s)
D=input()
T=input()
S=input()
if T-D/S>=0:
    print("Yes")
    else print("No")


### FIXED CODE ###

D,T,S=input().split()
D=int(D)
T=int(T)
S=int(S)
a=float(T-D/S)
if a>=0:
    print("Yes")
else :
    print("No")
N = int(input())
 
P = list(range(2, N+1)) + [1]
I = range(1, N+1)
 
total = 0
for i in range(1, N+1):
    p = (i + 1) if i < N else 1
    total += i % p
print(total)    


### FIXED CODE ###

N = int(input())

if N == 0:
    print(1)
else:
    print(int(N * (N - 1) // 2))
# many TLEs & 2 WAs

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

S = [0]
X = [0]
#check = []
for i in range(N):
    S.append(S[-1] + A[i])
    X.append(X[-1] ^ A[i])
    #if A[i]==0 or bin(A[i]).count('1')==1:
    #    check.append(i+1)
    #    if i>0:
    #        check.append(i)
#check = list(set(check))

#print(A)
#print(S)
#print(X)
#print(check)

ans = N
for i in range(1, N):
#for s in check:
    j = i + 1
    while S[j]-S[i-1]==X[j]^X[i-1]:
        j += 1
        if j==N:
            break
    ans += j - i - 1
    #for j in range(s+1, N+1):
        #print((i,j), S[j]-S[i-1], X[j]^X[i-1])
        #if S[j]-S[s-1]==X[j]^X[s-1]:#xor(i, j):
            #print(s,j)
            #ans += 1
print(ans)


### FIXED CODE ###

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

l = 0 # start index
r = 0 # end index + 1
S = 0 # sum of As
X = 0 # XOR sum of As

ans = 0
while l<N:
    if S==X and r<=N:
        if r<N:
            S += A[r]
            X ^= A[r]
        r += 1
    else:
        S -= A[l]
        X ^= A[l]
        ans += r - l - 1
        l += 1

print(ans)
N = int(input())
S = input().split()

ansAC = 0
ansWA = 0
ansTLE = 0
ansRE = 0

for i in S:
  if i == "AC":
    ansAC += 1
  elif i == "TLE":
    ansTLE += 1
  elif i == "WA":
    ansWA += 1
  elif i == "RE":
    ansRE += 1
print("AC x " + ansAC)
print("WA x " + ansWA)
print("TLE x " + ansTLE)
print("RE x " + ansRE)

### FIXED CODE ###

N = int(input())
ansAC = 0
ansWA = 0
ansTLE = 0
ansRE = 0
 
for i in range(N):
  S = input()
  if S == "AC":
    ansAC += 1
  elif S == "TLE":
    ansTLE += 1
  elif S == "WA":
    ansWA += 1
  elif S == "RE":
    ansRE += 1
print("AC x " + str(ansAC))
print("WA x " + str(ansWA))
print("TLE x " + str(ansTLE))
print("RE x " + str(ansRE))
import sys
for s in sys.stdin.readlines():
    st = []
    for c in s.split():
        if c.isdigit():
            st.append(float(c))
        else:
            b = st.pop(); a = st.pop();
            if c=='+':
                st.append(a+b)
            elif c=='-':
                st.append(a-b)
            elif c=='*':
                st.append(a*b)
            else:
                st.append(a/b)
    print st.pop()

### FIXED CODE ###

import sys
for s in sys.stdin.readlines():
    st = []
    for c in s.strip().split():
        if c=='+':
            st.append(st.pop()+st.pop())
        elif c=='-':
            st.append(-st.pop()+st.pop())
        elif c=='*':
            st.append(st.pop()*st.pop())
        elif c=='/':
            st.append(1/st.pop()*st.pop())
        else:
            st.append(float(c))
    print st.pop()
A, B, C, K = map(int, input().split())
# 1:A枚, 0:B枚, -1:C枚, K枚を選ぶ
A = max(A, K)
B = max(K - A, B)
C = max(K - A - B, C)
assert A + B + C >= K
print(A - C)A, B, C, K = map(int, input().split())
# 1:A枚, 0:B枚, -1:C枚, K枚を選ぶ
A = min(A, K)
B = min(K - A, B)
C = min(K - A - B, C)
assert A + B + C >= K
#print(A, B, C)
print(A - C)

### FIXED CODE ###

A, B, C, K = map(int, input().split())
# 1:A枚, 0:B枚, -1:C枚, K枚を選ぶ
A = min(A, K)
B = min(K - A, B)
C = min(K - A - B, C)
assert A + B + C >= K
#print(A, B, C)
print(A - C)
import sys
def MI(): return map(int,sys.stdin.readline().rstrip().split())

N,C = MI()
A = [[0]*(10**5+1) for i in range(C+1)]
for i in range(N):
    s,t,c = MI()
    A[c][s] += 1
    A[c][t+1] -= 1

from itertools import accumulate

for i in range(1,C+1):
    A[i] = list(accumulate(A[i]))

# A[i][j] が正 ⇔ チャンネル i が時刻 j に録画機が必要

ans = 0
for j in range(10**5+1):
    ans = max(ans,sum(A[i][j] > 0 for i in range(1,C+1)))

print(ans)


### FIXED CODE ###

import sys
def MI(): return map(int,sys.stdin.readline().rstrip().split())

N,C = MI()
A = [[0]*(10**5+2) for i in range(C+1)]
for i in range(N):
    s,t,c = MI()
    A[c][s] += 1
    A[c][t+1] -= 1

from itertools import accumulate

for i in range(1,C+1):
    A[i] = list(accumulate(A[i]))

# A[i][j] が正 ⇔ チャンネル i が時刻 j に録画機が必要

ans = 0
for j in range(10**5+2):
    ans = max(ans,sum(A[i][j] > 0 for i in range(1,C+1)))

print(ans)
import sys
num = sys.stdin
while True:
  a,b = map(int,num.readline().split())
  if (a == 0) and (b == 0):
  break
    if a < b :print(a,b)
    else:print(b,a)

### FIXED CODE ###

import sys
while True:
    a,b=map(int,sys.stdin.readline().split())
    if a==0 and b==0:
        break
    if a<b:print(a,b)
    else:print(b,a)
N, M = map(int, input().split())
a, b = zip(*(map(int, input().split()) for _ in range(M)))


G = [set() for _ in range(N + 1)]
for x, y in zip(a, b):
    G[x].add(y)
    G[y].add(x)


# 次数4の頂点間のパスの数が4でないならばTrueを返す
def f():
    assert 0
    x, y = (i for i in range(1, N + 1) if len(G[i]) == 4)
    q = []
    dp = [0 for _ in range(N + 1)]
    q.append(x)
    dp[x] = 1
    while q:
        i = q.pop()
        for j in G[i]:
            if j == y or dp[j] == 0:
                dp[j] += 1
                q.append(j)
    return dp[y] != 4


# 以下のいずれかを満たすならば、かつ、そのときに限りYes
# - 次数4の頂点間を結ぶ異なる4つのパスが存在しない場合
# - 各頂点の次数は2または4であり、次数4の頂点は3個存在する場合
# - 各頂点の次数は偶数であり、次数が6以上の頂点が存在する場合
ans = (
    'Yes' if (
        all(len(G[i]) % 2 == 0 for i in range(1, N + 1)) and
        (
            any(len(G[i]) >= 6 for i in range(1, N + 1)) or
            sum(len(G[i]) == 4 for i in range(1, N + 1)) >= 3 or
            sum(len(G[i]) == 4 for i in range(1, N + 1)) == 2 and f()
        )
    ) else
    'No'
)

print(ans)


### FIXED CODE ###

N, M = map(int, input().split())
a, b = zip(*(map(int, input().split()) for _ in range(M)))


G = [set() for _ in range(N + 1)]
for x, y in zip(a, b):
    G[x].add(y)
    G[y].add(x)


# 次数4の頂点間のパスの数が4でないならばTrueを返す
def f():
    x, y = (i for i in range(1, N + 1) if len(G[i]) == 4)
    q = []
    dp = [0 for _ in range(N + 1)]
    q.append(x)
    dp[x] = 1
    while q:
        i = q.pop()
        for j in G[i]:
            if j != y and dp[j] == 0:
                q.append(j)
            dp[j] += 1
    return dp[y] != 4


# 以下のいずれかを満たすならば、かつ、そのときに限りYes
# - 次数4の頂点間を結ぶ異なる4つのパスが存在しない場合
# - 各頂点の次数は2または4であり、次数4の頂点は3個存在する場合
# - 各頂点の次数は偶数であり、次数が6以上の頂点が存在する場合
ans = (
    'Yes' if (
        all(len(G[i]) % 2 == 0 for i in range(1, N + 1)) and
        (
            any(len(G[i]) >= 6 for i in range(1, N + 1)) or
            sum(len(G[i]) == 4 for i in range(1, N + 1)) >= 3 or
            sum(len(G[i]) == 4 for i in range(1, N + 1)) == 2 and f()
        )
    ) else
    'No'
)

print(ans)
import sys
sys.setrecursionlimit(100000)

N, M = map(int, input().split())
if M % 2 == 1:
  print(-1)
  exit()
  
E = []
A = [[] for _ in range(N)]
for _ in range(M):
  i, j = map(int, input().split())
  E.append([i-1, j-1])
  A[i-1].append(j-1)
  A[j-1].append(i-1)

tree = [[] for _ in range(N)]
visited = [False] * N
queue = [0]
visited[0] = True
while queue:
  i = queue.pop()
  for j in A[i]:
    if not visited[j]:
      tree[i].append(j)
      tree[j].append(i)
      visited[j] = True
      queue.append(j)

D = [0] * N
for i, j in E:
  if i not in tree[j]:
    print(i+1, j+1)
    D[i] += 1

def f(parent, i):
  for j in tree[i]:
    if j == parent:
      continue
    f(i, j)
    if D[j] % 2 == 0:
      print(i+1, j+1)
      D[i] += 1
    else:
      print(j+1, i+1)
      D[j] += 1
  return

f(0, 0)


### FIXED CODE ###

import sys
sys.setrecursionlimit(1000000)

N, M = map(int, input().split())
if M % 2 == 1:
  print(-1)
  exit()
  
E = []
A = [[] for _ in range(N)]
for _ in range(M):
  i, j = map(int, input().split())
  E.append([i-1, j-1])
  A[i-1].append(j-1)
  A[j-1].append(i-1)

tree = [[] for _ in range(N)]
visited = [False] * N
queue = [0]
visited[0] = True
while queue:
  i = queue.pop()
  for j in A[i]:
    if not visited[j]:
      tree[i].append(j)
      tree[j].append(i)
      visited[j] = True
      queue.append(j)

D = [0] * N
for i, j in E:
  if i not in tree[j]:
    print(i+1, j+1)
    D[i] += 1

def f(parent, i):
  for j in tree[i]:
    if j == parent:
      continue
    f(i, j)
    if D[j] % 2 == 0:
      print(i+1, j+1)
      D[i] += 1
    else:
      print(j+1, i+1)
      D[j] += 1
  return

f(0, 0)
import math
m=[int(i)for i in input().split()]
x=m[2]-m[0]
y=m[3]-m[1]
print(math.sqrt(float(x*x+y*y)))

### FIXED CODE ###

import math
m=[float(i)for i in input().split()]
x=m[2]-m[0]
y=m[3]-m[1]
print(math.sqrt(float(x*x+y*y)))
s = input()
cnt = 0
idx = 0
target = "KIHBR"
for i in range(len(s)):
    if s[i] == "A":
        cnt += 1
        if cnt >= 2:
            print("NO")
            exit()
    else:
        if target[idx] == s[i]:
            idx += 1
        else:
            print("NO")
            exit()
if idx == 5:
    print("YES")


### FIXED CODE ###

s = input()
t = "AKIHABARA"
idx = 0
ng = 0
for i in range(len(t)):
    if t[i] == s[idx]:
        idx += 1
    elif t[i] != "A":
        ng = 1
        break
    if idx == len(s):
        if i < len(t) - 2:
            ng = 1

        break

if idx != len(s):
    ng = 1

if ng:
    print("NO")
else:
    print("YES")
a, b, c, d = map(int, input().split())
while a > 0 and c > 0:
  c -= b
  if c > 0:
    a -= d
    if a <= 0:
    print('No')
  else:
    print('Yes')
  


### FIXED CODE ###

a, b, c, d = map(int, input().split())
while a > 0 and c > 0:
  c -= b
  if c > 0:
    a -= d
    if a <= 0:
      print('No')
  else:
    print('Yes')
from itertools import combinations
import numpy as np
n,m,x = map(int, input().split())
costs = []
understnding = []
ans = 10 ** 20

for _ in range(m):
    tmp = list(map(int, input().split()))
    costs.append(tmp[0])
    understnding.append(tmp[1:])
    
costs = np.array(costs)
understnding = np.array(understnding)
for ele in range(1,m):
    combi = combinations(range(m),ele)
    for j in combi:
        current_under = np.array([sum(understnding[j,ind]) for ind in range(m)])
        tmp_ans = np.sum(costs[list(j)])
        if np.all(current_under>=x) and tmp_ans < ans:
            ans = tmp_ans
if ans != 10 ** 20:
    print(ans)
else:
    print(-1)

### FIXED CODE ###

from itertools import combinations
import numpy as np
n,m,x = map(int, input().split())
costs = []
understnding = []
ans = 10 ** 20

for _ in range(n):
    tmp = list(map(int, input().split()))
    costs.append(tmp[0])
    understnding.append(tmp[1:])
    
costs = np.array(costs)
understnding = np.array(understnding)

for i in range(1, 2**n):
    row = str(bin(i)).split("0b")[1]
    row = '0'*(n - len(row))+row
    one_index = [j for j in range(len(row)) if row[j] =="1"]
    cost_sum = np.sum(costs[one_index])
    under_sum = np.sum(understnding[one_index], axis=0)
    if np.all(under_sum >= x) and cost_sum < ans:
        ans = cost_sum
    
if ans == 10 ** 20:
    print(-1)
else:
    print(ans)
import fractions

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

print(int(a * b / fractions.gcd(a * b)))


### FIXED CODE ###

import fractions

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

print(a * b // fractions.gcd(a, b))
N,K =(int(i) for i in input().split())
x = (int(i) for i in input().split())
i = 0
t_min = float("inf")
while i+K <= N :
  left = abs(x[i])+abs(x[i+K-1]-x[i])
  right = abs(x[i+K-1])+abs(x[i+K-1]-x[i])
  if min(left,right)<t_min:
    t_min = min(left,right)
  i += 1
print(t_min)

### FIXED CODE ###

N,K =(int(i) for i in input().split())
x = list((int(i) for i in input().split()))
i = 0
t_min = float("inf")
while i+K-1 <= N-1 :
  left = abs(x[i])+abs(x[i+K-1]-x[i])
  right = abs(x[i+K-1])+abs(x[i+K-1]-x[i])
  if min(left,right)<t_min:
    t_min = min(left,right)
  i += 1
print(t_min)
a = int(input())
print(a[0])

### FIXED CODE ###

a = input()

result =0

if a[0]=="1":
	result +=1
if a[1]=="1":
	result +=1
if a[2]=="1":
	result +=1
    
print(result)
def sum_ans(data):
    if sum(data) == 15:
        print("+")


def main():
    inputs = input()
    data = inputs.split(" ")
    m = max(data
    ans = 15
    if m > 15:
        print("x")
    else:
        sum_ans()
        if data[0] * data[1] == 15:
            print("*")
        elif data[0] * data[1] < 15:
            print("x")
        
if __name__ == "__main__":
    main()

### FIXED CODE ###

def main():
    inputs = input()
    data = inputs.split(" ")
    data = [int(d) for d in data]
    m = max(data)
    ans = 15
    if int(m) > 15:
        print("x")
    else:
        s = sum(data)
        if data[0] * data[1] == 15:
            print("*")
        elif s == 15:
            print("+")
        else:
            print("x")
        
if __name__ == "__main__":
    main()
a =  float(raw_input())
c = float(raw_input())
print 2*c-a


### FIXED CODE ###

a =  float(raw_input())
c = float(raw_input())
print int(2*c-a)
n = input()
N = str(n)
if 7 in N:
    print(yes)
else:
    print(no)
    

### FIXED CODE ###

n = input()
N = str(n)
if "7" in N:
    print("Yes")
else:
    print("No")
from operator import itemgetter

def input_list(num,args):
    for i in range(num):
        S,P = input().split()
        P=int(P)
        if 1<=len(S)<=10 and S.islower()==1 and S.isalpha()==1 \
           and 0<=P<=100 and isinstance(P,int)==1:
            args.append([S,P])
        else :
            print("ERROR")
            exit()

def sort_list(*args):
    tmp=sorted(args,key=itemgetter(1),reverse=1)
    dict_sorted=sorted(tmp,key=itemgetter(0))

    return dict_sorted


def check_list(seq):
    seen = []
    unique_list = [x for x in seq if x not in seen and not seen.append(x)]
    if len(seq) != len(unique_list):
        print("ERORR")
        exit()
    # else :                                                                                         
    #     print("restaurant is ok.") 
   
  
def main():
    # restaurant=[['N1',88],['N2',85],['N3',92],['N7',21],['N4',34],['N8',45],['N2',24],['N2',35]]   
    # num=8                                                                                          

    num=int(input())
    if 1<=num<=100:
        # [[] for i in range(5)]                                                                     
        restaurant=[]
        input_list(num,restaurant)

        check_list(restaurant)

        # print(restaurant)                                                                          
        restaurant_sorted=sort_list(*restaurant)

        for i in range(num):
            for j in range(num):
                if restaurant_sorted[i][1]==restaurant[j][1]:
                    print(j+1)
    else :
        print("ERORR")
        exit()

if __name__ == "__main__":
    main()



### FIXED CODE ###

import math

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

if 0<=A and P<=100 :
    Pi = math.floor((3*A +P)/2)
    print(Pi)
else :
    print("ERROR")
N = input()
nums = input().split()
res = int(nums.pop(0))

if 0 in nums:
  print('0')
  return

for i in nums:
  res *= int(i)

print(res)

### FIXED CODE ###

import sys
 
N = input()
nums = list(map(int, input().split()))
res = 1

if 0 in nums:
  res = 0
else:
  for i in nums:
    res *= i
    if res > 10 ** 18:
      res = -1
      break
print(res)
L=int(input())
print (L**3/27)

### FIXED CODE ###

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

k=(M*(M-1)+N*(N-1))//2
print (k)
N, Q = map(int, input().split())

nodes = [[] for _ in range(N)]
values = [0 for _ in range(N)]

for _ in range(N-1):
  a, b = map(int, input().split())
  a, b = a-1, b-1
  nodes[a].append(b)
  nodes[b].append(a)

for _ in range(Q):
  p, x = map(int, input().split())
  p = p-1
  values[p] += x

def dfs(i, p):
  for c in nodes[i]:
    if c != p:
      values[c] += values[i]
      dfs(c, i)

dfs(0, None)
print(*values)


### FIXED CODE ###

import sys
input = sys.stdin.readline
sys.setrecursionlimit(1000000)

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

nodes = [[] for _ in range(N)]
values = [0 for _ in range(N)]

for _ in range(N-1):
  a, b = map(int, input().split())
  a, b = a-1, b-1
  nodes[a].append(b)
  nodes[b].append(a)

for _ in range(Q):
  p, x = map(int, input().split())
  p = p-1
  values[p] += x

def dfs(i, p):
  for c in nodes[i]:
    if c != p:
      values[c] += values[i]
      dfs(c, i)

dfs(0, None)
print(*values)
p = [True] * 100000
for x in xrange(2, int(100000 ** 0.5) + 1):
    if p[x]:
        for y in xrange(2, 100000):
            if y * x >= 100000:
                break
            p[x * y] = False
p[0], p[1] = False, False
e, s = [], 0
for i in xrange(100000):
    e.append(s)
    if p[i] and p[(i + 1) / 2]:
        s += 1
for _ in xrange(input()):
    (l, r), c = map(int, raw_input().split()), 0
    print e[r + 1] - e[l]


### FIXED CODE ###

p = [True] * 100020
for x in xrange(2, int(100020 ** 0.5) + 1):
    if p[x]:
        for y in xrange(2, 100020):
            if y * x >= 100020:
                break
            p[x * y] = False
p[0], p[1] = False, False
e, s = [], 0
for i in xrange(100020):
    e.append(s)
    if p[i] and p[(i + 1) / 2]:
        s += 1
for _ in xrange(input()):
    (l, r), c = map(int, raw_input().split()), 0
    print e[r + 1] - e[l]