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

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


def main():
    n, m = map(int, input().split())

    nexts = [[] for i in range(n)]
    
    for _ in range(m):
        ai, bi = map(int, input().split())
        ai -= 1
        bi -= 1
        nexts[ai].append(bi)
        nexts[bi].append(ai)

    blues = [-1] * n # 1 is in blues
    blues[0] = 0 # 0 is not in blues
    checked = [0] * n

    red_deque = deque([0])

    while -1 in blues:
        rd = red_deque[0]
        red_deque.popleft()
        if checked[rd] == 0:
            checked[rd] = 1
            for nxt in nexts[rd]:
                if blues[nxt] == -1:
                    blues[nxt] = rd
                    red_deque.append(nxt)

    print("Yes")
    for blue in blues[1:]:
        print(blue + 1)
    

if __name__ == "__main__":
    main()

### FIXED CODE ###

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


def main():
    n, m = map(int, input().split())

    nexts = [[] for i in range(n)]
    
    for _ in range(m):
        ai, bi = map(int, input().split())
        ai -= 1
        bi -= 1
        nexts[ai].append(bi)
        nexts[bi].append(ai)

    blues = [-1] * n # 1 is in blues
    blues[0] = 0 # 0 is not in blues
    checked = [0] * n

    red_deque = deque([0])

    while len(red_deque) > 0:
        rd = red_deque[0]
        red_deque.popleft()
        if checked[rd] == 0:
            checked[rd] = 1
            for nxt in nexts[rd]:
                if blues[nxt] == -1:
                    blues[nxt] = rd
                    red_deque.append(nxt)

    print("Yes")
    for blue in blues[1:]:
        print(blue + 1)
    

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

a, b, c = map(int, input().split())
i = 0
while a%2==0 or b%2==0 or c%2==0 or i<10**2:
    at = a//2
    bt = b//2
    ct = c//2
    a = bt + ct
    b = at + ct
    c = at + bt
    i+=1
if i > 10**2:
    print(-1)
else:
    print(i)

### FIXED CODE ###

a, b, c = map(int, input().split())
i = 0
f = True
while a%2==0 and b%2==0 and c%2==0:
    at = a//2
    bt = b//2
    ct = c//2
    a = bt + ct
    b = at + ct
    c = at + bt
    i+=1
    if a == b == c:
        print(-1)
        f = False
        break
if f:
    print(i)
### BUGGY CODE ###

a,b,n=map(int,input().split())
ans=0
for x in range(0,min(b,n+1)):
  ans=max(ans, int(a*x*1.0/b)-a*int(x*1.0/b))
print(ans)     

### FIXED CODE ###

a,b,n=map(int,input().split())
print(int(a*min(b-1,n)/b))
### BUGGY CODE ###

import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
from collections import defaultdict, deque
def resolve():
    N, M, S = lr()
    uvab = [[] for i in range(N)]
    amax = 0
    for i in range(M):
        u, v, a, b = lr()
        uvab[u-1].append([v-1, a, b])
        uvab[v-1].append([u-1, a, b])
        amax = max(amax, a)
    cd = []
    for i in range(N):
        cd.append(lr())
    dp = defaultdict(lambda: float('inf'))
    A = amax*(N-1)
    dp[0, min(S, A)] = 0
    s = deque([[0, min(S, A)]])
    while len(s) > 0:
        tu, i = s.popleft()
        for vab in uvab[tu]:
            v, a, b = vab
            if i >= a and i < A and dp[v, i-a] >= dp[tu, i] + b:
                dp[v, i-a] = dp[tu, i] + b
                s.append([v, i-a])
            elif i == A and dp[v, i] >= dp[tu, i] + b:
                dp[v, i] = dp[tu, i] + b
                s.append([v, i])
        c, d = cd[tu]
        t = i
        while t < A:
            nt = min(t+c, A)
            if dp[tu, nt] > dp[tu, t] + d:
                dp[tu, nt] = dp[tu, t] + d
                s.append([tu, nt])
            t = nt
    for i in range(1, N):
        ans = float('inf')
        for j in range(A+1):
            ans = min(dp[i, j], ans)
        print(ans)
