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.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.NoSuchElementException;

/*
                   _ooOoo_
                  o8888888o
                  88" . "88
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . __
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
            pass System Test!
*/

public class C {
  private static class Task {
    char twoCheck(String S) {
      int[] count = new int[26];
      for (int i = 0; i < S.length(); i++) {
        count[S.charAt(i) - 'A']++;
      }
      for (int i = 0; i < S.length(); i++) {
        if (count[i] == 2) return (char) (i + 'A');
      }
      return '?';
    }

    int intervalCount(String S, char C) {
      int start = -1;
      for (int i = 0; i < S.length(); i++) {
        if (S.charAt(i) == C) {
          if (start < 0) start = i;
          else return i - start - 1;
        }
      }
      return 0;
    }

    char[][] solve(String S) {
      char X = twoCheck(S);
      int L = intervalCount(S, X);
      int N = S.length();
      if (L == 0) return null;
      char[][] A = new char[2][13];
      for (char[] a : A) Arrays.fill(a, '?');

      if (L % 2 == 0) {
        L /= 2;

        A[0][13 - L - 1] = X;

        int i;
        for (i = 0; ; i++) {
          if (S.charAt(i) == X) break;
        }
        i++;
        int ci = 0;
        int cj = 13 - L;
        for (; cj < 13; i++, cj++) {
          A[ci][cj] = S.charAt(i);
        }
        ci = 1;
        cj = 12;
        for (; ; cj--, i++) {
          if (S.charAt(i) == X) break;
          A[ci][cj] = S.charAt(i);
        }
        i++;
        ci = 0;
        cj = 13 - L - 2;
        for (; cj >= 0; cj--, i++) {
          A[ci][cj] = S.charAt(i % S.length());
        }
        ci = 1;
        cj = 0;
        for (; ; cj++, i++) {
          if (S.charAt(i % S.length()) == X) break;
          A[ci][cj] = S.charAt(i % S.length());
        }
        return A;
      } else {
        L /= 2;

        A[0][13 - L - 1] = X;

        int i;
        for (i = 0; ; i++) {
          if (S.charAt(i) == X) break;
        }
        i++;
        int ci = 0;
        int cj = 13 - L;
        for (; cj < 13; i++, cj++) {
          A[ci][cj] = S.charAt(i);
        }
        ci = 1;
        cj = 12;
        for (; ; cj--, i++) {
          if (S.charAt(i) == X) break;
          A[ci][cj] = S.charAt(i);
        }
        i++;
        ci = 0;
        cj = 13 - L - 2;
        for (; cj >= 0; cj--, i++) {
          A[ci][cj] = S.charAt(i % S.length());
        }
        ci = 1;
        cj = 0;
        for (; ; cj++, i++) {
          if (S.charAt(i % S.length()) == X) break;
          A[ci][cj] = S.charAt(i % S.length());
        }
        return A;
      }
    }

    void solve(FastScanner in, PrintWriter out) throws Exception {
      String S = in.next();
      char[][] ans = solve(S);
      if (ans == null) {
        out.println("Impossible");
        return;
      }
      out.println(ans[0]);
      out.println(ans[1]);
    }
  }

  /**
   * ここから下はテンプレートです。
   */
  public static void main(String[] args) throws Exception {
    OutputStream outputStream = System.out;
    FastScanner in = new FastScanner();
    PrintWriter out = new PrintWriter(outputStream);
    Task solver = new Task();
    solver.solve(in, out);
    out.close();
  }
  private static class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int bufferLength = 0;

    private boolean hasNextByte() {
      if (ptr < bufferLength) {
        return true;
      } else {
        ptr = 0;
        try {
          bufferLength = in.read(buffer);
        } catch (IOException e) {
          e.printStackTrace();
        }
        if (bufferLength <= 0) {
          return false;
        }
      }
      return true;
    }

    private int readByte() {
      if (hasNextByte()) return buffer[ptr++];
      else return -1;
    }

    private static boolean isPrintableChar(int c) {
      return 33 <= c && c <= 126;
    }

    private void skipUnprintable() {
      while (hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;
    }

    boolean hasNext() {
      skipUnprintable();
      return hasNextByte();
    }

    public String next() {
      if (!hasNext()) throw new NoSuchElementException();
      StringBuilder sb = new StringBuilder();
      int b = readByte();
      while (isPrintableChar(b)) {
        sb.appendCodePoint(b);
        b = readByte();
      }
      return sb.toString();
    }

    long nextLong() {
      if (!hasNext()) throw new NoSuchElementException();
      long n = 0;
      boolean minus = false;
      int b = readByte();
      if (b == '-') {
        minus = true;
        b = readByte();
      }
      if (b < '0' || '9' < b) {
        throw new NumberFormatException();
      }
      while (true) {
        if ('0' <= b && b <= '9') {
          n *= 10;
          n += b - '0';
        } else if (b == -1 || !isPrintableChar(b)) {
          return minus ? -n : n;
        } else {
          throw new NumberFormatException();
        }
        b = readByte();
      }
    }

    double nextDouble() {
      return Double.parseDouble(next());
    }

    double[] nextDoubleArray(int n) {
      double[] array = new double[n];
      for (int i = 0; i < n; i++) {
        array[i] = nextDouble();
      }
      return array;
    }

    double[][] nextDoubleMap(int n, int m) {
      double[][] map = new double[n][];
      for (int i = 0; i < n; i++) {
        map[i] = nextDoubleArray(m);
      }
      return map;
    }

    public int nextInt() {
      return (int) nextLong();
    }

    public int[] nextIntArray(int n) {
      int[] array = new int[n];
      for (int i = 0; i < n; i++) array[i] = nextInt();
      return array;
    }

    public long[] nextLongArray(int n) {
      long[] array = new long[n];
      for (int i = 0; i < n; i++) array[i] = nextLong();
      return array;
    }

    public String[] nextStringArray(int n) {
      String[] array = new String[n];
      for (int i = 0; i < n; i++) array[i] = next();
      return array;
    }

    public char[][] nextCharMap(int n) {
      char[][] array = new char[n][];
      for (int i = 0; i < n; i++) array[i] = next().toCharArray();
      return array;
    }

    public int[][] nextIntMap(int n, int m) {
      int[][] map = new int[n][];
      for (int i = 0; i < n; i++) {
        map[i] = nextIntArray(m);
      }
      return map;
    }
  }
}