Asymptotic behavior of cutoff effects in Yang-Mills theory and in Wilson's lattice QCD