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.*;


public class q4{
	static int mod=(int)(1e9+7);
	public static void main(String[] ags)
	{
		InputReader in=new InputReader(System.in);
		PrintWriter pw=new PrintWriter(System.out);
		//int n=in.nextInt();
		//int[] a=readint(in,n);
		int[][] a=new int[2][14];
		for(int i=1;i<=13;i++)
		{
			if(13-i>0)
			{
			a[0][i]=(2*(13-i))+1;
			a[1][i]=a[0][i]+1;
			}
			if(i==13)
			{
				a[0][i]=2;
			}
		}
		HashSet<Integer> hs=new HashSet<Integer>();
		for(int i=1;i<=13;i++)
		{
			//System.out.println(a[0][i]+" "+a[1][i]);
			hs.add(a[0][i]);
			hs.add(a[1][i]);
		}
		/*for(int m:hs)
		{
			char[] v=new char[27];
			boolean aa=false;
			Arrays.fill(v, '.');
			for(int i=5;i<=26;i++)
			{
				if(i+m<27)
				{
				v[i]='Z';
				v[i+m]='Z';
				aa=true;
				break;
				}
			}
			if(!aa)
			{
				for(int i=4;i>=0;i--)
				{
					if(i+m<26)
					{
						v[i]='Z';
						v[i+m]='Z';
						break;
					}
				}
			}
			System.out.println(new String(v));
			char cm='A';
			for(int i=0;i<27;i++){
			if(v[i]=='.')
			{
				v[i]=cm;
				cm++;
			}
			}*/
			
		
		String s=in.readString();
		//System.out.println(s);
		boolean ans=true;
		int gap=0;
		int start=0;
		int notconsider=0;
		for(int i=0;i<s.length();i++)
		{
			for(int j=i+1;j<s.length();j++)
			{
				if(s.charAt(i)==s.charAt(j))
				{
					if(!hs.contains(j-i))
					{
						ans=false;
					}
					else
					{
						gap=j-i;
					}
					start=i;
					notconsider=j;
					break;
				}
			}
		}
		//System.out.println("gap"+gap);
		if(ans)
		{
		char[][] grid=new char[2][13];
		Arrays.fill(grid[0], '.');
		Arrays.fill(grid[1], '.');
		int ss=0;
		for(int i=1;i<=13;i++)
		{
			if(gap==a[0][i] || gap==a[1][i])
			{
				ss=(i-1);
			}
		}
		boolean upper=true;
		for(int i=start;i<s.length();i++)
		{
			if(i!=(notconsider))
			{
				if(ss==13 && upper)
				{
					upper=false;
					ss--;
				}
				if(ss==-1 && !upper)
				{
					ss=0;
					upper=true;
				}
				//System.out.println("for i "+i+" "+ss );
				if(upper)
				{
					grid[0][ss]=s.charAt(i);
				}
				else
				{
					grid[1][ss]=s.charAt(i);
				}
				if(upper)
				{
					ss++;
				}
				else
				{
					ss--;
				}
				
			
			}
			
			
		}

		int cc=0;
		for(int i=0;i<start;i++)
		{
			while(grid[0][cc]!='.' && grid[1][cc]!='.')
			{
				cc++;
			}
			if(grid[0][cc]=='.')
			{
				grid[0][cc]=s.charAt(i);
			}
			else
			{
				grid[1][cc]=s.charAt(i);
			}
		}
		pw.println(new String(grid[0]));
		pw.println(new String(grid[1]));
		}
		else
		{
			pw.println("Impossible");
		}
		
		//}

		
		pw.close();
	}
	public static int[] readint(InputReader in,int n)
	{
		int[] a=new int[n];
		for(int i=0;i<n;i++)
		{
			a[i]=in.nextInt();
		}
		return a;
	}
	public static long[] readlong(InputReader in,int n)
	{
		long[] a=new long[n];
		for(int i=0;i<n;i++)
		{
			a[i]=in.nextLong();
		}
		return a;
	}
	public static void addhm(HashMap<Integer,Integer> hm,int k)
	{
		int cc=0;
		if(hm.containsKey(k))
		{
			cc=hm.get(k);
		}
		hm.put(k, cc+1);
	}
	public static void removehm(HashMap<Integer,Integer> hm,int k)
	{
		int cc=hm.get(k);
		if(cc==1)
		{
			hm.remove(k);
		}
		else
		{
			hm.put(k,cc-1);
		}
	}
	
	static class InputReader {

		private InputStream stream;
		private byte[] buf = new byte[8192];
		private int curChar;
		private int snumChars;
		private SpaceCharFilter filter;

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

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

		public int nextInt() {
			int c = snext();
			while (isSpaceChar(c))
				c = snext();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = snext();
			}

			int res = 0;

			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = snext();
			} while (!isSpaceChar(c));

			return res * sgn;
		}
		
		public long nextLong() {
			int c = snext();
			while (isSpaceChar(c))
				c = snext();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = snext();
			}

			long res = 0;

			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = snext();
			} while (!isSpaceChar(c));

			return res * sgn;
		}
		
		public String readString() {
			int c = snext();
			while (isSpaceChar(c))
				c = snext();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = snext();
			} while (!isSpaceChar(c));
			return res.toString();
		}

		public boolean isSpaceChar(int c) {
			if (filter != null)
				return filter.isSpaceChar(c);
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		public interface SpaceCharFilter {
			public boolean isSpaceChar(int ch);
		}
	}

}