2686. Matchsticks

单点时限: 2.0 sec

内存限制: 256 MB

Matchsticks are ideal tools to represent numbers. A common way to represent the ten decimal digits with matchsticks is the following:

This is identical to how numbers are displayed on an ordinary alarm clock. With a given number of matchsticks you can generate a wide range of numbers. We are wondering what the smallest and largest numbers are that can be created by using all your matchsticks.

输入格式

On the first line one positive number: the number of testcases, at most 100. After that per testcase:

One line with an integer n (2 ≤ n ≤ 100): the number of matchsticks you have.

输出格式

Per testcase:

One line with the smallest and largest numbers you can create, separated by a single space. Both numbers should be positive and contain no leading zeroes.

样例

Input
4
3
6
7
15
Output
7 7
6 111
8 711
108 7111111

25 人解决,34 人已尝试。

26 份提交通过,共有 93 份提交。

4.9 EMB 奖励。

创建: 14 年,6 月前.

修改: 6 年,7 月前.

最后提交: 9 月,3 周前.

来源: NWERC 2008

题目标签