Hebrews 12:10-11

10 They disciplined us for a little while as they thought best; but God disciplines us for our good, in order that we may share in his holiness.
11 No discipline seems pleasant at the time, but painful. Later on, however, it produces a harvest of righteousness and peace for those who have been trained by it.