#include <bits/stdc++.h>
using namespace std;
int up, down;
int first, second;
int pos[10000];
char input[1000], str[1000];
char tile[100][100];
int main() {
  for (char c = 'A'; c <= 'Z'; c++) {
    pos[c] = -1;
  }
  for (int i = 1; i <= 27; i++) {
    scanf("%c", &input[i]);
    str[i - 1] = input[i];
    if (pos[input[i]] != -1) {
      first = pos[input[i]];
      second = i;
    } else {
      pos[input[i]] = i;
    }
  }
  if (second - first == 1) {
    cout << "Impossible";
    return 0;
  }
  up = (second - first + 1) / 2;
  if ((second - first) % 2 == 0) {
    down = up;
  } else {
    down = up - 1;
  }
  tile[1][up] = input[first];
  tile[2][down] = input[first + 1];
  int idx = first + 2 - 1;
  for (int i = down - 1; i >= 1; i--) {
    tile[2][i] = str[idx % 27];
    idx++;
  }
  for (int i = 1; i < up; i++) {
    tile[1][i] = str[idx % 27];
    idx++;
  }
  idx++;
  for (int i = up + 1; i <= 13; i++) {
    tile[1][i] = str[(idx) % 27];
    idx++;
  }
  for (int i = 13; i > down; i--) {
    tile[2][i] = str[(idx) % 27];
    idx++;
  }
  for (int i = 1; i <= 13; i++) cout << tile[1][i];
  cout << endl;
  for (int i = 1; i <= 13; i++) cout << tile[2][i];
  return 0;
}