resolve()

### FIXED CODE ###

import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
from collections import defaultdict
from heapq import heappop, heappush
def resolve():
    N, M, S = lr()
    uvab = [[] for i in range(N)]
    amax = 0
    for i in range(M):
        u, v, a, b = lr()
        uvab[u-1].append([v-1, a, b])
        uvab[v-1].append([u-1, a, b])
        amax = max(amax, a)
    cd = []
    for i in range(N):
        cd.append(lr())
    dp = defaultdict(lambda: float('inf'))
    A = amax*(N-1)
    dp[0, min(S, A)] = 0
    s = [[0, 0, min(S, A)]]
    while len(s) > 0:
        x, u, i  = heappop(s)
        if dp[u, i] != x:
            continue
        c, d = cd[u]
        ni = min(i+c, A)
        if dp[u, ni] > dp[u, i]+d:
            dp[u, ni] = dp[u, i]+d
            heappush(s, [dp[u, ni], u, ni])
        for vab in uvab[u]:
            v, a, b = vab
            if i >= a and i < A and dp[v, i-a] > dp[u, i] + b:
                dp[v, i-a] = dp[u, i] + b
                heappush(s, [dp[v, i-a], v, i-a])
            elif i == A and dp[v, i] > dp[u, i] + b:
                dp[v, i] = dp[u, i] + b
                heappush(s, [dp[v, i], v, i])
    for i in range(1, N):
        ans = float('inf')
        for j in range(A+1):
            ans = min(dp[i, j], ans)
        print(ans)
resolve()
### BUGGY CODE ###

