Tianjin University Online Judge
Contests Virtual Contests Problems Submit Runs Status Rank List Forum

2855.   New Cow Brands
Time Limit: 2.0 Seconds   Memory Limit: 65536K
Total Runs: 238   Accepted Runs: 112    Multiple test files

The cows are beside themselves: Farmer John has decided to use RFID tags instead of branding the cows with red-hot irons that cause intense pain.

The RFID tags contain a code that is N (3 ≤ N ≤ 15) characters (each in the range 'A'..'Z') in length. No character appears twice in the code. The character chosen for any given position in the code is chosen from a supplied set for that position. The set is always given in alphabetical order.

A machine generates the codes in alphabetical order. Each new batch of cows uses the next unused set of codes. FJ keeps track of the number of codes he has already used.

Help FJ confirm the RFID brands to be used for the next set of cows. Given the count of the starting and finishing brands (1 ≤ start < finish ≤ 22,000,000 and finish - start < 2000), print (in alphabetical order) the brands that will be used. See the I/O specifications for an example.


* Line 1: Three space-separated integers, respectively: N, start, and finish.

* Lines 2..N + 1: Line i+1 contains a number (1..26) of characters that are the valid characters for position i in the RFID code


* Lines 1..finish-start+1: Line i contains RFID code # start + i - 1

Sample Input

4 6 13

Sample Output


Input Details

Four positions in the RFID code; print the 6th through 13th codes.

Output Details

Here are the first 20 codes:

 1 ACFB    5 ADFC    9 AEFB   13 ALCB   17 ALHC
 2 ACHB    6 ADHB   10 AEFC   14 ALFB   18 AQCB
 3 ADCB    7 ADHC   11 AEHB   15 ALFC   19 AQFB
 4 ADFB    8 AECB   12 AEHC   16 ALHB   20 AQFC

Source: USACO 2006 November Competition
Submit   List    Runs   Forum   Statistics

Tianjin University Online Judge v1.3.0
Maintance:Fxz. Developer: SuperHacker, G.D.Retop, Fxz