#include <bits/stdc++.h>
using namespace std;
int occ[26];
string s;
int dou;
int a = -1, b = -1, diff;
char r[26];
int main() {
  cin >> s;
  for (int i = 0; i < 27; ++i) occ[s[i] - 'A']++;
  for (int i = 0; i < 26; ++i)
    if (occ[i] > 1) dou = i;
  for (int i = 0; i < 27; ++i) {
    if (s[i] - 'A' != dou) continue;
    if (a == -1)
      a = i;
    else
      b = i;
  }
  diff = b - a;
  if (diff == 1) {
    cout << "Impossible\n";
    return 0;
  }
  if (diff == 2) {
    int f = 11;
    int c = f - 1;
    for (int i = a - 1; i >= 0; --i) {
      r[c] = s[i];
      if (c == 0)
        c = 13;
      else if (c < 13)
        c--;
      else
        c++;
    }
    r[11] = s[a];
    r[12] = s[a + 1];
    c = 25;
    for (int i = a + 3; i < 27; ++i) {
      r[c] = s[i];
      if (c > 13)
        c--;
      else if (c == 13)
        c = 0;
      else
        c++;
    }
  } else if (diff % 2 == 0) {
    int f = 13 - (diff / 2);
    int c = f - 1;
    for (int i = a - 1; i >= 0; --i) {
      r[c] = s[i];
      if (c == 0)
        c = 13;
      else if (c < 13)
        c--;
      else
        c++;
    }
    c = f + 14;
    for (int i = a + 1; i < 27; ++i) {
      r[c] = s[i];
      if (c == 25)
        c = 12;
      else if (c > f + 13)
        c++;
      else if (c == f + 1)
        c = f + 13;
      else if (c == f + 13)
        c = f;
      else if (c == f)
        c = f + 12;
      else if (c > f + 1 && c < 13)
        c--;
      else if (c < f)
        c++;
      else if (c == 13)
        c = 0;
      else
        c--;
    }
  } else {
    int f = 12 - (diff / 2);
    int c = f - 1;
    for (int i = a - 1; i >= 0; --i) {
      r[c] = s[i];
      if (c == 0)
        c = 13;
      else if (c < 13)
        c--;
      else
        c++;
    }
    c = f + 14;
    for (int i = a + 1; i < 27; ++i) {
      r[c] = s[i];
      if (c == 25)
        c = 12;
      else if (c > f + 13)
        c++;
      else if (c > 13)
        c--;
      else if (c == 13)
        c = 0;
      else if (c < f)
        c++;
      else if (c == f)
        c = f + 13;
      else
        c--;
    }
  }
  if (diff == 25 && a == 1)
    r[13] = s[0];
  else if (diff == 25)
    r[13] = s[26];
  for (int i = 0; i < 13; ++i) cout << r[i];
  cout << "\n";
  for (int i = 13; i < 26; ++i) cout << r[i];
  cout << "\n";
}
