In this challenge, we introduce the concept of assorted and diversed strings.
A string is called assorted if no two distinct letters in appear the same number of times. For example, aacbcc is assorted, but aabaccab is not assorted, since b and c each appears exactly times.
A string is called diverse if it is assorted and all its prefixes and suffixes are assorted. For example, aabaa is diverse, but aaba is not diverse, since the suffix ba is not assorted.
Given and , find the lexicographically smallest diverse string of length with exactly distinct letters. Your output string can only contain lowercase English letters. If no such string exists, output NONE.
The first line of input contains , the number of queries.
Each query consists of a single line containing two space-separated integers and .
For each case, output a single line containing the required diverse string, or the string NONE if no such string exists.