Calculating the length of longest terminal chain fixed.