sorted lines matrix with bubble sort and xor for interchange items