n times runs instead of backtracking but it works