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;
long long gcd(long long a, long long b) {
  if (a < b) {
    swap(a, b);
  }
  while (b) {
    long long r = a % b;
    a = b;
    b = r;
  }
  return a;
}
int lcm(int a, int b) { return (a * b) / gcd(a, b); }
int isPrim(int a) {
  if (a == 1) {
    return 0;
  }
  for (int i = 2; i <= (a + 1) / 2; i++) {
    if (a % i == 0) {
      return 0;
    }
  }
  return 1;
}
long long mod_pow(long long x, long long n, long long mod) {
  long long ret = 1;
  while (n > 0) {
    if (n % 2 == 1) {
      ret = (ret * x) % mod;
    }
    x = (x * x) % mod;
    n = n / 2;
  }
  return ret;
}
struct XX {
  int u;
  int v;
  int t;
};
class xxIntu {
 public:
  bool operator()(const XX& riLeft, const XX& riRight) const {
    if ((riLeft.u) == (riRight.u)) {
      return riLeft.v < riRight.v;
    }
    return (riLeft.u) < (riRight.u);
  }
};
int index(string in) {
  if (in == "A") {
    return 0;
  } else if (in == "B") {
    return 1;
  } else if (in == "C") {
    return 2;
  } else if (in == "D") {
    return 3;
  } else if (in == "E") {
    return 4;
  } else if (in == "F") {
    return 5;
  } else if (in == "G") {
    return 6;
  } else if (in == "H") {
    return 7;
  } else if (in == "I") {
    return 8;
  } else if (in == "J") {
    return 9;
  } else if (in == "K") {
    return 10;
  } else if (in == "L") {
    return 11;
  } else if (in == "M") {
    return 12;
  } else if (in == "N") {
    return 13;
  } else if (in == "O") {
    return 14;
  } else if (in == "P") {
    return 15;
  } else if (in == "Q") {
    return 16;
  } else if (in == "R") {
    return 17;
  } else if (in == "S") {
    return 18;
  } else if (in == "T") {
    return 19;
  } else if (in == "U") {
    return 20;
  } else if (in == "V") {
    return 21;
  } else if (in == "W") {
    return 22;
  } else if (in == "X") {
    return 23;
  } else if (in == "Y") {
    return 24;
  } else if (in == "Z") {
    return 25;
  }
  return -1;
}
long long ma(long long a, long long b) {
  if (a > b) {
    return a;
  } else {
    return b;
  }
}
long long mi(long long a, long long b) {
  if (a < b) {
    return a;
  } else {
    return b;
  }
}
int main(int argc, const char* argv[]) {
  string s;
  cin >> s;
  int ascii[26];
  for (int i = 0; i < 26; i++) {
    ascii[i] = 0;
  }
  for (int i = 0; i < s.size(); i++) {
    ascii[index(s.substr(i, 1))]++;
  }
  int f = 0;
  int choufuku = 0;
  for (int i = 0; i < 26; i++) {
    if (ascii[i] == 0) {
      f = 1;
      break;
    }
    if (ascii[i] == 2) {
      choufuku = i;
    }
  }
  if (f == 0) {
    for (int i = 1; i < s.size(); i++) {
      if (s.substr(i, 1) == s.substr(i - 1, 1)) {
        cout << "Impossible" << endl;
        return 0;
      }
    }
  }
  int before = -1;
  int after = -1;
  for (int i = 0; i < s.size(); i++) {
    if (index(s.substr(i, 1)) == choufuku && before == -1) {
      before = i;
    } else if (index(s.substr(i, 1)) == choufuku) {
      after = i;
    }
  }
  string ueRight = "";
  string ueLeft = "";
  string sitaRight = "";
  string sitaLeft = "";
  if ((after - before) % 2 == 1) {
    ueRight = s.substr(before, (after - before) / 2 + 1);
    sitaRight = s.substr(before + (after - before) / 2 + 1,
                         (after - before) - (after - before) / 2 - 1);
    reverse(sitaRight.begin(), sitaRight.end());
  } else {
    ueRight = s.substr(before, (after - before) / 2);
    sitaRight = s.substr(before + (after - before) / 2,
                         (after - before) - (after - before) / 2);
    reverse(sitaRight.begin(), sitaRight.end());
  }
  string zan = s.substr(after + 1, s.size() - after);
  zan = zan + s.substr(0, before);
  int bb = 13 - (int)sitaRight.size();
  int aa = 13 - (int)ueRight.size();
  sitaLeft = zan.substr(0, bb);
  reverse(sitaLeft.begin(), sitaLeft.end());
  ueLeft = zan.substr(bb, aa);
  cout << ueLeft << ueRight << endl;
  cout << sitaLeft << sitaRight << endl;
  return 0;
}