main(require('fs').readFileSync('/dev/stdin', 'UTF-8'));
function main(N){
  var a = N.charAt(0);
  var b = N.charAt(2);
  var c = N.charAt(4);
  if(a.length==5&&b.length==7&&c.length==5){
    console.log("YES");
  }else{
    console.log("NO");
  }
}