function Main(input) {
  input = input.trim()
  for(var i=0;i<3;i++) input = input.replace( "9","#" )
  for(var j=0;j<3;j++) input = input.replace( "1","9" )
  for(var k=0;k<3;k++) input = input.replace( "#","1" )
  console.log(input)
}Main(require("fs").readFileSync("/dev/stdin", "utf8"));
