Added brute-force solution for P12