Queue Sorting#2510

Queue Sorting

1 second
122.174 megabytes
Very easy

A queue is a data structure that operates on the "first in, first out" (FIFO) principle: elements can only be added to the end and removed from the front. This means that elements are removed in the same order as they are added.

Sorting is the task of arranging a given array of numbers (or other objects) in either ascending or descending order. There are many variants of this task, and there exist efficient algorithms for many of them.

In this problem, we consider a special device consisting of an input stream, an output stream, and queues, numbered from to .

Your task is: given a sequence of distinct numbers arriving in the input stream, write a program for this device that outputs these numbers in ascending order via the output stream.

The program must consist of exactly operations. Each operation either reads a number from the input stream and adds it to one of the queues, or removes a number from one of the queues and sends it to the output stream. Note that no removal operations may be performed until all insertion operations have been completed.

Input

The first line contains an integer (1 \leq n \leq 300).

The second line contains distinct integers a_1, a_2, \ldots, a_n in the order they arrive from the input stream (1 \leq a_i \leq 10^9 for all from to ).

The third line contains an integer (1 \leq k \leq n).

Output

If sorting is impossible, output NO.

Otherwise, output YES and then lines describing the sorting program. Each line must describe a single operation, in one of the following formats:

  • I(j): Read an element from the input stream and add it to queue number (1 \leq j \leq k).

  • R(j): Remove an element from queue number (1 \leq j \leq k) and output it to the output stream.

Examples

Example 1

Loading
Loading

Example 2

Loading
Loading