#include<bits/stdc++.h>
#define int long long
#define N 200005
#define pb push_back
#define fi first
#define se second
#define pii pair<int,int>
using namespace std;
char s[N],ans[2][N]; int pi,pj,n=26;
signed main(){
scanf("%s",s+1);
for(int i=1;i<=n;i++) for(int j=i+1;j<=n+1;j++)
if(s[i]==s[j]) pi=i,pj=j;
if(pj-pi==1) return !printf("Impossible");
int ln=(pj-pi+1)/2,p=pi,q,r0;
for(int i=n/2-ln+1;i<=n/2;i++) ans[0][i]=s[p++];
for(r0=n/2;p<pj;r0--) ans[1][r0]=s[p++];
p=pi-1,q=n/2-ln; while(p&&q) ans[0][q--]=s[p--];
if(p){
for(int i=p;i;i--) ans[1][i]=s[p-i+1];
p=pj+1; for(int i=r0;p<=n+1&&i;i--) ans[1][i]=s[p++];
}else{
p=pj+1; for(int i=r0;p<=n+1&&i;i--) ans[1][i]=s[p++];
if(p<=n+1) for(int i=1;p<=n+1;i++) ans[0][i]=s[p++];
}printf("%s\n%s",ans[0]+1,ans[1]+1);
return 0;
}
873D - Merge Sort | 1251A - Broken Keyboard |
463B - Caisa and Pylons | 584A - Olesya and Rodion |
799A - Carrot Cakes | 1569B - Chess Tournament |
1047B - Cover Points | 1381B - Unmerge |
1256A - Payment Without Change | 908B - New Year and Buggy Bot |
979A - Pizza Pizza Pizza | 731A - Night at the Museum |
742A - Arpa’s hard exam and Mehrdad’s naive cheat | 1492A - Three swimmers |
1360E - Polygon | 1517D - Explorer Space |
1230B - Ania and Minimizing | 1201A - Important Exam |
676A - Nicholas and Permutation | 431A - Black Square |
474B - Worms | 987B - High School Become Human |
1223A - CME | 1658B - Marin and Anti-coprime Permutation |
14B - Young Photographer | 143A - Help Vasilisa the Wise 2 |
320A - Magic Numbers | 1658A - Marin and Photoshoot |
514A - Chewbaсca and Number | 382A - Ksenia and Pan Scales |