add more tests for P18
solve P19