12656 - Loliforce   

Description

Loliforce is currently the most popular online FPS game, and it is rumored that free lolis (a species of cat) will be given to the players who have reached the top 1% on the rank (namely, the “red” players).

Joy and Shepherd have both become red players recently, and they are now at Loliforce HQ to receive their prize. There is an array of N lolis available, and the i-th loli has height hi. The lolis are bio-engineered to have distinct heights.

Since they both like big lolis, they will take turn choosing the tallest loli not chosen, and K lolis on the left closest to it, and K lolis on the right closest to it (if on one side, there are less than K lolis, all of them will be chosen). If a loli is chosen on a turn, it is taken away from the array. The process continues until the array is empty.

Since Shepherd is the senpai, he will take the first turn; but the array is really big, he wants you to write a program to find out which lolis belongs to him in the end, to save him from the tedious process. Can you help Joy and Shepherd?

Input

Each input file contains only one testcase, which has two lines: two integers N K on the first line, and N integers h1,h2...hN on the second line.

1 <= K <= N <= 2*10^5

1 <= hi <= 10^9 for i = 1...N

for each pair of indexes (i, j), if i ≠ j, hi ≠ hj.

 

Output

For each testcase, output a single string S of length N, the i-th character of which should be ‘S’ if ith loli ends up going to Shepherd and ‘J’ if otherwise.

Sample Input  Download

Sample Output  Download

Tags




Discuss