We can solve for q by setting (i2*i4*i6*i8) = 1 and setting the rest to 0
On solving for q, we can decrypt the flag
from Crypto.Util.number import *
q = 12538849920148192679761652092105069246209474199128389797086660026385076472391166777813291228233723977872612370392782047693930516418386543325438897742835129
n = 158794636700752922781275926476194117856757725604680390949164778150869764326023702391967976086363365534718230514141547968577753309521188288428236024251993839560087229636799779157903650823700424848036276986652311165197569877428810358366358203174595667453056843209344115949077094799081260298678936223331932826351
c = 72186625991702159773441286864850566837138114624570350089877959520356759693054091827950124758916323653021925443200239303328819702117245200182521971965172749321771266746783797202515535351816124885833031875091162736190721470393029924557370228547165074694258453101355875242872797209141366404264775972151904835111
e = 65535
p = n//q
d = inverse(e,(p-1)*(q-1))
print(long_to_bytes(pow(c,d,n)))
b'uiuctf{h4rd_w0rk_&&_d3t3rm1n4t10n}'
It is similar to the except instead of trace, they give us the determinant of the matrix with p and q values encoded