While working on his project, Rishi ended up with an interesting problem as follows -
There is a string S which is broken down into N chunks (substrings) satisfying the below constraints:
1. For each chunk except the first, starting 4 characters will be overlapping with ending 4 characters of atleast one chunk.
2. For each chunk except the last, ending 4 characters will be overlapping with starting 4 characters of atleast one chunk.
Image for the reference:
Your task is to find original message from the given chunks. If multiple solutions exists, then print all of them in lexicographical order.
Note: Number of chunks and overlaps in each test case are generated in a way that it will always pass within given time constriants.
Input Format:
First line contains an integer N - the number of chunks
The next N line's contain a string each - representing a chunk
Output Format:
Print all the possible unique original messages in lexicographical order
Constraints:
1≤N≤5004≤len(chunk)≤100
Arrange the chunks in the sequence as follows: "opens", "pensource", "urcekaruya", and finally "ruyadsa". This arrangement ensures that overlapping characters in each chunk are used to form the original message "opensourcekaruyadsa".