Dr. Astro Insky works at a radiotelescope centre. Recently she noticed a very curious microwave pulsing emission sent right from the centre of the galaxy. Is the emission transmitted by some extraterrestrial form of intelligent life? Or is it nothing but the usual heartbeat of the stars?
Help Dr. Insky uncover the truth by building a tool that analyses the bit patterns in the files she records. For each day's data file she wants to find the patterns whose length is between $A$ and $B$ (inclusive) that repeat most often. In each case, the greatest $N$ distinct frequencies (that is, numbers of occurrences) are sought. Pattern occurrences may overlap, and only patterns that occur at least once are taken into account.
0 and 1 characters, terminated by a single 2 character.Print a report of at most $N$ lines listing the at most $N$ greatest frequencies together with their patterns. Lines are given in decreasing order of frequency. Each line has the form frequency pattern pattern ... pattern, where frequency is the number of occurrences of every pattern that follows it. Within a line, patterns appear in decreasing order of length; patterns of equal length appear in decreasing (reverse) numerical order of their binary value. If there are fewer than $N$ distinct frequencies, the report has fewer than $N$ lines.