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.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
import java.lang.*;


public class C{
	static long mod=1000000007;
	
    public static void main(String[] args) throws Exception{           	
    	 InputReader in = new InputReader(System.in);       
    	PrintWriter pw=new PrintWriter(System.out);   
    	
    	
    	//int t=in.readInt();
        //while(t-->0)
        //{
    	
        //int n=in.readInt();
    	//long n=in.readLong();
    	/*int a[]=new int[n];
    	for(int i=0;i<n;i++)
    	{
    		a[i]=in.readInt();
    	}*/
    	int f=1;
    	String a=in.readString();
    	int n=27;
    	char g[]=new char[13]; //up
    	char h[]=new char[13];
    	int f1[]=new int[13];
    	int f2[]=new int[13];
    	for(int i=0;i<13;i++)
    	{
    		f1[i]=26-i*2;
    		f2[i]=25-i*2;
    	}
    	Arrays.fill(g, '1');
    	Arrays.fill(h, '1');
    	char c[]=a.toCharArray();
    	for(int i=1;i<n;i++)
    	{
    		if(c[i]==c[i-1])
    		{
    			f=0;
    			break;
    		}
    	}
    	
    	if(f==0)
    	{
    		pw.println("Impossible");	
    	}
    	else
    	{
    		HashMap<Character,Integer>hm=new HashMap<Character,Integer>();
    		int p1=0,p2=0;
    		char e='1';
    		for(int i=0;i<n;i++)
    		{
    			char ch=c[i];
    			if(hm.containsKey(ch))
    			{
    				int y=hm.get(ch);
    				p1=y;
    				p2=i;
    				e=ch;
    			}
    			else
    			{
    				hm.put(ch, i);
    			}
    		}
    		int diff=p2-p1;
    		int up=0;
    		int s=0;
    		for(int i=0;i<13;i++)
    		{
    			if(f1[i]==diff)
    			{
    				s=i;
    				up=1;
    				break;
    			}
    			if(f2[i]==diff)
    			{
    				s=i;
    				break;
    			}
    		}
    		//System.out.println(diff);
    		if(up==1)
    		{
    			g[s]=e;
    			h[s]=c[p2-1];
    			//System.out.println(h[s]);
    			int i=p1+1;
    			int j=s+1;
    			int k=12;
    			for(;i<=p2-2&&j<13;i++,j++)
    			{
    				g[j]=c[i];
    			}
    			
    			for(;i<=p2-2&&k>s;i++,k--)
    			{
    				h[k]=c[i];
    			}
    			
    			i=p2+1;
    			j=0;
    			k=s-1;
    			for(;i<n&&k>=0;i++,k--)
    			{
    				h[k]=c[i];
    			}
    			for(;i<n&&j<s;i++,j++)
    			{
    				g[j]=c[i];
    			}
    			if(k<0)
    			{
    				for(i=0;i<p1;i++,j++)
    					g[j]=c[i];
    			}
    			else
    			{
    				//System.out.println(diff);
    				for(i=0;i<p1;i++)
    				{
    					g[j]=c[i];
    					if(h[j]=='1')
    					{
    						i++;
    						h[j]=c[i];
    					}
    					j++;
    				}
    			}
    			for(i=0;i<13;i++)
    				pw.print(g[i]+"");
    			pw.println();
    			for(i=0;i<13;i++)
    				pw.print(h[i]+"");
    		}
    		else
    		{
    			
    			h[s]=e;
    			int i=p1+1;
    			//g[s]=c[i];
    			//i++;
    			int j=s+1;
    			int k=12;
    			for(;i<=p2-1&&j<13;i++,j++)
    			{
    				h[j]=c[i];
    			}
    			
    			for(;i<=p2-1&&k>s;i++,k--)
    			{
    				g[k]=c[i];
    			}
    			
    			i=p2+1;
    			j=0;
    			k=s-1;
    			for(;i<n&&k>=0;i++,k--)
    			{
    				h[k]=c[i];
    			}
    			for(;i<n&&j<=s;i++,j++)
    			{
    				g[j]=c[i];
    			}
    			if(k<0)
    			{
    				for(i=0;i<p1;i++,j++)
    					g[j]=c[i];
    			}
    			else
    			{
    				for(i=0;i<p1;i++)
    				{
    					g[j]=c[i];
    					if(h[j]=='1')
    					{
    						i++;
    						h[j]=c[i];
    					}
    					j++;
    				}
    			}
    			for(i=0;i<13;i++)
    				pw.print(g[i]+"");
    			pw.println();
    			for(i=0;i<13;i++)
    				pw.print(h[i]+"");
    		}
    	}
		//pw.println("");	     	
    	
    	//}
    	
    	pw.close();
    }
    

	
public static long gcd(long x,long y)
{
	if(x%y==0)
		return y;
	else
		return gcd(y,x%y);
}
public static int gcd(int x,int y)
{
	if(x%y==0)
		return y;
	else 
		return gcd(y,x%y);
}
public static int abs(int a,int b)
{
	return (int)Math.abs(a-b);
}
public static long abs(long a,long b)
{
	return (long)Math.abs(a-b);
}
public static int max(int a,int b)
{
	if(a>b)
		return a;
	else
		return b;
}
public static int min(int a,int b)
{
	if(a>b)
		return b;
	else 
		return a;
}
public static long max(long a,long b)
{
	if(a>b)
		return a;
	else
		return b;
}
public static long min(long a,long b)
{
	if(a>b)
		return b;
	else 
		return a;
}


public static long pow(long n,long p,long m)
{
	 long  result = 1;
	  if(p==0)
	    return 1;
	if (p==1)
	    return n;
	while(p!=0)
	{
	    if(p%2==1)
	        result *= n;
	    if(result>=m)
	    result%=m;
	    p >>=1;
	    n*=n;
	    if(n>=m)
	    n%=m;
	}
	return result;
}
public static long pow(long n,long p)
{
	long  result = 1;
	  if(p==0)
	    return 1;
	if (p==1)
	    return n;
	while(p!=0)
	{
	    if(p%2==1)
	        result *= n;	    
	    p >>=1;
	    n*=n;	    
	}
	return result;

}
static class Pair implements Comparable<Pair>
{
	int a,b;
	Pair (int a,int b)
	{
		this.a=a;
		this.b=b;
	}

