that means q=22 and so default string should be printed.

About what DaWei is saying is also correct that when q is 1 in case 1: its not possible to satisfy the conditions.