402868: GYM100923 L Por Costel and the Semipalindromes

Memory Limit:64 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

L. Por Costel and the Semipalindromestime limit per test1 secondmemory limit per test64 megabytesinputsemipal.inoutputsemipal.out

Por Costel the pig, our programmer in-training, has recently returned from the Petrozaporksk training camp. There, he learned a lot of things: how to boil a cob, how to scratch his belly using his keyboard, etc... He almost remembers a programming problem too:

A semipalindrome is a word for which there exists a subword such that is a prefix of and (reverse ) is a suffix of . For example, 'ababba' is a semipalindrom because the subword 'ab' is prefix of 'ababba' and 'ba' is suffix of 'ababba'.

Let's consider only semipalindromes that contain letters 'a' and 'b'. You have to find the -th lexicographical semipalindrome of length .

Por Costel doesn't remember if the statement was exactly like this at Petrozaporksk, but he finds this problem interesting enough and needs your help to solve it.

Input

On the first line of the file semipal.in, there is an integer () representing the number of test cases. On the next lines there are 2 numbers, ( and K where is the number of semipalindromes of length .

Output

In the output file semipal.out, there should be lines, the -th of which should contain the answer for the -th test.

ExampleInput
2
5 1
5 14
Output
aaaaa
bbabb

加入题单

上一题 下一题 算法标签: