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 CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
template <typename T>
T BigMod(T b, T p, T m) {
  if (p == 0) return 1;
  if (p % 2 == 0) {
    T s = BigMod(b, p / 2, m);
    return ((s % m) * (s % m)) % m;
  }
  return ((b % m) * (BigMod(b, p - 1, m) % m)) % m;
}
template <typename T>
T ModInv(T b, T m) {
  return BigMod(b, m - 2, m);
}
template <typename T>
T POW(T B, T P) {
  if (P == 0) return 1;
  if (P & 1)
    return B * POW(B, P - 1);
  else
    return (POW(B, P / 2) * POW(B, P / 2));
}
template <typename T>
T Dis(T x1, T y1, T x2, T y2) {
  return sqrt((x1 - x2 * x1 - x2) + (y1 - y2 * y1 - y2));
}
template <typename T>
T Angle(T x1, T y1, T x2, T y2) {
  return atan(double(y1 - y2) / double(x1 - x2));
}
template <typename T>
T DIFF(T a, T b) {
  T d = a - b;
  if (d < 0)
    return -d;
  else
    return d;
}
template <typename T>
T ABS(T a) {
  if (a < 0)
    return -a;
  else
    return a;
}
template <typename T>
T gcd(T a, T b) {
  if (a < 0) return gcd(-a, b);
  if (b < 0) return gcd(a, -b);
  return (b == 0) ? a : gcd(b, a % b);
}
template <typename T>
T lcm(T a, T b) {
  if (a < 0) return lcm(-a, b);
  if (b < 0) return lcm(a, -b);
  return a * (b / gcd(a, b));
}
template <typename T>
T euclide(T a, T b, T &x, T &y) {
  if (a < 0) {
    T d = euclide(-a, b, x, y);
    x = -x;
    return d;
  }
  if (b < 0) {
    T d = euclide(a, -b, x, y);
    y = -y;
    return d;
  }
  if (b == 0) {
    x = 1;
    y = 0;
    return a;
  } else {
    T d = euclide(b, a % b, x, y);
    T t = x;
    x = y;
    y = t - (a / b) * y;
    return d;
  }
}
template <typename T>
long long isLeft(T a, T b, T c) {
  return (a.x - b.x) * (b.y - c.y) - (b.x - c.x) * (a.y - b.y);
}
int Set(int N, int pos) { return N = N | (1 << pos); }
int Reset(int N, int pos) { return N = N & ~(1 << pos); }
bool Check(int N, int pos) { return (bool)(N & (1 << pos)); }
template <class T, class X>
inline T togglebit(T a, X i) {
  T t = 1;
  return (a ^ (t << i));
}
double DEG(double x) { return (180.0 * x) / (acos(-1)); }
double RAD(double x) { return (x * (double)acos(-1)) / (180.0); }
char s[30];
vector<int> v[100];
char ans[3][14];
int main() {
  int i, j, k, p, sum, t, n, x, y, n1, n2, m;
  scanf("%s", &s);
  for (i = 0; i <= 26; i++) v[s[i]].push_back(i);
  char ch, str;
  int p1, p2;
  for (ch = 'A'; ch <= 'Z'; ch++) {
    if (v[ch].size() > 1) {
      p1 = v[ch][0];
      p2 = v[ch][1];
      str = ch;
      break;
    }
  }
  if ((p2 - p1) == 1) {
    cout << "impossible" << endl;
    return 0;
  }
  int lft = p1;
  int md = p2 - p1 - 1;
  int ryt = 27 - p2 - 1;
  bool fl = 0;
  for (i = 1; i <= 13; i++) {
    int lo = (13 - i) * 2;
    int hi = lo + 2;
    if (lo == 0) lo++;
    if ((md >= lo && md <= hi)) {
      for (j = 1; j <= 2; j++)
        for (k = 1; k <= 13; k++) ans[j][k] = '*';
      int cr = 1;
      int cl = i;
      ans[cr][cl] = str;
      bool fl = 0;
      int lj, lk;
      for (j = cr, k = cl + 1, p = p1 + 1; p < p2; p++) {
        if (k > 13) {
          j++;
          k--;
          fl = 1;
        }
        lj = j;
        lk = k;
        ans[j][k] = s[p];
        if (fl)
          k--;
        else
          k++;
      }
      fl = 0;
      for (j = lj, k = lk - 1, p = p2 + 1; p < 27; p++) {
        if (k < 1) {
          j--;
          k++;
          fl = 1;
        }
        ans[j][k] = s[p];
        if (fl)
          k++;
        else
          k--;
      }
      fl = 0;
      int r1, c1;
      for (j = cr, k = cl - 1, p = p1 - 1; p > -1; p--) {
        if (k < 1) {
          k++;
          j++;
          fl = 1;
        }
        ans[j][k] = s[p];
        if (fl)
          k++;
        else
          k--;
      }
      for (j = 1; j <= 2; j++) {
        for (k = 1; k <= 13; k++) cout << ans[j][k];
        cout << endl;
      }
      break;
    }
  }
  return 0;
}