Minor identities for quasi-determinants and quantum determinants