Canonical decomposition of Hessenberg matrices