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

n,m = (int(x) for x in input().split())

E = [[] for i in range(n+1)]

for i in range(m):
    a,b = (int(x) for x in input().split())
    E[a].append(b)
    E[b].append(a)

#print(E)   

flag = [False]*(n+1)
vs = [1]
flag[1] = True
res = [0]*(n+1)

while(vs):
    this_v = vs[0]
    for i in E[this_v]:
        if flag[i]:
            continue
        else:
            res[i] = this_v
            flag[i] = True
            vs.append(i)
    vs.pop(0)
            
print("Yes")
for i in res[2:]:
    print(i)


### FIXED CODE ###

from collections import deque

n,m = (int(x) for x in input().split())

E = [[] for i in range(n+1)]

for i in range(m):
    a,b = (int(x) for x in input().split())
    E[a].append(b)
    E[b].append(a)

#print(E)   

flag = [False]*(n+1)
#vs = [1]
vs = deque([1])

flag[1] = True
res = [0]*(n+1)

while(vs):
    this_v = vs[0]
    for i in E[this_v]:
        if flag[i]:
            continue
        else:
            res[i] = this_v
            flag[i] = True
            vs.append(i)
    vs.popleft()
            
print("Yes")
for i in res[2:]:
    print(i)
### BUGGY CODE ###

#coding: utf-8
import math
import heapq

MOD = 10**9+7

N = int(input())
L = list(map(int, input().split()))
L.sort()

ans = 0
for a in range(N-2):
    for b in range(a+1,N-1):
        for c in range(b+1,N):
            if(L[c]<L[a]+L[b]):
                ans+=1

print(ans)

### FIXED CODE ###

#coding: utf-8
import math
import heapq
import bisect

MOD = 10**9+7

N = int(input())
L = list(map(int, input().split()))
L.sort()

ans = 0
for a in range(N-2):
    for b in range(a+1,N-1):
        c = bisect.bisect_left(L,L[a]+L[b])
        ans += c-b-1
            
print(ans)
### BUGGY CODE ###

def inpl(): return list(map(int, input().split()))

MLE = [[0]*10000 for _ in [0]*10000]

A, B = inpl()
print([A+B, B-A][B%A > 0])
    

### FIXED CODE ###

def inpl(): return list(map(int, input().split()))

A, B = inpl()
print([A+B, B-A][B%A > 0])
### BUGGY CODE ###

import numpy as np 
H, W = map(int, input().split())
grid = []
for _ in range(H):
    grid.append([s for s in input()])

yoko = [[0 for _ in range(W)] for _ in range(H)]
tate =  [[0 for _ in range(W)] for _ in range(H)]

for h in range(H):
    cnt = 0
    for w in range(W):
        if grid[h][w] == ".":
            cnt += 1
        else:
            cnt = 0
        yoko[h][w] = cnt

for w in range(W):
    cnt = 0
    for h in range(H):
        if grid[h][w] == ".":
            cnt += 1
        else:
            cnt = 0
        tate[h][w] = cnt

tate = np.array(tate)
yoko = np.array(yoko)

for h in range(H):
    my_max = 0
    for w in range(W):
        if yoko[h][W - 1 - w] != 0:
            my_max = max(my_max, yoko[h][W - 1 - w])
            yoko[h][W - 1 - w] = my_max
        else:
            my_max = 0

tate = tate.T

for h in range(W):
    my_max = 0
    for w in range(H):
        if tate[h][H - 1 - w] != 0:
            my_max = max(my_max, tate[h][H - 1 - w])
            tate[h][H - 1 - w] = my_max
        else:
            my_max = 0
            
tate = tate.T
ans = tate + yoko - 1

print(np.max(ans.ravel()))

### FIXED CODE ###

H, W = map(int, input().split())
grid = []
for _ in range(H):
    grid.append([s for s in input()])
    
left = [[0 for _ in range(W)] for _ in range(H)]
right = [[0 for _ in range(W)] for _ in range(H)]
up = [[0 for _ in range(W)] for _ in range(H)]
down = [[0 for _ in range(W)] for _ in range(H)]

for h in range(H):
    for w in range(W):
        if grid[h][w] == ".":
            if w == 0:
                left[h][w] = 1
            else:
                left[h][w] += left[h][w - 1] + 1

for h in range(H):
    for w in range(W)[::-1]:
        if grid[h][w] == ".":
            if w == W - 1:
                right[h][w] = 1
            else:
                right[h][w] += right[h][w + 1] + 1
            
