SP28464 TAP2016J - Joining lines

Description

\[Due to SPOJ restrictions, this problem has been modified with respect to the original version used in the Argentinian Programming Tournament of 2016 in order to have multiple test cases per input file. The original version of this problem (in Spanish) can be found at \] Two years ago we had a setback when Joaquín, a member of the jury, had an accident which prevented us from including the problem "Playing with lists" in that year's problemset for the Argentinian Programming Tournament. Thanks to the contest's participants, who kindly helped us solve that problem, we planned to include it in today's problemset. Unfortunately, we had a new inconvenience with Jacinto, another jury member.

Input Format

There are multiple test cases in the input file. For each test case, the first line contains three integer numbers **N**, **L** and **C**. The integer **N** represents the number of sample test cases, **L** represents the maximum number of lines fitting in a page, and **C** represents the maximum number of characters fitting in a line (**1 5000**). The second line contains **N** integer numbers **K $ _{1} $** , **K $ _{2} $** , ..., **K $ _{N} $** , representing the total number of characters in each sample test case (**1 **K $ _{i} $ **C** for **i = 1, 2, ..., N**).****

Output Format

For each test case, print a single line containing a character representing if it is possible to write all sample test cases in a single page as described in the problem statement. The printed character should be an **'S'** if this is possible, and an **'N'** otherwise.