Problem: Let’s define a grid to be a set of tiles with 2 rows and 13 columns. Each tile has an English letter written in it. The letters don't have to be unique: there might be two or more tiles with the same letter written on them. Here is an example of a grid:
    
    
    ABCDEFGHIJKLM  
    NOPQRSTUVWXYZ

We say that two tiles are adjacent if they share a side or a corner. In the example grid above, the tile with the letter 'A' is adjacent only to the tiles with letters 'B', 'N', and 'O'. A tile is not adjacent to itself.

A sequence of tiles is called a path if each tile in the sequence is adjacent to the tile which follows it (except for the last tile in the sequence, which of course has no successor). In this example, "ABC" is a path, and so is "KXWIHIJK". "MAB" is not a path because 'M' is not adjacent to 'A'. A single tile can be used more than once by a path (though the tile cannot occupy two consecutive places in the path because no tile is adjacent to itself).

You’re given a string s which consists of 27 upper-case English letters. Each English letter occurs at least once in s. Find a grid that contains a path whose tiles, viewed in the order that the path visits them, form the string s. If there’s no solution, print "Impossible" (without the quotes).

Input

The only line of the input contains the string s, consisting of 27 upper-case English letters. Each English letter occurs at least once in s.

Output

Output two lines, each consisting of 13 upper-case English characters, representing the rows of the grid. If there are multiple solutions, print any of them. If there is no solution print "Impossible".

Examples

Input

ABCDEFGHIJKLMNOPQRSGTUVWXYZ


Output

YXWVUTGHIJKLM
ZABCDEFSRQPON


Input

BUVTYZFQSNRIWOXXGJLKACPEMDH


Output

Impossible

Solution (in JAVA):

Solution:
import java.io.*;
import java.math.BigInteger;
import java.util.*;



public class B
{
    String line;
    StringTokenizer inputParser;
    BufferedReader is;
    FileInputStream fstream;
    DataInputStream in;
    String FInput="";
    
    void openInput(String file)
    {

            if(file==null)is = new BufferedReader(new InputStreamReader(System.in));//stdin
            else
            {
                    try{
            
                            
                    fstream = new FileInputStream(file);
                    in = new DataInputStream(fstream);
                    is = new BufferedReader(new InputStreamReader(in));
                    }catch(Exception e)
                    {
                            System.err.println(e);
                    }
            }

    }
    
    void readNextLine()
	{
		try {
			line = is.readLine();
			inputParser = new StringTokenizer(line, " ,\t");
			//System.err.println("Input: " + line);
		} catch (IOException e) {
			System.err.println("Unexpected IO ERROR: " + e);
		}	
		catch (NullPointerException e)
		{
			line=null;
			
		}
		
	}
    
    long NextLong()
    {
            String n = inputParser.nextToken();
            
            long val = Long.parseLong(n);
            
             return val;
    }
    
    int NextInt()
    {
            String n = inputParser.nextToken();
            int val = Integer.parseInt(n);
            
            //System.out.println("I read this number: " + val);
            return val;
    }
    
    double NextDouble()
    {
            String n = inputParser.nextToken();
            double val = Double.parseDouble(n);
            
            //System.out.println("I read this number: " + val);
            return val;
    }
    
    String NextString()
    {
            String n = inputParser.nextToken();
            return n;
    }
    
    void closeInput()
    {
            try {
                    is.close();
            } catch (IOException e) {
                    System.err.println("Unexpected IO ERROR: " + e);
            }
                    
    }
    
    public static void main(String [] argv)
    {
            //String filePath="circles.in";
            String filePath=null;
            if(argv.length>0)filePath=argv[0];
            new B(filePath);
            
    }
    
    public B(String inputFile)
    {
    	openInput(inputFile);
		//readNextLine();
		int T=1;//NextInt();
		StringBuilder sb = new StringBuilder();
		for(int t=1; t<=T; t++)
		{
			readNextLine();
			int N=27;
			
			char d='?';
			
			Set <Character> seen = new HashSet<Character>();
			
			for(int i=0; i<N; i++)
			{
				if(seen.contains(line.charAt(i)))
				{
					d=line.charAt(i);
					break;
				}
				seen.add(line.charAt(i));
			}
			int f = line.indexOf(d);
			int s = line.indexOf(d, f+1);
			if(Math.abs(f-s)==1){
				System.out.println("Impossible");
				return;
			}
			String one=line.substring(0, f+1);
			String two = line.substring(f+1, s);
			String twoA = two.substring(0,two.length()/2);
			String twoB = two.substring(twoA.length());
			String three = line.substring(s+1);
			
			
			
			while(one.length()+twoA.length()<twoB.length()+three.length())
			{
				char move = three.charAt(three.length()-1);
				three = three.substring(0, three.length()-1);
				one = move+one;
			}
			
			while(one.length()+twoA.length()>twoB.length()+three.length())
			{
				char move = one.charAt(0);
				one = one.substring(1);
				three = three+move;
			}
			
			
			sb.append(one);
			sb.append(twoA+"\n");
			sb.append(rev(three));
			sb.append(rev(twoB)+"\n");
			
		}
		System.out.print(sb);
		
		closeInput();		
	}

	private String rev(String s) {
		return new StringBuilder(s).reverse().toString();
	}

}