for w in range(W):
    for h in range(H):
        if grid[h][w] == ".":
            if h == 0:
                up[h][w] = 1
            else:
                up[h][w] += up[h - 1][w] + 1
                
for w in range(W):
    for h in range(H)[::-1]:
        if grid[h][w] == ".":
            if h == H - 1:
                down[h][w] = 1
            else:
                down[h][w] += down[h + 1][w] + 1
                
ans = -10000
for h in range(H):
    for w in range(W):
        ans = max(ans, up[h][w] + down[h][w] + right[h][w] + left[h][w] - 3)
print(ans)
### BUGGY CODE ###

N, W = map(int, input().split())
w, v = [0]*N, [0]*N
for i in range(N):
    w[i], v[i] = map(int, input().split())

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

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


### FIXED CODE ###


N, W = map(int, input().split())
w, v = [0]*N, [0]*N
for i in range(N):
    w[i], v[i] = map(int, input().split())

memo = {}

def knapsack(i, j):
    key = '{}-{}'.format(i, j)
    if key in memo:
        return memo[key]
    if i == N:
        r = 0
    elif j < w[i]:
        r = knapsack(i + 1, j)
    else:
        r = max([knapsack(i + 1, j), knapsack(i + 1, j - w[i]) + v[i]])
    memo[key] = r
    return r

print(knapsack(0, W))
### BUGGY CODE ###

a = int(input())
b = 1
c = 0
d = 0
if a%2==0:
  print("-1")
else:
  while b > 0:
    c = 10*c+7
    d = d+1
    if c%a==0:
      b = -1
  print(d)

### FIXED CODE ###

a=int(input())
b=7
for i in range(a):
  if b%a==0:
    print(i+1)
    break
  b=10*b%a+7
  if i==a-1:
    print(-1)
    break
### BUGGY CODE ###

import collections

h,w = map(int,input().split())
maze = []
ans = 0
dy_dx = [[0,1],[1,0],[0,-1],[-1,0]]
for i in range(h):
    s = input()
    a = []
    for j in range(w):
        a.append(s[j])
    maze.append(a)
for i in range(h):
    for j in range(w):
        if maze[i][j] != '#':
            next = collections.deque()
            dist = []
            checked = []
            curmax = 0
            for k in range(h):
                a = [0]*w
                b = [0]*w
                dist.append(a)
                checked.append(b)
            next.append([i,j])
            while len(next) != 0:
                cur = next.popleft()
                checked[cur[0]][cur[1]] = 1
                for l in range(4):
                    t = cur[0]+dy_dx[l][0]
                    u = cur[1]+dy_dx[l][1]
                    if (0 <= t <= h-1) and (0 <= u <= w-1):
                        if checked[t][u] == 0:
                            if maze[t][u] == '.':
                                dist[t][u] = dist[cur[0]][cur[1]]+1
                                next.append([t,u])
                                curmax = max(curmax,dist[t][u])
            ans = max(ans,curmax)
print(ans)

### FIXED CODE ###

from collections import deque

h,w = map(int,input().split())
maze = []
ans = 0
dy_dx = [[0,1],[1,0],[0,-1],[-1,0]]
for i in range(h):
    maze.append(input())
flag = True
check = '.'*w
for i in range(h):
    if maze[i] != check:
        flag = False
        break
if flag:
    print(h+w-2)
else:
    for i in range(h):
        for j in range(w):
            if maze[i][j] == '.':
                ne = deque([[i,j]])
                dist = [[0]*w for k in range(h)]
                checked = [[0]*w for k in range(h)]
                while len(ne) != 0:
                    cur = ne.popleft()
                    checked[cur[0]][cur[1]] = 1
                    for l in range(4):
                        t = cur[0]+dy_dx[l][0]
                        u = cur[1]+dy_dx[l][1]
                        if (0 <= t <= h-1) and (0 <= u <= w-1):
                            if checked[t][u] == 0:
                                if maze[t][u] == '.':
                                    dist[t][u] = dist[cur[0]][cur[1]]+1
                                    ne.append([t,u])
                                    ans = max(ans,dist[t][u])
    print(ans)
### BUGGY CODE ###

S=input()
T=input()


for i in range(len(S)):
    if(S.count(S[i])>1):
        t=T[i]
        for j in range(i+1,len(S)):
            if(S[i]==S[j]):
                if(T[i]!=T[j]):
                    print("No")
                    exit()