	public int compareTo(Pair o) {
		// TODO Auto-generated method stub
		if(this.a!=o.a)
		return Integer.compare(this.a,o.a);
		else
			return Integer.compare(this.b, o.b);
		//return 0;
	}
	public boolean equals(Object o) {
        if (o instanceof Pair) {
            Pair p = (Pair)o;
            return p.a == a && p.b == b;
        }
        return false;
    }
    public int hashCode() {
        return new Integer(a).hashCode() * 31 + new Integer(b).hashCode();
    }
    
} 
    
static long sort(int a[])
{  int n=a.length;
	int b[]=new int[n];	
	return mergeSort(a,b,0,n-1);}
static long mergeSort(int a[],int b[],long left,long right)
{ long c=0;if(left<right)
 {   long mid=left+(right-left)/2;
	 c= mergeSort(a,b,left,mid);
	 c+=mergeSort(a,b,mid+1,right);
	 c+=merge(a,b,left,mid+1,right); }	
	return c;	 }
static long merge(int a[],int  b[],long left,long mid,long right)
{long c=0;int i=(int)left;int j=(int)mid; int k=(int)left;
while(i<=(int)mid-1&&j<=(int)right)
{ if(a[i]<=a[j]) {b[k++]=a[i++]; }
else	{ b[k++]=a[j++];c+=mid-i;}}
while (i <= (int)mid - 1)   b[k++] = a[i++]; 
while (j <= (int)right) b[k++] = a[j++];
for (i=(int)left; i <= (int)right; i++) 
	a[i] = b[i];  return c;  }
    
public static int[] radixSort(int[] f)
{
	int[] to = new int[f.length];
	{
		int[] b = new int[65537];
		for(int i = 0;i < f.length;i++)b[1+(f[i]&0xffff)]++;
		for(int i = 1;i <= 65536;i++)b[i]+=b[i-1];
		for(int i = 0;i < f.length;i++)to[b[f[i]&0xffff]++] = f[i];
		int[] d = f; f = to;to = d;
	}
	{
		int[] b = new int[65537];
		for(int i = 0;i < f.length;i++)b[1+(f[i]>>>16)]++;
		for(int i = 1;i <= 65536;i++)b[i]+=b[i-1];
		for(int i = 0;i < f.length;i++)to[b[f[i]>>>16]++] = f[i];
		int[] d = f; f = to;to = d;
	}
	return f;
}    
static  class InputReader
{
    private InputStream stream;
    private byte[] buf = new byte[1024];
    private int curChar;
    private int numChars;
    private SpaceCharFilter filter;

