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>
#pragma warning(disable : 4996)
using namespace std;
const double PI = 3.1415926535897932384626433832795;
void fft(vector<complex<double> >& a, bool side) {
  int n = a.size();
  if (n == 1) return;
  vector<complex<double> > a0, a1;
  for (int i = 0; i < n; i++) {
    if (i % 2 == 0)
      a0.push_back(a[i]);
    else
      a1.push_back(a[i]);
  }
  fft(a0, side);
  fft(a1, side);
  double ang = 2 * PI / n * (side ? 1 : -1);
  complex<double> w(1), wn(cos(ang), sin(ang));
  for (int i = 0; i < n / 2; i++) {
    a[i] = a0[i] + a1[i] * w;
    a[i + n / 2] = a0[i] - a1[i] * w;
    if (!side) {
      a[i] /= 2;
      a[i + n / 2] /= 2;
    }
    w *= wn;
  }
}
void multiply(vector<int>& a, vector<int>& b, vector<int>& rez) {
  vector<complex<double> > fa(a.begin(), a.end()), fb(b.begin(), b.end());
  int n = 1;
  while (n < max(a.size(), b.size())) n <<= 1;
  n <<= 1;
  fa.resize(n);
  fb.resize(n);
  fft(fa, true);
  fft(fb, true);
  for (int i = 0; i < n; i++) {
    fa[i] *= fb[i];
  }
  fft(fa, false);
  rez.resize(n);
  for (int i = 0; i < n; i++) {
    rez[i] = fa[i].real() > 0 ? (int)(fa[i].real() + 0.5)
                              : (int)(fa[i].real() - 0.5);
  }
}
int modm = 1;
int mn(string& s, int fi, int se) {
  int y = 0;
  for (int i = fi; i <= se; i++) {
    y = y * 10 + s[i] - '0';
  }
  return y;
}
void fn(string& s, vector<int>& n) {
  int m = (s[0] == '-' ? 1 : 0);
  for (int i = s.size() - 1; i >= m; i -= modm)
    n.push_back(mn(s, max(i - (modm - 1), m), i));
}
int ns(int a) {
  if (a == 0) return 1;
  int k = 0;
  while (a > 0) {
    a /= 10;
    k++;
  }
  return k;
}
void umn(string& a, string& b, vector<int>& rez) {
  vector<int> a1, b1;
  fn(a, a1);
  fn(b, b1);
  multiply(a1, b1, rez);
  for (int i = 0; i < rez.size() - 1; i++) {
    rez[i + 1] += rez[i] / 10;
    rez[i] %= 10;
  }
  while (rez[rez.size() - 1] > 10) {
    int a = rez[rez.size() - 1] / 10;
    rez[rez.size() - 1] %= 10;
    rez.push_back(a);
  }
  while (rez.size() > 1 && rez[rez.size() - 1] == 0) rez.pop_back();
}
int main() {
  string s;
  cin >> s;
  for (int i = 0; i < s.size() - 1; i++) {
    if (s[i] == s[i + 1]) {
      cout << "Impossible";
      return 0;
    }
  }
  vector<vector<int> > al(26, vector<int>());
  for (int i = 0; i < 27; i++) {
    al[s[i] - 'A'].push_back(i);
  }
  int k = 0;
  int l = 0;
  int l1 = 0;
  for (int i = 0; i < 26; i++) {
    if (al[i].size() == 2) {
      k = abs(al[i][0] - al[i][1]) - 1;
      l = al[i][0];
      l1 = i;
    }
  }
  char a[13][2];
  int y = k / 2;
  for (int i = 0; i < y; i++) {
    a[i][0] = s[l + y - i];
  }
  a[y][0] = s[l];
  for (int i = 0; i < k - y; i++) {
    a[i][1] = s[l + y + i + 1];
  }
  int o = 1;
  int uuu = k - y;
  while (uuu < 13 && al[l1][1] + o < s.size()) {
    a[uuu][1] = s[al[l1][1] + o];
    uuu++;
    o++;
  }
  if (al[l1][1] + o < s.size()) {
    a[12][0] = s[al[l1][1] + o];
  }
  o++;
  int oo = 1;
  while (al[l1][1] + o < s.size()) {
    a[12 - oo][0] = s[al[l1][1] + o];
    o++;
    oo++;
  }
  int op = 0;
  for (int i = 0; i < 13; i++) {
    if (a[i][0] == s[l]) op = i;
  }
  int uy = 1;
  while (op + 1 < 13 && l - uy >= 0) {
    a[op + 1][0] = s[l - uy];
    uy++;
    op++;
  }
  if (l - uy >= 0) {
    a[12][1] = s[l - uy];
    uy++;
  }
  int poo = 1;
  while (l - uy >= 0) {
    a[12 - poo][1] = s[l - uy];
    poo++;
    uy++;
  }
  for (int i = 0; i < 13; i++) cout << a[i][0];
  cout << endl;
  for (int i = 0; i < 13; i++) cout << a[i][1];
  return 0;
}