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.util.*;
import java.io.*;
import java.math.*;

public class C{
	
	static int n,deg[],cdeg[]; static String s;
	static boolean mp[][];
	static char res[][];
	static ArrayList<Character> e[]=new ArrayList[256];
	static boolean isSet[][]=new boolean[256][256];
	static boolean isTaken[]=new boolean[256];
	static void MainMethod()throws Exception{
		s=reader.readNextLine(); n=s.length();
		mp=new boolean [256][256]; deg=new int[256];
		int i,j; Arrays.fill(deg,0);
		for (i=0;i<256;i++){
			Arrays.fill(mp[i],false);
			e[i]=new ArrayList<Character>();
			e[i].clear();
			Arrays.fill(isSet[i],false);

		}
		char c1,c2; 
		for (i=1;i<n;i++){
			c1=s.charAt(i-1); c2=s.charAt(i);
			if (c1==c2) failed();
			
			mp[c1][c2]=true; mp[c2][c1]=true;
		}
		
		cdeg=new int[256]; Arrays.fill(cdeg, 0);
		for (i=0;i<256;i++){
			deg[i]=0;
			for (j=0;j<256;j++) if (mp[i][j]==true){
				deg[i]++;
				e[i].add((char)j);
			}
			if (deg[i]>5) failed();
			cdeg[deg[i]]++;
			Collections.sort(e[i]);
		}
		if (cdeg[3]>4) failed();
		res=new char [2][26];
		Arrays.fill(isSet[0], false);
		Arrays.fill(isSet[1], false);
		Arrays.fill(isTaken, false);
		tryfill(0, 0);
		failed();
	}
	static boolean test(int r,int c){
		ArrayList<Character> p=new ArrayList<Character>();
		p.clear();
		int i,j,a,b; char x=res[r][c];
		for (i=-1;i<=1;i++)
			for (j=-1;j<=1;j++) {
				a=r+i; b=c+j;
				if (!((a==r)&&(b==c))){
					if ((0<=a&&a<=1)&&(0<=b&&b<13)){
						p.add(res[a][b]);
					}
				}
			}
		
		Collections.sort(p);
		j=-1;
		if (deg[x]>p.size()) return false;
		for (i=0;i<e[x].size();i++){
			char t=e[x].get(i);
			for (j=j+1;j<p.size();j++) if (t==p.get(j)) break;
			if (j>=p.size()) return false;
		}
		return true;
	}
	static void tryfill(int r,int c){
		isSet[r][c]=true;
		int a,b,i,j; char x;
		for (x='A';x<='Z';x++) if (isTaken[x]==false){
			isTaken[x]=true;
			res[r][c]=x;
			if (isSet[1-r][c]==true){
				if (c>0){
					if (test(0, c-1) && test(1, c-1)){
						if (c==12){
							if (test(0, c) && test(1, c)) printres();
						}else tryfill(0, c+1);
					}
				}else tryfill(0, c+1);
			}
			else 
				tryfill(1-r,c);
			isTaken[x]=false;
		}
		isSet[r][c]=false;

	}
	
	static void printres(){
		int i;
		for (i=0;i<13;i++)
			printer.print(res[0][i]);
		printer.println();
		for (i=0;i<13;i++)
			printer.print(res[1][i]);
		halt();
	}

	static void failed(){
		printer.print("Impossible");
		halt();
	}
	public static void main(String[] args)throws Exception{
		MainMethod();
		printer.close();
	}
	static void halt(){
		printer.close();
		System.exit(0);
	}
	static PrintWriter printer=new PrintWriter(new OutputStreamWriter(System.out));
	static class reader{
		static BufferedReader bReader=new BufferedReader(new InputStreamReader(System.in));
		static StringTokenizer token=new StringTokenizer("");
		static String readNextLine() throws Exception{
			return bReader.readLine();
		}
		static String next() throws Exception{
			while (token.hasMoreTokens()==false){
				token=new StringTokenizer(bReader.readLine());
			}
			return token.nextToken();
		}
		static int nextInt()throws Exception{
			while (token.hasMoreTokens()==false){
				token=new StringTokenizer(bReader.readLine());
			}
			return Integer.parseInt(token.nextToken());
		}
		static long nextLong()throws Exception{
			while (token.hasMoreTokens()==false){
				token=new StringTokenizer(bReader.readLine());
			}
			return Long.parseLong(token.nextToken());
		}
		static double nextDouble()throws Exception{
			while (token.hasMoreTokens()==false){
				token=new StringTokenizer(bReader.readLine());
			}
			return Double.parseDouble(token.nextToken());
		}
	}
	static class MyMathCompute{
		static long [][] MatrixMultiplyMatrix(long [][] A, long [][] B, long mod) throws Exception{
			int n=A.length, m=B[0].length; 
			int p=A[0].length;
			int i,j,k;
			if (B.length!=p) throw new Exception("invalid matrix input");
			long [][] res=new long [n][m];
			for (i=0;i<n;i++) for (j=0;j<m;j++){
				if (A[i].length!=p) throw new Exception("invalid matrix input");
				res[i][j]=0;
				for (k=0;k<p;k++)
					res[i][j]=(res[i][j]+((A[i][k]*B[k][j])% mod))% mod;
			}
			return res;
		}
		static double [][] MatrixMultiplyMatrix(double [][] A, double [][] B ) throws Exception{
			int n=A.length, m=B[0].length; 
			int p=A[0].length;
			int i,j,k;
			if (B.length!=p) throw new Exception("invalid matrix input");
			double [][] res=new double [n][m];
			for (i=0;i<n;i++) for (j=0;j<m;j++){
				if (A[i].length!=p) throw new Exception("invalid matrix input");
				res[i][j]=0;
				for (k=0;k<p;k++)
					res[i][j]=res[i][j]+(A[i][k]*B[k][j]);
			}
			return res;
		}
		static long [][] MatrixPow(long [][] A,long n, long mod) throws Exception{
			if (n==1) return A;
			long [][] res=MatrixPow(A, n/2, mod);
			res=MatrixMultiplyMatrix(res, res, mod);
			if ((n % 2) == 1) res=MatrixMultiplyMatrix(A,res, mod);		
			return res;
		}
		static double [][] MatrixPow(double [][] A,long n) throws Exception{
			if (n==1) return A;
			double[][] res=MatrixPow(A, n/2);
			res=MatrixMultiplyMatrix(res, res);
			if ((n % 2) == 1) res=MatrixMultiplyMatrix(A,res);		
			return res;
		}
		static long pow(long a,long n,long mod){
			a= a % mod;
			if (n==0) return 1;
			long k=pow(a,n/2,mod);
			if ((n % 2)==0) return ((k*k)%mod);
			else return (((k*k) % mod)*a) % mod;
		}
		static double pow(double a,long n){
			if (n==0) return 1;
			double k=pow(a,n/2);
			if ((n % 2)==0) return (k*k);
			else return (((k*k) )*a) ;
		}
	}
}