for i in range(len(S)):
    if(T.count(T[i])>1):
        t=S[i]
        for j in range(i+1,len(S)):
            if(T[i]==T[j]):
                if(S[i]!=S[j]):
                    print("No")
                    exit()

print("Yes")

### FIXED CODE ###

S=input()
T=input()
S2=[0]*len(S)
T2=[0]*len(T)
SD={}
TD={}

c=0
for i in range(len(S)):
    if(SD.get(S[i],None)==None):
        c+=1
        SD[S[i]]=c
        S2[i]=c
    else:
        S2[i]=SD.get(S[i],None)
c=0
for i in range(len(T)):
    if(TD.get(T[i],None)==None):
        c+=1
        TD[T[i]]=c
        T2[i]=c
    else:
        T2[i]=TD.get(T[i],None)
if(S2==T2):
    print("Yes")
else:
    print("No")
### BUGGY CODE ###

# -*- coding: utf-8 -*-

import collections

n = int(input())
balls = list(map(int, input().split(' ')))

for k in range(n):
    # print(balls[ : k])
    # print(balls[ k + 1: ])
    arr = balls[ : k] + balls[ k + 1 : ]

    dic = collections.Counter(arr)
    total = 0
    for v in dic.values():
        total += int(v * (v - 1) / 2)
    print(total)



### FIXED CODE ###

# -*- coding: utf-8 -*-

import collections

n = int(input())
balls = list(map(int, input().split(' ')))

dic = collections.Counter(balls)
total = 0
for v in dic.values():
    if (v < 2):
        continue
    total += int(v * (v - 1) / 2)

for i in range(n):
    num = balls[i]
    print(total - dic[num] + 1)
### BUGGY CODE ###

n = int(input())
re =1

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

for i in range(n):
    re *= l[i]
    
if(re > 1000000000000000000):
    print("-1")
else:
    print(re)

### FIXED CODE ###

n =int(input())
limit = 10**18
re =1
 
l = list(map(int, input().split()))
 
l.sort()
#print(l)
if(l[0] == 0):
    re = 0
else:
  for i in l:
    re *= i
    #print(re)
    if(re > limit):
      re = -1
      break
print(re)
### BUGGY CODE ###

import bisect

def d162(n , sli):

    ans = 0

    for i in range(n - 3):
        for w in range(i + 1 , n):
            for q in range(w + 1 , n):
                if sli[i] != sli[w] and sli[i] != sli[q] and sli[w] != sli[q] and w - i != q - w:
                    ans += 1
    return ans

def main():
    n = int(input())
    sli = list(str(input()))
    print(d162(n , sli))
if __name__ == '__main__':
    main()

### FIXED CODE ###

import bisect

def d162(n , sli):

    ans = 0
    Rli = []
    Gli = []
    Bli = []

    for i in range(n):
        if sli[i] == "R":
            Rli.append(i)
        elif sli[i] == "G":
            Gli.append(i)
        else:
            Bli.append(i)

    Rcount = len(Rli)
    Gcount = len(Gli)
    Bcount = len(Bli)
    Rli.sort()
    Gli.sort()
    Bli.sort()

    for i in range(n - 3):
        for w in range(i + 1 , n):
            if sli[i] != sli[w]:
                k = "RGB".replace(sli[i] , "").replace(sli[w] , "")
                if k == "R":
                    ans += Rcount - bisect.bisect_right(Rli , w)
                elif k == "G":
                    ans += Gcount - bisect.bisect_right(Gli , w)
                else:
                    ans += Bcount - bisect.bisect_right(Bli , w)
                if w + w - i < n and sli[w + (w - i)] == k:
                    ans -= 1

    return ans

def main():
    n = int(input())
    sli = list(str(input()))
    print(d162(n , sli))
if __name__ == '__main__':
    main()
### BUGGY CODE ###

N = int(input())
A = list(map(int, input().split()))
T = []
for i in range(1,N+1):
    T.append(str(A.index(i)+1))
print(" ".join(T))

### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
T = [0 for i in range(N)]
for i in range(N):
    T[A[i] - 1] = str(i + 1)
print(" ".join(T))
### BUGGY CODE ###

from sys import stdin

N = int(stdin.readline().rstrip())
max_ride = [int(stdin.readline().rstrip()) for _ in range(5)]

shima = [N, 0, 0, 0, 0, 0]
shima_next = [0, 0, 0, 0, 0, 0]

