let swap_lines ro m n =
  let buf = ro.(m) in
  ro.(m) <- ro.(n); ro.(n) <- buf