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;
namespace {
using Integer = long long;
template <class T>
istream& operator>>(istream& is, vector<T>& vec) {
  for (T& val : vec) is >> val;
  return is;
}
template <class T>
istream& operator,(istream& is, T& val) {
  return is >> val;
}
template <class T>
ostream& operator<<(ostream& os, const vector<T>& vec) {
  for (int i = 0; i < vec.size(); i++)
    os << vec[i] << (i == vec.size() - 1 ? "" : " ");
  return os;
}
template <class T>
ostream& operator,(ostream& os, const T& val) {
  return os << " " << val;
}
template <class H>
void print(const H& head) {
  cout << head;
}
template <class H, class... T>
void print(const H& head, const T&... tail) {
  cout << head << " ";
  print(tail...);
}
template <class... T>
void println(const T&... values) {
  print(values...);
  cout << endl;
}
template <class H>
void eprint(const H& head) {
  cerr << head;
}
template <class H, class... T>
void eprint(const H& head, const T&... tail) {
  cerr << head << " ";
  eprint(tail...);
}
template <class... T>
void eprintln(const T&... values) {
  eprint(values...);
  cerr << endl;
}
class range {
  long long start_, end_, step_;

 public:
  struct range_iterator {
    long long val, step_;
    range_iterator(long long v, long long step) : val(v), step_(step) {}
    long long operator*() { return val; }
    void operator++() { val += step_; }
    bool operator!=(range_iterator& x) {
      return step_ > 0 ? val < x.val : val > x.val;
    }
  };
  range(long long len) : start_(0), end_(len), step_(1) {}
  range(long long start, long long end) : start_(start), end_(end), step_(1) {}
  range(long long start, long long end, long long step)
      : start_(start), end_(end), step_(step) {}
  range_iterator begin() { return range_iterator(start_, step_); }
  range_iterator end() { return range_iterator(end_, step_); }
};
string operator"" _s(const char* str, size_t size) { return move(string(str)); }
constexpr Integer my_pow(Integer x, Integer k, Integer z = 1) {
  return k == 0    ? z
         : k == 1  ? z * x
         : (k & 1) ? my_pow(x * x, k >> 1, z * x)
                   : my_pow(x * x, k >> 1, z);
}
constexpr Integer my_pow_mod(Integer x, Integer k, Integer M, Integer z = 1) {
  return k == 0    ? z % M
         : k == 1  ? z * x % M
         : (k & 1) ? my_pow_mod(x * x % M, k >> 1, M, z * x % M)
                   : my_pow_mod(x * x % M, k >> 1, M, z);
}
constexpr unsigned long long operator"" _ten(unsigned long long value) {
  return my_pow(10, value);
}
inline int k_bit(Integer x, int k) { return (x >> k) & 1; }
mt19937 mt(chrono::duration_cast<chrono::nanoseconds>(
               chrono::steady_clock::now().time_since_epoch())
               .count());
template <class T>
string join(const vector<T>& v, const string& sep) {
  stringstream ss;
  for (int i = 0; i < v.size(); i++) {
    if (i > 0) ss << sep;
    ss << v[i];
  }
  return ss.str();
}
string operator*(string s, int k) {
  string ret;
  while (k) {
    if (k & 1) ret += s;
    s += s;
    k >>= 1;
  }
  return ret;
}
}  // namespace
constexpr long long mod = 9_ten + 7;
int dx[] = {0, 0, 1, -1, 1, 1, -1, -1};
int dy[] = {1, -1, 0, 0, 1, -1, 1, -1};
int main() {
  string s;
  cin >> s;
  int h = 2, w = 13;
  for (auto i : range(1, s.size())) {
    if (s[i] == s[i - 1]) {
      println("Impossible");
      return 0;
    }
  }
  vector<int> v(26);
  iota(v.begin(), v.begin() + 13, 0);
  iota(v.rbegin(), v.rbegin() + 13, 13);
  for (auto i : range(13)) {
    set<char> used;
    int idx = i;
    vector<char> tmp(26, '.');
    for (auto k : range(s.size())) {
      if (used.count(s[k])) {
        continue;
      }
      used.insert(s[k]);
      tmp[v[idx]] = s[k];
      idx = (idx + 1) % 26;
    }
    function<bool(int, int)> check = [&](int pos, int k) {
      if (k + 1 == s.size()) return true;
      int x = pos % 13;
      int y = pos / 13;
      for (int k__ = 0; k__ < 8; k__++) {
        int new_x = x + dx[k__];
        int new_y = y + dy[k__];
        if (new_x < 0 || new_x >= w || new_y < 0 || new_y >= h) continue;
        int pos_nx = new_y * w + new_x;
        if (s[k + 1] == tmp[pos_nx]) {
          return check(pos_nx, k + 1);
        }
      }
      return false;
    };
    if (check(i, 0)) {
      println(join(vector<char>(tmp.begin(), tmp.begin() + w), ""));
      println(join(vector<char>(tmp.begin() + w, tmp.end()), ""));
      return 0;
    }
  }
  println("Impossible");
  return 0;
}