res_time = 0
while(shima[5] != N):
    res_time += 1
    for i in range(5, 0, -1):
        if shima[i-1] == 0:
            continue

        if shima[i-1] > max_ride[i-1]:
            shima_next[i-1] = shima[i-1] - max_ride[i-1]
            shima_next[i] += max_ride[i-1]
        else:
            shima_next[i-1] = 0
            shima_next[i] += shima[i-1]
    
    shima = shima_next[:]

print(res_time)

### FIXED CODE ###

from sys import stdin
import math

N = int(stdin.readline().rstrip())
max_ride = [int(stdin.readline().rstrip()) for _ in range(5)]

res_time = math.ceil(N / min(max_ride) + 4)

print(res_time)
### BUGGY CODE ###

########### E
H, W, M = map(int, input().split())
bombs = []
for _ in range(M):
    bomb = list(map(lambda x:int(x)-1, input().split()))
    bombs.append(bomb)

H_list = [0]*H
W_list = [0]*W
sign = True
for h,w in bombs:
    H_list[h] += 1
    W_list[w] += 1

max_H = [i for i,k in enumerate(H_list) if k == max(H_list)]
max_W = [i for i,k in enumerate(W_list) if k == max(W_list)]

cross = []

for i in max_H:
    for k in max_W:
        if [i,k] not in bombs:
            sign = False
            print(max(H_list) + max(W_list))
            break
    break

if sign:
    print(max(H_list) + max(W_list) -1)


### FIXED CODE ###

import sys


H, W, M = map(int, input().split())
bomb = [tuple(map(lambda x: int(x) - 1, s.split())) for s in sys.stdin.readlines()]
X = [0] * H  # X:各行の爆破対象の個数
Y = [0] * W  # Y:各列の爆破対象の個数
for h, w in bomb:
    X[h] += 1
    Y[w] += 1
maxX = max(X)
maxY = max(Y)

R = [h for h, x in enumerate(X) if x == maxX]  # R:爆破対象の数が最大となる行の番号
C = [w for w, y in enumerate(Y) if y == maxY]  # C:爆破対象の数が最大となる列の番号

bomb = set(bomb)
for r in R:
    for c in C:
        if (r, c) not in bomb:
            # (r, c)に爆破対象が存在しないとき, maxX + maxY が答えとなることが確定するため, 
            # 即座に探索を終了する. これによりループの回数は最大でもM+1回となる.
            print(maxX + maxY)
            exit()
print(maxX + maxY - 1)
### BUGGY CODE ###

import sys

sys.setrecursionlimit(10 ** 6)
INF = float("inf")
MOD = 10 ** 9 + 7


def input():
    return sys.stdin.readline().strip()


