Azad is first-year engineering student. one day his teacher caught him playing game on his phone during data structures lecture then teacher gave him a problem and ask him to come tomorrow with solution otherwise he will not allow him to attend the lecture and as Azad’s attendance is already below the required attendance, so he can not afford to miss upcoming lectures.
Azad is not good at programming so he is asking you to help him to solve a problem given below.
By using lower case character from a to z you have to form a string of length N (1 ≤ N≤ 100) using following instructions.
When N is even:
Use N/2 (when N ≤ 26) number of sequence characters or character from starting and ending part of a to z .
For example N= 2 az
N=4 abyz
When N is greater than 26 repeat the instructions again. For example N= 28 abcdefghijklmnopqrstuvwxyzaz
When N is odd:
Use (N-1)/2 (when N ≤ 26) number of sequence characters or character from starting and ending part of a to z and to select the middle character use case 1 and case 2.
Case 1- when sum of digits or digit of N is equal to even Give preference to those characters whose ASCII value is smaller to select the middle character of string.
for example N=11 ( 1+1= 2 is even)
abcdefvwxyz is correct
abcdeuvwxyz is incorrect
Case 2- when sum of digits or digit of N is equal to odd Give preference to those characters whose ASCII value is greater to select the middle character of string.
for example N=21 ( 2+1= 3 is odd)
abcdefghijpqrstuvwxyz is correct
abcdefghijkqrstuvwxyz is incorrect
When N is greater than 26 repeat the instructions again . For example N= 29 abcdefghijklmnopqrstuvwxyzayz
Input
• The first line of the input contains a single integer T denoting the number of test cases.
• The first line of each test case contains N denoting length of the string.
Output
For each test case, output the required string of length N in new line.
Constraints
1 ≤ T ≤ 100
1 ≤ N≤ 100
Example
Input:
6
2
4
11
21
28
29
Output:
az
abyz
abcdefvwxyz
abcdefghijpqrstuvwxyz
abcdefghijklmnopqrstuvwxyzaz
abcdefghijklmnopqrstuvwxyzayz
If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.
hardikJain5 | 258 |
CodeBuddy | 250 |
bhatabhi554 | 232 |
Akkki111 | 197 |
clone | 174 |
KshatriyaYash | 1932 |
nikhil_sojan | 1374 |
lonecoder | 1236 |
SumitSingh27 | 1127 |
mazumderrohit8 | 1124 |
blackshadows | 5327 |
Ibrahim Nash | 5219 |
akhayrutdinov | 5111 |
mb1973 | 4591 |
Quandray | 4444 |