N = int(input())
A = list(map(int, input().split()))
c = [A.count(i + 1) for i in range(N)]
ans = [c[i] * (c[i] - 1) // 2 for i in range(N)]

for val in A:
  m = c[val - 1] - 1
  print(sum(ans) - m)

### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
c = [0 for i in range(N)]

for i in range(N):
  c[A[i] - 1] += 1

ans = [c[i] * (c[i] - 1) // 2 for i in range(N)]
s = sum(ans)

for val in A:
  m = c[val - 1] - 1
  print(s - m)
### BUGGY CODE ###

import math
import collections
mod = 1000000007
N,M = list(map(int,input().strip().split()))

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

def P(n, r):
  return math.factorial(n)//math.factorial(n-r)

def C(n, r):
  return P(n, r)//math.factorial(r)


l = list(collections.Counter(prime_decomposition(M)).values())


ans = 1
for i in l:
  ans *= C(N+i-1,i)
  
print(ans%mod)


### FIXED CODE ###

import math
mod = 1000000007
N,M = list(map(int,input().strip().split()))
l = []

def P(n, r):
  return math.factorial(n)//math.factorial(n-r)

def C(n, r):
  return P(n, r)//math.factorial(r)

ans = 1
cnt = 0
while  M%2 == 0:
  M //= 2
  cnt += 1
l.append(cnt)
cnt = 0

i = 3
while i**2 <= M:
  cnt = 0
  while M%i == 0:
    M //= i
    cnt += 1
  if cnt != 0:
    l.append(cnt)
    cnt = 0
  i += 2
if M != 1:
    l.append(1)

for i in l:
  for j in range(i):
    ans = ans*(N+j)//(j+1)

print(ans%mod)
### BUGGY CODE ###

H, W = map(int, input().split())
INF = H * W
A = [list(input()) for x in range(H)]
dist = [[INF] * W for x in range(H)]
used = [[False] * W for x in range(H)]

q = []
for i in range(H):
    for j in range(W):
        if A[i][j] == '#':
            q.append([i, j])
            used[i][j] = True

max_dist = 0
counter = 0
while counter != len(q):
    item = q[counter]

    if A[item[0]][item[1]] == '#':
        dist[item[0]][item[1]] = 0
    else:
        dist[item[0]][item[1]] = min(
            dist[item[0] - 1][item[1]] if item[0] > 0 else INF,
            dist[item[0]][item[1]-1] if item[1] > 0 else INF,
            dist[item[0] + 1][item[1]] if item[0] < H - 1 else INF,
            dist[item[0]][item[1]+1] if item[1] < W - 1 else INF
        ) + 1
        if max_dist < dist[item[0]][item[1]]: max_dist = dist[item[0]][item[1]] 


    if item[0] > 0 and not used[item[0]-1][item[1]]:
        q.append([item[0] - 1, item[1]])
        used[item[0] - 1][item[1]] = True
    if item[1] > 0 and not used[item[0]][item[1] - 1]:
        q.append([item[0], item[1] - 1])
        used[item[0]][item[1] - 1] = True
    if item[0] < H - 1 and not used[item[0] + 1][item[1]]:
        q.append([item[0] + 1, item[1]])
        used[item[0] + 1][item[1]] = True
    if item[1] < W - 1 and not used[item[0]][item[1] + 1]:
        q.append([item[0], item[1] + 1])
        used[item[0]][item[1] + 1] = True
    counter += 1

print(max_dist)

### FIXED CODE ###

H, W = map(int, input().split())
INF = H * W
A = [input() for x in range(H)]
used = [[False] * W for x in range(H)]

q = []
for i in range(H):
    for j in range(W):
        if A[i][j] == '#':
            q.append([i, j])
            used[i][j] = True

max_dist = 0
counter = 0
depth = -1
while counter != INF:
    # print(q)
    # print(counter)
    for i in range(len(q) - counter):
        item = q[counter]

        if item[0] > 0 and not used[item[0]-1][item[1]]:
            q.append([item[0] - 1, item[1]])
            used[item[0] - 1][item[1]] = True
        if item[1] > 0 and not used[item[0]][item[1] - 1]:
            q.append([item[0], item[1] - 1])
            used[item[0]][item[1] - 1] = True
        if item[0] < H - 1 and not used[item[0] + 1][item[1]]:
            q.append([item[0] + 1, item[1]])
            used[item[0] + 1][item[1]] = True
        if item[1] < W - 1 and not used[item[0]][item[1] + 1]:
            q.append([item[0], item[1] + 1])
            used[item[0]][item[1] + 1] = True
        counter += 1
    depth += 1

print(depth)
### BUGGY CODE ###

n=int(input())
ans=1
li = input().split()
for i in li:
  ans*=int(i)
  if ans>1000000000000000000:
    ans*=-1

if ans<0:
  ans=-1
print(ans)


### FIXED CODE ###

n=int(input())
ans=1
zero=False
minus=False
li = input().split()
for i in li:
  a=int(i)
  if a==0:
    zero=True
    break
  if minus:
    continue
  ans*=a
  if ans>1000000000000000000:
    minus=True

if minus:
  ans=-1
if zero:
  ans=0
print(ans)
### BUGGY CODE ###

import sys
sys.setrecursionlimit(700000)

def s_in():
    return input()

def n_in():
    return int(input())

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

def print_l(l):
    print(' '.join(map(str, l)))

class Interval():
    def __init__(self, li):
        self.li = li
        self.n = len(li)
        self.sum_li = [li[0]]
        for i in range(1, self.n):
            self.sum_li.append(self.sum_li[i-1] + li[i])

    def sum(self, a, b=None):
        if b is None:
            return self.sum(0, a)

        res = self.sum_li[min(self.n-1, b-1)]
        if a > 0:
            res -= self.sum_li[a-1]
        return res

n = n_in()
xy = [l_in() for _ in range(n)]

left = 0
right = 2000

from itertools import product
def check(r):
    return all((x1-x2)**2 + (y1-y2)**2 <= 4*r*r for (x1,y1),(x2,y2) in product(xy, repeat=2))

while right-left > 10**-16:
    mid = (left+right)/2
    if check(mid):
        right = mid
    else:
        left = mid

print((left+right)/2)
    


### FIXED CODE ###

import sys
sys.setrecursionlimit(700000)

def s_in():
    return input()

def n_in():
    return int(input())

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

def print_l(l):
    print(' '.join(map(str, l)))

class Interval():
    def __init__(self, li):
        self.li = li
        self.n = len(li)
        self.sum_li = [li[0]]
        for i in range(1, self.n):
            self.sum_li.append(self.sum_li[i-1] + li[i])

    def sum(self, a, b=None):
        if b is None:
            return self.sum(0, a)

        res = self.sum_li[min(self.n-1, b-1)]
        if a > 0:
            res -= self.sum_li[a-1]
        return res

n = n_in()
xy = [l_in() for _ in range(n)]

left = 0
right = 2000

from itertools import combinations
import math
def check(r):
    allprox = True
    for (x1,y1),(x2,y2) in combinations(xy, 2):
        dx = x1-x2
        dy = y1-y2

        d2 = dx*dx+dy*dy

        if d2 < 10**-16:
            continue

        allprox = False
        
        if d2/4 > r*r:
            continue

        h = math.sqrt(r*r-d2/4)
        d = math.sqrt(d2)

    
        px,py= (x1+x2)/2, (y1+y2)/2

        qx,qy = px-dy/d*h, py+dx/d*h
        if all((qx-x3)*(qx-x3) + (qy-y3)*(qy-y3) <= r*r for x3,y3 in xy if (x1 != x3 or y1 != y3) and (x2 != x3 or y2 != y3)):
            return True
        
        qx,qy = px+dy/d*h, py-dx/d*h
        if all((qx-x3)*(qx-x3) + (qy-y3)*(qy-y3) <= r*r for x3,y3 in xy if (x1 != x3 or y1 != y3) and (x2 != x3 or y2 != y3)):
            return True
    else:
        return allprox

while right-left > 10**-10:
    mid = (left+right)/2
    if check(mid):
        right = mid
    else:
        left = mid

print((left+right)/2)
### BUGGY CODE ###

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

D={}
for i in A:
      if i not in D:
            D[i]=1
      else:
            D[i]+=1


for i in range(n):
      D[A[i]]-=1
      ans=0
      for j in D.values():
            ans+=j*(j-1)//2
      print(ans)
      D[A[i]]+=1
      

### FIXED CODE ###

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

D={}
for i in A:
      if i not in D:
            D[i]=1
      else:
            D[i]+=1
S=0
DD=D.copy()
for i in DD:
      bu=DD[i]
      DD[i]=bu*(bu-1)//2
      S+=DD[i]

for i in range(n):
      print(S-(D[A[i]]-1))
### BUGGY CODE ###

N,K=map(int,input().split())
P=list(map(int,input().split()))
L=[]
def E(n):
  e=0
  for i in range(1,n+1):
    e+=i
  e = e/n
  return e

k=0
for i in range(N-K+1):
  l=sum(P[i:i+K])
  if l>k:
    k=l
    L=P[i:i+K]

A=0
for i in range(K):
  A+=E(L[i])
print(A)

### FIXED CODE ###

N,K=map(int,input().split())
P=list(map(int,input().split()))


l=sum(P[0:K])
k=l
for i in range(N-K):
  l = l-P[i]+P[i+K]
  if l>k:
    k=l

print((k+K)/2)
### BUGGY CODE ###

import copy
N,K = map(int,input().split())
A = list(map(int,input().split()))
ans = 10**9*15
for i in range(2**(N-1)):#2番~N番からK-1個選ぶ
    B = copy.copy(A)
    count = 0
    bit = 0
    for j in range(N-1):#A[1]~A[N-1]の内、選ばれるものの数
        bit = bit + (1&(i>>j))
    if(bit == K-1):#K-1個選ぶ
        for k in range(N-1):
            if(i>>k&1):
                while max(B[0:k+1]) >= B[k+1]:#シフト量+2番のビルが1番:B[0]~シフト量+1番:B[k]のビルより高く
                    B[k+1] += 1#シフト量+2番目のビルを伸ばす
                    count += 1#コストをプラス
        ans = min(ans,count)
print(ans)
                
          

### FIXED CODE ###


import copy
N,K = map(int,input().split())
A = list(map(int,input().split()))
ans = 10**9*15
for i in range(2**(N-1)):#2番~N番からK-1個選ぶ
    B = copy.copy(A)
    count = 0
    bit = 0
    for j in range(N-1):#A[1]~A[N-1]の内、選ばれるものの数
        bit = bit + (1&(i>>j))
    if(bit == K-1):#K-1個選ぶ
        for k in range(N-1):
            if(i>>k&1):
                if max(B[0:k+1]) >= B[k+1]:#シフト量+2番のビルが1番:B[0]~シフト量+1番:B[k]のビルより高く
                    dif =max(B[0:k+1])-B[k+1]+1
                    B[k+1] += dif#シフト量+2番目のビルを伸ばす
                    count += dif#コストをプラス
        ans = min(ans,count)
print(ans)
### BUGGY CODE ###

N=int(input())
L=list(map(int,input().split()))
L.sort(reverse=True)
ans=0
for n in range(N-2):
  for k in range(n+1,N-1):
    if L[n]<L[k]*2:
      for l in range(k+1,N):
        if L[n]<L[k]+L[l]:
          ans+=1
        else:
          break
print(ans)

### FIXED CODE ###

import bisect
N=int(input())
L=list(map(int,input().split()))
L.sort()
ans=0
for n in range(1,N):
  b=L[n]
  for k in range(n):
    a=L[k]
    index=bisect.bisect_left(L,a+b)
    ans+=(index-n-1)
print(ans)
### BUGGY CODE ###

# 解説参照
n,k = map(int,input().split())
A = list(map(int,input().split()))

for j in range(min(k,41)):
  B = [0]*(n)
  for i in range(n):
    l = max(0,i-A[i])
    r = min(n-1,i+A[i])
    B[l] += 1
    if r+1 < n:
      B[r+1] -= 1  
      
  for i in range(1,n):
    B[i]+=B[i-1]
  
  A = B.copy()
print(*B)  

### FIXED CODE ###

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

for j in range(min(k,45)):
  B = [0]*(n)
  for i in range(n):
    l = max(0,i-A[i])
    r = min(n-1,i+A[i])
    B[l] += 1
    if r+1 < n:
      B[r+1] -= 1  
      
  for i in range(1,n):
    B[i]+=B[i-1]
  
  A = B.copy()
print(*B)
### BUGGY CODE ###

H, W = map(int, input().split())
S = []
for i in range(H):
  ss = input()
  S.append(ss)
L = [[-1]*W for i in range(H)]
R = [[-1]*W for i in range(H)]
U = [[-1]*W for i in range(H)]
D = [[-1]*W for i in range(H)]
for i in range(H):
  n = -1
  for j in range(W):
    if S[i][j] == "#":
      n = j
    L[i][j] = j-n
  n = W
  for j in reversed(range(W)):
    if S[i][j] == "#":
      n = j
    R[i][j] = n-j
for j in range(W):
  n = -1
  for i in range(H):
    if S[i][j] == "#":
      n = i
    U[i][j] = i-n
  n = H
  for i in reversed(range(H)):
    if S[i][j] == "#":
      n = i
    D[i][j] = n-i
#for i in range(H):
#  print(D[i])
rs = []
for i in range(H):
  for j in range(W):
    if S[i][j] == ".":
      r = L[i][j]+R[i][j]+U[i][j]+D[i][j]-3
      rs.append(r)
r = max(rs)
print(r)


### FIXED CODE ###

H, W = map(int, input().split())
S = []
for i in range(H):
  ss = input()
  S.append(ss)
L = [[-1]*W for i in range(H)]
R = [[-1]*W for i in range(H)]
U = [[-1]*W for i in range(H)]
D = [[-1]*W for i in range(H)]
for i in range(H):
  n = -1
  for j in range(W):
    if S[i][j] == "#":
      n = j
    L[i][j] = j-n
  n = W
  for j in reversed(range(W)):
    if S[i][j] == "#":
      n = j
    R[i][j] = n-j
for j in range(W):
  n = -1
  for i in range(H):
    if S[i][j] == "#":
      n = i
    U[i][j] = i-n
  n = H
  for i in reversed(range(H)):
    if S[i][j] == "#":
      n = i
    D[i][j] = n-i
#for i in range(H):
#  print(D[i])
r = 0
for i in range(H):
  for j in range(W):
    if S[i][j] == ".":
      r = max(r, L[i][j]+R[i][j]+U[i][j]+D[i][j]-3)
print(r)
### BUGGY CODE ###

import numpy as np


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

max = 0
for i in range(N-K+1):
    tmp = np.sum(p[i:i+K])
    if tmp>max:
        max = tmp

print((max+K)/2)


### FIXED CODE ###

import numpy as np

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

tmp = np.sum(p[:K])
max = tmp
for i in range(N-K):
    tmp = tmp-p[i]+p[i+K]
    if tmp>max:
        max = tmp

print((max+K)/2)
### BUGGY CODE ###

#!/usr/bin/env python3

N = int(input())
P = list(map(int, input().split()))
# print(N, P)

count = 0
for i in range(N):
    flag = True
    for j in range(i):
        if P[i] > P[j]:
            flag = False
    if flag:
        count += 1

print(count)


### FIXED CODE ###

#!/usr/bin/env python3

N = int(input())
P = list(map(int, input().split()))
# print(N, P)

count = 0
min_prev = P[0] + 1
for i in range(N):
    if P[i] < min_prev:
        min_prev = P[i]
        count += 1

print(count)
### BUGGY CODE ###

a, b = list(map(int, input().split(' ')))
def gcd(l, s):
  return l if s == 0 else gcd(s, l % s)

temp = gcd(a, b)

primes = [2]
def is_prime(p):
  for i in range(len(primes)):
    if p % primes[i] == 0:
      return False
    if primes[i] * primes[i] >= p:
      break
  return True

for p in range(3, 1000009, 2):
  if is_prime(p):
    primes.append(p)
ans = 0
for p in primes:
  if temp % p == 0:
    ans += 1
print(ans+1)

### FIXED CODE ###

a, b = list(map(int, input().split(' ')))
def gcd(l, s):
  return l if s == 0 else gcd(s, l % s)

temp = gcd(a, b)

ans = 0
for i in range(2,1000000):
  if temp % i == 0:
    ans += 1
    while temp % i == 0:
      temp = temp // i
  if temp == 1:
    break
if temp != 1:
  ans += 1

print(ans+1)
### BUGGY CODE ###

INF = 10**10 - 1 #無限大
SMAX = 3000 + 10

# 文字列入力
s1 = input()
s2 = input()

'''
dpの初期化
s1の文字列位置を一次軸、一致文字列長を二次軸に取り
その値として：s2の使用済文字数の最小値を入れる
　　　　　　　0列は 0 それ以外がINFで初期化
'''
dp = [[INF] * (SMAX) for i in range(SMAX)]
for i in range(0,len(s1)+1):
    dp[i][0] = 0
#print(dp[0])

for s1pos in range(1,len(s1)+1):
    s = s1[s1pos-1:s1pos]
    #print("s=",s,"--------")
    for psLen in range(1,s1pos+1):
        s2pos = dp[s1pos-1][psLen-1] + 1
        spos = s2[s2pos-1:].find(s)
        dp[s1pos][psLen] = dp[s1pos-1][psLen]
        if spos == -1:
            pass
        else:
            if dp[s1pos][psLen] > s2pos+spos:
                dp[s1pos][psLen] = s2pos+spos
        #print("s=",s,"ps2=",s2[s2pos-1:],"spos=",spos,"s1pos=",s1pos,"s2pos=",s2pos,"dp=",dp[s1pos])
res = ""
s1pos = len(s1)
s2pos = len(s2)
while (s1pos > 0 and s2pos > 0):
    while dp[s1pos][s2pos] == INF:
        s2pos -= 1
    # (s1pos-1, s2pos) -> (s1pos, s2pos) と更新されていた場合
    if (dp[s1pos][s2pos] == dp[s1pos-1][s2pos]):
        s1pos -= 1 # DP の遷移を遡る
    # (s1pos-1, s2pos-1) -> (s1pos, s2pos) と更新されていた場合
    else:
        res = s1[s1pos-1:s1pos] + res # 該当文字を取得
        s1pos -= 1 # DP の遷移を遡る
        s2pos -= 1 # DP の遷移を遡る

print(res)


### FIXED CODE ###

INF = 10**10 - 1 #無限大
SMAX = 3000 + 10

# 文字列入力
s1 = input()
s2 = input()

'''
dpの初期化
s1の文字列位置を一次軸、s2の文字列位置を二次軸に取り
その値として：LCSの最長値として更新していく
　　　　　　　初期値はすべて０
'''
dp = [ [0] * (SMAX) for i in range(SMAX)]

for s1pos in range(1,len(s1)+1):
    s1s = s1[s1pos-1:s1pos]
    for s2pos in range(1,len(s2)+1):
        s2s = s2[s2pos-1:s2pos]
        if s1s == s2s:
            dp[s1pos][s2pos] = dp[s1pos-1][s2pos-1] + 1
        dp[s1pos][s2pos] = max(dp[s1pos][s2pos],dp[s1pos][s2pos-1],dp[s1pos-1][s2pos])
    #print("s1pos=",s1pos,"dp=",dp[s1pos])

#print("LCS_len",dp[len(s1)][len(s2)])

res = ""
s1pos = len(s1)
s2pos = len(s2)
while (s1pos > 0 and s2pos > 0):
    # (s1pos-1, s2pos) -> (s1pos, s2pos) と更新されていた場合
    if (dp[s1pos][s2pos] == dp[s1pos-1][s2pos]):
        s1pos -= 1 # DP の遷移を遡る
    # (s1pos, s2pos-1) -> (s1pos, s2pos) と更新されていた場合
    elif (dp[s1pos][s2pos] == dp[s1pos][s2pos-1]):
        s2pos -= 1 # DP の遷移を遡る
    # (s1pos-1, s2pos-1) -> (s1pos, s2pos) と更新されていた場合
    else:
        res = s1[s1pos-1:s1pos] + res # 該当文字を取得
        s1pos -= 1 # DP の遷移を遡る
        s2pos -= 1 # DP の遷移を遡る

print(res)
### BUGGY CODE ###

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

scored_list=[]
score=A[k-1]
for i in range(k-1):
    score*=A[k-i-2]
scored_list.append(score)
for i in range(n-k):
    score/=A[i]
    score*=A[k+i]
    scored_list.append(score)
for i in range(len(scored_list)-1):
    if scored_list[i]<scored_list[i+1]:
        print("Yes")
    else:
        print("No")

### FIXED CODE ###

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

for i in range(n-k):
    if A[i]<A[k+i]:
        print("Yes")
    else:
        print("No")