function Main(input) {
  input = input.trim()
  input = input.replace( 9,"#" )
  input = input.replace( 1,9 )
  input = input.replace( "#",1 )
  console.log(input)
}Main(require("fs").readFileSync("/dev/stdin", "utf8"));
