A canonical decomposition for linear operators and linear relations