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;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vll = vector<ll>;
using pill = pair<int, ll>;
using vvi = vector<vi>;
ll gcd(ll a, ll b) {
  ll t;
  while ((t = a % b) != 0) {
    a = b;
    b = t;
  }
  return b;
}
ll fast_exp(ll base, ll n, ll m) {
  if (n == 0) return 1;
  ll t = fast_exp(base, n / 2, m);
  if (n % 2 == 0)
    return (t * t) % m;
  else
    return (((t * t) % m) * base) % m;
}
bool is_set(int i, ll mask) { return (mask >> i) & 1; }
int count_bits(ll mask) {
  int ans = 0;
  for (int i = 0; i < 64; ++i)
    if (is_set(i, mask)) ++ans;
  return ans;
}
int first_bit(ll mask) {
  int i = 0;
  while (i < 64)
    if (is_set(i++, mask)) return i - 1;
  return -1;
}
int main() {
  ios::sync_with_stdio(false);
  string s;
  cin >> s;
  int pos[26][2];
  memset(pos, -1, sizeof pos);
  int dis = 0, p = -1;
  for (int i = 0; i < 27; ++i) {
    if (pos[s[i] - 'A'][0] == -1)
      pos[s[i] - 'A'][0] = i;
    else {
      dis = i - pos[s[i] - 'A'][0] - 1, p = pos[s[i] - 'A'][0];
      break;
    }
  }
  if (dis == 0) {
    cout << "Impossible\n";
    return 0;
  }
  char row[2][14];
  row[0][13] = row[1][13] = '\0';
  row[0][12 - dis / 2] = s[p];
  int p1 = p + 1, start = 12 - dis / 2, idx = start + 1;
  while (idx < 13) row[0][idx++] = s[p1++];
  idx--;
  while (idx > start) row[1][idx--] = s[p1++];
  if (dis & 1) row[1][idx] = s[p1++];
  idx--;
  p1 = (p1 + 1) % 27;
  while (idx >= 0) row[0][idx--] = s[p1], p1 = (p1 + 1) % 27;
  idx = 0;
  while (idx < start) row[1][idx++] = s[p1], p1 = (p1 + 1) % 27;
  if (dis % 2 == 0) row[1][idx] = s[p1];
  printf("%s\n%s\n", row[0], row[1]);
  return 0;
}