Works for i1 < j1