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