#define _GLIBCXX_DEBUG #define ll long long #include using namespace std; using Graph = vector>; int main(){ string S; cin >> S; string A = "", B = ""; for(int i = 0; i < (int)S.size(); i++){ if(S[i] == '7'){ A += "1"; B += "6"; }else{ A += S[i]; B += "0"; } } int ans1 = stoi(A), ans2 = stoi(B); cout << ans1 << " " << ans2 << endl; }