    public InputReader(InputStream stream)
    {
        this.stream = stream;
    }

    public int read()
    {
        if (numChars == -1)
            throw new InputMismatchException();
        if (curChar >= numChars)
        {
            curChar = 0;
            try
            {
                numChars = stream.read(buf);
            } catch (IOException e)
            {
                throw new InputMismatchException();
            }
            if (numChars <= 0)
                return -1;
        }
        return buf[curChar++];
    }

    public int readInt()
    {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        int sgn = 1;
        if (c == '-')
        {
            sgn = -1;
            c = read();
        }
        int res = 0;
        do
        {
            if (c < '0' || c > '9')
                throw new InputMismatchException();
            res *= 10;
            res += c - '0';
            c = read();
        } while (!isSpaceChar(c));
        return res * sgn;
    }

    public String readString()
    {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        StringBuilder res = new StringBuilder();
        do
        {
            res.appendCodePoint(c);
            c = read();
        } while (!isSpaceChar(c));
        return res.toString();
    }
    public String readLine() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        StringBuilder res = new StringBuilder();
        do {
            res.appendCodePoint(c);
            c = read();
        } while (!isEndOfLine(c));
        return res.toString();
    }
    

    public double readDouble() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        int sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = read();
        }
        double res = 0;
        while (!isSpaceChar(c) && c != '.') {
            if (c == 'e' || c == 'E')
                return res * Math.pow(10, readInt());
            if (c < '0' || c > '9')
                throw new InputMismatchException();
            res *= 10;
            res += c - '0';
            c = read();
        }
        if (c == '.') {
            c = read();
            double m = 1;
            while (!isSpaceChar(c)) {
                if (c == 'e' || c == 'E')
                    return res * Math.pow(10, readInt());
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                m /= 10;
                res += (c - '0') * m;
                c = read();
            }
        }
        return res * sgn;
    }
    public long readLong() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        int sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = read();
        }
        long res = 0;
        do {
            if (c < '0' || c > '9')
                throw new InputMismatchException();
            res *= 10;
            res += c - '0';
            c = read();
        } while (!isSpaceChar(c));
        return res * sgn;
    }
    public boolean isSpaceChar(int c)
    {
        if (filter != null)
            return filter.isSpaceChar(c);
        return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
    }

    public String next()
    {
        return readString();
    }

    public interface SpaceCharFilter
    {
        public boolean isSpaceChar(int ch);
    }
    public boolean isEndOfLine(int c) {
        return c == '\n' || c == '\r' || c == -1;
    }
}

  
//BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
	//StringBuilder sb=new StringBuilder("");
	 //InputReader in = new InputReader(System.in);
	//PrintWriter pw=new PrintWriter(System.out);
	//String line=br.readLine().trim();
	       	
	//int t=Integer.parseInt(br.readLine());
  //	while(t-->0)
  	//{
  	//int n=Integer.parseInt(br.readLine());
	//long n=Long.parseLong(br.readLine());
	//String l[]=br.readLine().split(" ");
  //int m=Integer.parseInt(l[0]);
	//int k=Integer.parseInt(l[1]);
	//String l[]=br.readLine().split(" ");
	//l=br.readLine().split(" ");
	/*int a[]=new int[n];
	for(int i=0;i<n;i++)
	{
		a[i]=Integer.parseInt(l[i]);
	}*/
	   //System.out.println(" ");	     	
	
	//}
}