Group Shifted String

medium
1. You are given an array of strings.
2. You have to group the given strings in such a way that all strings in a group are shifted versions of each other. 
3. Two strings s1 and s2 are shifted if -
   -> Length of both the strings is the same.
   -> The difference between ASCII values of every character of s1 and s2 is constant.

Note -> Every string consists of lower-case English letters only.

Input Format

A number N str1 str2.. N space-separated strings

Output Format

Every line of output contains space-separated strings which represents a group of shifted strings.

Constraints

1 <= N <= 10^4
1 <= length of a string <= 100

Example

Input
9
acd dfg wyz yab mop bdfh a x moqs
Output
acd dfg mop wyz yab 
a x 
bdfh moqs 
Previous
Find Anagram Mappings
Next
Count Of Subarrays With Sum Divisible By K

Related Questions