#626. String

String

当前没有测试数据。

题目描述

A string is perfect if it has the smallest lexicographical ordering among its cyclic rotations. For example: "0101" is perfect as it is the smallest string among ("0101", "1010", "0101", "1010").

Given a 01 string, you need to split it into the least parts and all parts are perfect.

输入格式

The first line of the input gives the number of test cases,  (T≤300)\ (T \leq 300) (T≤300). test cases follow.

For each test case, the only line contains one non-empty 01 string. The length of string is not exceed 200.

输出格式

For each test case, output one string separated by a space.

样例

样例输入 1

4
0
0001
0010
111011110

样例输出 1

0
0001
001 0
111 01111 0