Working version of Dimacs conversion