def make_divisors(n):
    # exclude itself
    divisors = [1]
    for i in range(2, int(n ** 0.5) + 1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n // i)

    return divisors


def main():
    N = int(input())
    A = list(map(int, input().split()))
    S = [0] * (N)
    B = []
    for i in range(N - 1, -1, -1):
        S[i] %= 2
        if A[i] != S[i]:
            S[i] += 1
            B.append(i + 1)
            ds = make_divisors(i + 1)
            for d in ds:
                S[d - 1] += 1
        else:
            continue

    print(len(B))
    print(*B, sep=" ")


if __name__ == "__main__":
    main()


### FIXED CODE ###

import sys

sys.setrecursionlimit(10 ** 6)
INF = float("inf")
MOD = 10 ** 9 + 7


def input():
    return sys.stdin.readline().strip()


def make_divisors(n):
    # exclude itself
    divisors = [1]
    for i in range(2, int(n ** 0.5) + 1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n // i)

    return divisors


def main():
    N = int(input())
    A = list(map(int, input().split()))
    S = [0] * (N)
    B = []
    for i in range(N - 1, -1, -1):
        S[i] %= 2
        if A[i] != S[i]:
            S[i] += 1
            B.append(i + 1)
            ds = make_divisors(i + 1)
            for d in ds:
                S[d - 1] += 1
        else:
            continue

    print(len(B))
    print(*B, sep=" ")


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

def main():
    N, W = map(int, input().split())
    VN = []
    WN = []
    i = 0
    while i < N:
        w, v = map(int, input().split())
        WN.append(w)
        VN.append(v)
        i += 1

    ans = []
    mask = 0
    while mask < 1<<N:
        i = 0
        w = 0
        v = 0
        while i < N:
            if mask & 1<<i:
                w += WN[i]
                if w > W:
                    break
                else:
                    v += VN[i]
            i += 1
        if w <= W:
            ans.append(v)
        mask += 1

    print(max(ans))

main()


### FIXED CODE ###

def main():
    N, W = map(int, input().split())
    w1 = [0, 0]
    w2 = [0, 0]
    w3 = [0, 0]
    w4 = [0, 0]
    v1 = []
    v2 = []
    v3 = []
    v4 = []
    i = 0
    while i < N:
        w, v = map(int, input().split())
        if i == 0 or w == w1[0]:
            w1[0] = w
            w1[1] += 1
            v1.append(v)
        elif w == w1[0] + 1:
            w2[0] = w
            w2[1] += 1
            v2.append(v)
        elif w == w1[0] + 2:
            w3[0] = w
            w3[1] += 1
            v3.append(v)
        elif w == w1[0] + 3:
            w4[0] = w
            w4[1] += 1
            v4.append(v)
        i += 1

    v1.sort(reverse=True)
    v2.sort(reverse=True)
    v3.sort(reverse=True)
    v4.sort(reverse=True)

    ans = []
    for i in range(w1[1] + 1):
        for j in range(w2[1] + 1):
            for k in range(w3[1] + 1):
                for l in range(w4[1] + 1):
                    w = w1[0] * i + w2[0] * j + w3[0] * k + w4[0] * l
                    v = sum(v1[:i] + v2[:j] + v3[:k] + v4[:l])
                    if w <= W:
                        ans.append(v)

    print(max(ans))

main()
### BUGGY CODE ###

#! /usr/bin/env python
# -*- coding: utf-8 -*-

''' ????????????????????£????????\??? '''


class PQueue(object):
    """ Priority Queue """

    def __init__(self):
        self.pqueue = []

    def insert(self, x):
        self.pqueue.append(x)

    def extractMax(self):
        max_value = max(self.pqueue)
        self.pqueue.pop(self.pqueue.index(max_value))
        return max_value


if __name__ == '__main__':

    pqueue = PQueue()

    line = input()
    while line != 'end':
        if line.split()[0] == 'insert':
            pqueue.insert(int(line.split()[1]))
        elif line.split()[0] == 'extract':
            print(pqueue.extractMax())
        line = input()

### FIXED CODE ###

#! /usr/bin/env python
# -*- coding: utf-8 -*-

''' ????????????????????£????????\??? '''

import heapq


class PQueue(object):
    """ Priority Queue """

    def __init__(self):
        self.pqueue = []

    def insert(self, x):
        # self.pqueue.append(x)
        heapq.heappush(self.pqueue, -x)

    def extractMax(self):
        # return self.pqueue.pop(self.pqueue.index(max(self.pqueue)))
        return -heapq.heappop(self.pqueue)


if __name__ == '__main__':

    pqueue = PQueue()
    result = []

    while True:
        line = input()
        if line == 'end':
            break

        if line.split()[0] == 'insert':
            pqueue.insert(int(line.split()[1]))
        elif line.split()[0] == 'extract':
            result.append(pqueue.extractMax())

    for i in range(len(result)):
        print(result[i])
### BUGGY CODE ###

N = int(input())
S = input()
count = 0
for i in range(0,1000):
    num = str(i).zfill(3)
    digit = 0
    for j in range(N):
        if S[j] == num[digit]:
            digit += 1
        if digit == 3:
            break
    else:
        continue
    count += 1

print(count)

### FIXED CODE ###

def solve():
    N = int(input())
    S = input()
    count = 0
    for i in range(0,1000):
        num = str(i).zfill(3)
        digit = 0
        for j in range(N):
            if S[j] == num[digit]:
                digit += 1
            if digit == 3:
                break
        if digit ==3:
            count += 1

    print(count)

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

I=lambda:map(int,input().split());n,q=I();r=[0]*n;e=[[]for _ in range(n)];exec("a,b=I();e[a-1]+=b-1,;e[b-1]+=a-1,;"*(n-1));exec("q,x=I();r[q-1]+=x;"*q);y=[0]+[1]*n;s=[0]
while s:
 p=s.pop();[exec("y[c]=0;r[c]+=r[p];s+=c,;"*y[c]) for c in e[p]]
print(*r)


### FIXED CODE ###

n,q=map(int,input().split())
edge=[[] for _ in range(n)] #木
cnt=[0]*n #出力用
for i in range(n-1): #辺の本数は頂点数-1
  a,b=map(int,input().split())
  a-=1
  b-=1
  edge[a].append(b)
  edge[b].append(a)
for _ in range(q):
  p,x=map(int,input().split())
  p-=1
  cnt[p]+=x
done=[False]*n #到達
par=0 #0からスタート
done[par]=True
stack=[par]
while stack:
  par=stack.pop()
  for chi in edge[par]:
    if done[chi]:
      None
    else:
      done[chi]=True
      cnt[chi]+=cnt[par]
      stack.append(chi)
    
print(*cnt)
### BUGGY CODE ###

N, P = map(int, raw_input().split())
if N == 1:
    print P
else:
    res = 1
    i = 2
    while i ** N <= P:
        if P % (i ** N) == 0:
            res = i
        i += 1
    print res


### FIXED CODE ###

N, P = map(int, raw_input().split())
max_N = 40
if N == 1:
    print P
elif N >= max_N:
    print 1
else:
    res = 1
    i = 2
    while i ** N <= P:
        if P % (i ** N) == 0:
            res = i
        i += 1
    print res
### BUGGY CODE ###

n,y=map(int,input().split())
l=[]
for i in range(n+1):
    for j in range(n-i+1):
        l.append([[i,j,n-i-j],10000*i+5000*j+1000*(n-i-j)])
c=0
for i in range(len(l)):
    if l[i][1]==y:
        print(l[i][0][0]," ",l[i][0][1]," ",l[i][0][2])
        c+=1
        break
if c==0:
    print(-1," ",-1," ",-1)

### FIXED CODE ###

n,y=map(int,input().split())
l=[]
c=0
for i in range(n+1):
    for j in range(n-i+1):
        if 10000*i+5000*j+1000*(n-i-j)==y:
            print(i," ",j," ",n-i-j)
            c+=1
            break
    if c!=0:
        break
if c==0:
    print(-1," ",-1," ",-1)
### BUGGY CODE ###

N = int(input())
Ai = [int(i) for i in input().split()]

leftSum = 0
rightSum = 0


for i in range(0,N):
    if(leftSum < rightSum):
        leftSum = leftSum + Ai.pop(0)
    else:
        rightSum = rightSum + Ai.pop(len(Ai)-1)
ans = abs(leftSum-rightSum)
print(ans)

### FIXED CODE ###

N = int(input())
Ai = [int(i) for i in input().split()]

leftSum = 0
rightSum = 0
K = N
L = 0

for i in range(0,N):
    if(leftSum < rightSum):
        leftSum = leftSum + Ai[L]
        L = L+1
    else:
        rightSum = rightSum + Ai[K-1]
        K = K-1
print(abs(leftSum-rightSum))
### BUGGY CODE ###

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

tmpList=QsList[:]
tmpList.sort()
tmp=0
AnsList=QsList[:]
for i in QsList:
  tmp=tmp+1  

  a=int(tmpList.index(i))
  AnsList[a]=tmp
print(*AnsList)

### FIXED CODE ###

n=int(input())
a = list(map(int,input().split()))
enumerate(a,1)
b=sorted(range(len(a)), key=lambda k: a[k])
for i in range(len(b)):
  print(b[i]+1)
### BUGGY CODE ###

import sys
def input():
	return sys.stdin.readline()[:-1]
n, p = map(int, input().split())
snacks = sorted([list(map(int, input().split())) for _ in range(n)], key=lambda x: x[0])
dp = [0 for _ in range(p)]
ans = snacks[0][1]

for i in range(1, n):
	x, y = snacks[i-1]
	z = snacks[i][1]
	for j in range(p-1, 0, -1):
		if j >= x:
			dp[j] = max(dp[j], dp[j-x]+y)
		ans = max(ans, dp[j]+z)

print(ans)

### FIXED CODE ###

import sys
def input():
	return sys.stdin.readline()[:-1]
n, p = map(int, input().split())
snacks = sorted([list(map(int, input().split())) for _ in range(n)], key=lambda x: x[0])
dp = [0 for _ in range(p)]
ans = snacks[0][1]

for i in range(1, n):
	x, y = snacks[i-1]
	z = snacks[i][1]
	for j in range(p-1, 0, -1):
		if j >= x:
			dp[j] = max(dp[j], dp[j-x]+y)
		ans = max(ans, dp[j]+z)

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

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

count = 0

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

ans = (b+1 - a - count)
print(ans)

### FIXED CODE ###

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

def gcd(x,y):
   if x % y == 0:
       return y
   return gcd(y, x % y)

CD = (c * d) // gcd(c,d)

h_b =b - (b // c) - (b // d) + (b // CD)
h_a = (a - 1) - (a - 1) // c - (a - 1) // d + (a - 1) // CD

print(h_b - h_a)